[Mapbender-commits] r3979 - in branches/google_dev: . trunk
trunk/conf trunk/core trunk/http trunk/http/classes
trunk/http/css trunk/http/html trunk/http/include
trunk/http/javascripts trunk/http/php trunk/http/print
trunk/lib trunk/license trunk/resources/db/update trunk/tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jun 2 11:24:25 EDT 2009
Author: christoph
Date: 2009-06-02 11:24:25 -0400 (Tue, 02 Jun 2009)
New Revision: 3979
Added:
branches/google_dev/trunk/
branches/google_dev/trunk/Changes.txt
branches/google_dev/trunk/Install.txt
branches/google_dev/trunk/conf/digitize_default.conf
branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf
branches/google_dev/trunk/conf/wfs_default.conf
branches/google_dev/trunk/core/system.php
branches/google_dev/trunk/http/classes/
branches/google_dev/trunk/http/classes/class_gml_2_factory.php
branches/google_dev/trunk/http/classes/class_gml_3_factory.php
branches/google_dev/trunk/http/classes/class_gml_factory.php
branches/google_dev/trunk/http/classes/class_gml_line.php
branches/google_dev/trunk/http/classes/class_gml_multiline.php
branches/google_dev/trunk/http/classes/class_gml_multipolygon.php
branches/google_dev/trunk/http/classes/class_gml_point.php
branches/google_dev/trunk/http/classes/class_gml_polygon.php
branches/google_dev/trunk/http/classes/class_wms.php
branches/google_dev/trunk/http/css/digitize.css
branches/google_dev/trunk/http/html/
branches/google_dev/trunk/http/html/mod_treefolderPlain.php
branches/google_dev/trunk/http/img/
branches/google_dev/trunk/http/include/dyn_css.php
branches/google_dev/trunk/http/include/dyn_js.php
branches/google_dev/trunk/http/index.php
branches/google_dev/trunk/http/javascripts/
branches/google_dev/trunk/http/javascripts/geometry.js
branches/google_dev/trunk/http/javascripts/map_obj.js
branches/google_dev/trunk/http/javascripts/mod_featureInfo.php
branches/google_dev/trunk/http/javascripts/mod_sandclock.php
branches/google_dev/trunk/http/javascripts/popup.js
branches/google_dev/trunk/http/php/
branches/google_dev/trunk/http/php/mod_loadwmc_server.php
branches/google_dev/trunk/http/php/mod_savewmc_server.php
branches/google_dev/trunk/http/print/mod_printPDF.php
branches/google_dev/trunk/http/print/mod_printPDF_pdf.php
branches/google_dev/trunk/lib/ajax.js
branches/google_dev/trunk/lib/ajax.php
branches/google_dev/trunk/lib/basic.js
branches/google_dev/trunk/lib/event.js
branches/google_dev/trunk/license/Liberation-License.txt
branches/google_dev/trunk/license/bitstream-COPYRIGHT.TXT
branches/google_dev/trunk/license/dejavu-LICENSE
branches/google_dev/trunk/resources/
branches/google_dev/trunk/resources/db/update/update_2.7.sql
branches/google_dev/trunk/tools/
branches/google_dev/trunk/tools/send_post_curl.php
Removed:
branches/google_dev/trunk/Changes.txt
branches/google_dev/trunk/Install.txt
branches/google_dev/trunk/conf/digitize_default.conf
branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf
branches/google_dev/trunk/conf/wfs_default.conf
branches/google_dev/trunk/core/system.php
branches/google_dev/trunk/http/classes/
branches/google_dev/trunk/http/classes/class_gml_2_factory.php
branches/google_dev/trunk/http/classes/class_gml_3_factory.php
branches/google_dev/trunk/http/classes/class_gml_factory.php
branches/google_dev/trunk/http/classes/class_gml_line.php
branches/google_dev/trunk/http/classes/class_gml_multiline.php
branches/google_dev/trunk/http/classes/class_gml_multipolygon.php
branches/google_dev/trunk/http/classes/class_gml_point.php
branches/google_dev/trunk/http/classes/class_gml_polygon.php
branches/google_dev/trunk/http/classes/class_wms.php
branches/google_dev/trunk/http/css/digitize.css
branches/google_dev/trunk/http/html/
branches/google_dev/trunk/http/html/mod_treefolderPlain.php
branches/google_dev/trunk/http/img/
branches/google_dev/trunk/http/include/dyn_css.php
branches/google_dev/trunk/http/include/dyn_js.php
branches/google_dev/trunk/http/index.php
branches/google_dev/trunk/http/javascripts/
branches/google_dev/trunk/http/javascripts/geometry.js
branches/google_dev/trunk/http/javascripts/map_obj.js
branches/google_dev/trunk/http/javascripts/mod_featureInfo.php
branches/google_dev/trunk/http/javascripts/mod_sandclock.php
branches/google_dev/trunk/http/javascripts/popup.js
branches/google_dev/trunk/http/php/
branches/google_dev/trunk/http/php/mod_loadwmc_server.php
branches/google_dev/trunk/http/php/mod_savewmc_server.php
branches/google_dev/trunk/http/print/mod_printPDF.php
branches/google_dev/trunk/http/print/mod_printPDF_pdf.php
branches/google_dev/trunk/lib/ajax.js
branches/google_dev/trunk/lib/ajax.php
branches/google_dev/trunk/lib/basic.js
branches/google_dev/trunk/lib/event.js
branches/google_dev/trunk/resources/
branches/google_dev/trunk/resources/db/update/update_2.7.sql
branches/google_dev/trunk/tools/
Modified:
branches/google_dev/trunk/conf/session.conf
branches/google_dev/trunk/core/globalSettings.php
branches/google_dev/trunk/http/classes/class_user.php
branches/google_dev/trunk/http/html/mod_treefolder2.php
branches/google_dev/trunk/http/javascripts/map.js
branches/google_dev/trunk/http/javascripts/map.php
branches/google_dev/trunk/http/javascripts/mod_changeEPSG.php
branches/google_dev/trunk/http/javascripts/mod_digitize_tab.php
branches/google_dev/trunk/http/javascripts/mod_dragMapSize.php
branches/google_dev/trunk/http/javascripts/mod_dynamicOverview.php
branches/google_dev/trunk/http/javascripts/mod_export_image.php
branches/google_dev/trunk/http/javascripts/mod_print1.php
branches/google_dev/trunk/http/javascripts/mod_resize_mapsize.php
branches/google_dev/trunk/http/javascripts/mod_scaleHint.php
branches/google_dev/trunk/http/javascripts/mod_scaleText.php
branches/google_dev/trunk/http/javascripts/mod_selectMapsize.php
branches/google_dev/trunk/http/javascripts/mod_usemap.php
branches/google_dev/trunk/http/javascripts/mod_wfs_SpatialRequest.php
branches/google_dev/trunk/http/javascripts/mod_wfs_gazetteer_client.php
branches/google_dev/trunk/http/javascripts/ovnf.php
branches/google_dev/trunk/http/javascripts/wms.js
branches/google_dev/trunk/http/php/mb_validateSession.php
branches/google_dev/trunk/http/php/mod_changeEPSG_dynamic.php
branches/google_dev/trunk/http/php/mod_mapOV.php
branches/google_dev/trunk/http/php/mod_meetingPoint.php
branches/google_dev/trunk/http/php/mod_wfs.php
branches/google_dev/trunk/http/php/mod_wfs_gazetteer_server.php
branches/google_dev/trunk/lib/core.js
branches/google_dev/trunk/lib/point.js
Log:
Copied: branches/google_dev/trunk (from rev 3711, trunk/mapbender)
Deleted: branches/google_dev/trunk/Changes.txt
===================================================================
--- trunk/mapbender/Changes.txt 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/Changes.txt 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,419 +0,0 @@
-The following Link gives a review on the changes in Mapbender you can get in the WIKI
-
-http://www.mapbender.org/index.php/Version_History
-
-------------------------
-
-Changelog 2.4.2
-
- english
-
- bug fixes: see http://trac.osgeo.org/mapbender/report/9
-
- new features
-
- * set WMS opacity in treeGDE2
- * Bulgarian translation of the introduction to Mapbender
- * improved module Add WMS from filtered list: loading a configured WMS from a GUI is now possible
- * updated Meetingpoint / Treffpunkt: new image, some bugfixes
- * improved exception handling / log levels (see mapbender.conf#Mapbender_error_logging)
- * poi (not included in a GUI yet)
- * JavaScript compression; Mapbender will load faster
- * dynamic overview - integration in the rc1 an testing gui2
- * treeGDE2 replaces treeGDE
- * different configurations of treeGDE2
- * first draft of an API documentation for JavaScript classes
- * print temporary objects (lines and polygons) which where drawn with the measure element
-
- deutsch
-
- behobene Fehler: siehe http://trac.osgeo.org/mapbender/report/9
-
- neue Features
-
- * Einstellen der Deckkraft (Opacity) einzelner WMSe in der TreeGDE2
- * Bulgarische Übersetzung der Mapbender-Einführung
- * Verbesserung des Moduls Add WMS from filtered list: es ist nun möglich, konfigurierte WMSe aus GUIs zu laden
- * Update des Moduls Meetingpoint / Treffpunkt: neue Bilddatei, diverse Fehler behoben
- * Verbessertes Logging, auch von JavaScript Fehlern (siehe mapbender.conf#Mapbender_error_logging)
- * poi (noch in keiner GUI enthalten)
- * JavaScript Kompression; Mapbender lädt schneller
- * Dynamisches Overview
- * TreeGDE2 ersetzt die alte Baumstruktur
- * verschiedene Konfigurationen der TreeGDE2 in den Standard-GUIs
- * vorläufige API Dokumentation für JavaScript Klassen
- * Druck von temporären Objekten (Linien und Polygone), die mit dem "measure" Element erstellt wurden
-
-
-Changelog 2.4.1
-
-english
-
-
-
-new features
-
-bug fixes
-
- * 1658777 Export GUI SQL unsorted
- * 1634035 Wfs geometry name not sorted by position
- * 1647206 sort order of modules in gui element list
- * 1635839 JS error: document.form1.newGuiName has no properties
- * 1589764 wms loading problems when abstract contain linebreak
- * 1653348 mod_filteredGroup_filteredGui.php
- * 1653160 Metadata: Undefined variable: wms_id
- * 3 Online resource incorrect in monitoring module
- * 11 wrong sort order in edit_gui_wms
-
-
-database changes
-
-see latest database changes.
-
-deutsch
-
-Changelog Mapbender 2.4.1 rc1
-
-english
-
- * changes in database architecture: For update have a look in the wiki at dbchanges or Database_Changes_2.4.1. The update sqls you find in the download package in the folder mapbender/resources/db/update/
- * WFS_gazetteer possibility to handle several wfs_confs and choose from a select-box - thanx to User:Verena Diewald
- * new treeGDE - thanx to User:Melchior Moos
- * new element setPOI2Scale mod_setPoi2Scale to open a GUI at a special coordinate and scale - have a look Mod_setPoi2Scale
- * extended ResizeMapsize functionality - Modul can act automatically or by button click. 3 element vars are added.
- * new administration functionality OrphanWMS to find information about orphaned WMS and to fix them.
- * new functionality meetingPoint to generate meeting points and export them as text or via email. The url can be displayed by highlightPOI
- * pdf-Print now with Din-A2 support
- * new element highlightPOI (mod_highlightPOI.php) to open a gui and set poi points with text
- * metadata handling
- * new admin guis
- * wfs bug fix for digitize modul
- * featureinfo tunnel closes empty result windows automatically
-
-
-deutsch
-
- * Änderungen in der Datenbankarchitektur: Angaben im Wiki unter dbchanges oder Database_Changes_2.4.1. Die update-sqls befinden sich im Download-Paket im Verzeicnis mapbender/resources/db/update/
- * WFS_gazetteer Auswahlmöglichkeit zwischen mehreren WFS-Konfigurationenüber eine Auswahlliste - thanx to User:Verena Diewald
- * treeGDE - neue Baumstruktur - thanx to User:Melchior Moos
- * Neues Modul add_vendorspecific.
- * Neues Element setPOI2Scale um eine GUI an einen Punkt in einem bestimmten Maßstab zu öffnen Mod_setPoi2Scale.
- * Erweiterung des Moduls resizeMapsize. Kartenfenster kann sich automatisch an die Browsergröße anpasssen oder über einen Button. 3 Element vars wurden hinzugefügt.
- * Neues Administrationselement OrphanWMS, dass informationen über verwaiste WMS liefert und diese löschen kann.
- * Neues Element meetingPoint um Treffpunkte zu generieren und diese als Text oder via E-Mail zu exportieren. Die URL kann durch highlightPOI angezeigt werden.
- * pdf-Print nun auch mit Din-A2 Unterstützung (Dank an Frank Härtel und Horst Becker).
- * Neues Element highlightPOI (mod_highlightPOI.php) ermöglicht es beim Öffnen einer GUI ein oder mehrere Punkte mit Beschriftung zu setzen.
- * Metadaten handling.
- * Featureinfotunnel schließt leere Fenster ohne Ergebnis gleich wieder.
-
-
-Changelog Mapbender 2.4
-
-english
-
- * bugs in loadWMC are fixed
- * new module resizeMapsize to resize the Mapsize depending on the size of the browser window
- * new module monitorCapabilities: periodically checks all WMS and gathers data in the new table mb_monitor (see Database_Changes_2.4)
- * new module initWMC: starts the client with a wmc.
- * wms_extent - WMS representing the EXTENTs of the WMS loaded in Mapbender
-
-
-deutsch
-
- * Bugs im Modul loadWMC wurden behoben.
- * Neues Modul resizeMapsize das Modul paßt die Kartengröße in Abhängigkeit von der Größe des Browserfensters dynamisch an.
- * Neues Modul monitorCapabilities: periodisch werden alle WMSe kontrolliert und alle Daten in der neuen Tabelle mn_monitor erfaßt (siehe auch Database_Changes_2.4).
- * Neues Modul initWMC: startet den Client mit einem WMS.
- * wms_extent - WMS, der die Ausdehnungen (Extent) der in Mapbender geladenen WMSe anzeigt.
-
-
-Changelog 2.4 rc2
-
-english
-
- * mapbender changed to Subversion (svn), big effort is done in code cleaning
- * owsproxy is implemented
- * treeGDE improved, now there is the possibility to handle the layers of a wms with one click (all layer on / all layer off). new element var switchwms
- * bugs in legend solved
- * changes in database architecture: new table wfs_featuretype_namespace, new column wms_owsproxy in table wms, new column wms_upload_url in table wms. For update have a look at dbchanges or Database Changes 2.4
- * perpared statements for PHP > 5.1.x, PostgreSQL > 7.4
- * new gui_digitize in the installation package. Read more about Digitizing
- * new gui2 in the installation package with new buttons (button_blue), new tree-style (tree_blue) and more color.
- * default md5-encryption for the passwords in MySQL and PostgreSQL. Mapbender is doing the md5-encryption.
- * extended mapbender_setup.php with more information (Thanks to Marko Samson)
- * new element deleteWFS in GUI admin1
- * printPDF: highquality print and matching for the overview image
- * new help: every element in the gui refers to a page in the Mapbender wiki. The link is saved in the table gui_element column e_url and can be changed individual.
-
-
-deutsch
-
- * Mapbender wechselt zum Subversion (svn) mit dem damit verbundenen Code cleaning
- * owsproxy
- * treeGDE wurde verbessert, es gibt nun die Möglichkeit alle Layer eines WMS durch einen Klick an- bzw. auszustellen.
- * Bugs in der Legende behoben
- * Veränderungen in der Datenbankarchitektur: neue Tabelle wfs_featuretype_namespace, neue Spalte wms_owsproxy in Tabelle wms, neue Spalte wms_upload_url in Tabelle wms. Um eine bestehende Datenbank zu aktualisieren, gibt es unter dbchanges weitere Informationen. Database Changes 2.4
- * Es besteht die Möglichkeit Perpared Statements ab PHP > 5.1.x, PostgreSQL > 7.4 einzusetzen
- * Neue gui_digitize im Installationsumfang. Mehr unter Digitizing
- * Neue gui2 im Installationsumfang mit neuen Buttons (button_blue), neuem Style für die Baumstruktur (tree_blue) und mehr Farbe
- * Standardmäßige md5-Verschlüsselung des Passworts in MySQL und PostgreSQL. Mapbender verschlüsselt nun das Passwort, nicht die Datenbank.
- * mapbender_setup.php liefert nun mehr Informationen und weist auf Fehler hin (Danke an Marko Samson)
- * Neues Element deleteWFS in der GUI admin1
- * printPDF: für den Overview ist nun auch der hochqualitative Druck und das Matching möglich
- * Hilfebutton: jedes Element der GUI ist direkt mit der Hilfeseite im Mapbender Wiki verlinkt (Eintrag in der Tabelle gui_element Spalte e_url). Dieser Link kann an die jeweilige Umgebung angepaßt werden.
-
-
-Changelog 2.2.3
-
-english
-
- * print: now with overview window with position rectangle and scalebar
-
- * gui_de and gui1_de are no longer part of the standard installation of mapbender, as it is too much work to handle 4 guis. If you want a german gui, you have to change the tool tip texts. In the next versions we want to handle the language differences with element vars.
-
- * WMC handling: includes DisplayWMC, loadWMC, saveWMC and listWMC.
-
- * element logout: now with element_var logout_location to define the webside to show after logout
-
- * the overview window of the pdf-print is now displayed in highquality, if you use highquality = true in your print-configuration
-
- * there has been some rework done at the AddWMS functions. Now the mod_addWMSgeneralFunctions.js offers the functions mod_addWMS_load and mod_addWMS_refresh to the elements addWMSfromfilteredList and addWMSfromList IMPORTANT: JS has to be added as modul in the element-definition
-
- * element tabs (mod_tab.php) now with element_var open_tab to decide which tab should be opened at the beginning
-
- * print : there where errors in the generation of the legend especially with grouped layers
-
- * legend : new element_var checkbox_on_off to decide wether you want to show or hide the on/off checkbox - there where errors in the generation of the legend especially with grouped layers
-
- * legend: new element var : stickylegend to decide wether the legend should stick at the mapframe1
-
- * connection to GEOS function for mysql users: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - database parameters where added to the mapbender.conf to enable Mapbender user with mysql-Administration to transform and change the projection
-
- * encoding of Mapbender: now UTF-8 or ISO-8859-1 can be choosed as the encoding for the database (have a look in the mapbender.conf CHARSET)
-
- * fixed: WFS configuration caused errors with postgresql database
-
- * copyright now works with element var for the copyright text: define the JavaScript Variable mod_copyright_text with a text you want as value
-
- * fixed: there was an error in class_log, now the printed maprequests should be logged
-
- * database changes
-
-
-deutsch
-
- * print: nun mit Übersichtsfenster mit Positionsrechteck und Maßstabsleiste (beide Funktionalitäten können in der Konfigurationsdatei des Drucks an- oder ausgestellt werden)
-
- * Die Oberflächen gui1_de und gui_de werden nicht mehr weitergeführt, da es zu viel Aufwand darstellt 4 Oberflächen weiterzuführen. Wenn eine deutsche Oberfläche gebraucht wird können die ToolTipTexte auf deutsch angelegt werden. Die Mehrsprachigkeit der einzelnen Elemente soll zukünftig über die Element vars gelöst werden.
-
- * WMC-Nutzung: beinhaltet anzeigen (DisplayWMC), laden (loadWMC), speichern (saveWMC) eines WMCs und auflisten aller WMCs (listWMC).
-
- * Element logout: verfügt nun über den element_var logout_location, um zu definieren welche Webseite nach dem Logout angezeigt werden soll.
-
- * Das Übersichtsfenster des PDF-Drucks wird nun auch hochqualitativ angezeigt bei hochqualitativem Druck.
-
- * Die AddWMS Funktionalität wurde überarbeitet. Eine neue Datei mod_addWMSgeneralFunctions.js stellt nun die Funktionen mod_addWMS_load und mod_addWMS_refresh zur Verfügung. Wichtig für die Elemente addWMSfromfilteredList and addWMSfromList das JavaScript mod_addWMSgeneralFunctions.js muß in der Elementdefinition unter Modul angegeben werden.
-
- * Element tabs (mod_tab.php) wurde um die element_var open_tab erweitert, um beim Start des Clients einen tab voreingestellt zu öffnen.
-
- * print: Fehler in der Legende bei gruppierten Ebenen beseitigt.
-
- * legend: Neue element_var: checkbox_on_off zur Steuerung der on/off checkbox.
-
- * legend: Neue element_var: stickylegend zur Steuerung des Anzeigefesters der Legende (Positionierung / sticky-Frame).
-
- * Bereitstellung der GEOS Funktionen für Mapbender mit mysql-Administrationsdatenbank: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - Zusätzliche Datenbankparameter für eine PostgresDB neben der mysql-Administrationsdatenbank, zur Transformation von Projektionssystemen und Berechnung von Flächen.
-
- * Encoding (Zeichensatz) in Mapbender: es besteht nun die Auswahl zwischen UTF-8 oder ISO-8859-1 als Zeichensatz (die Angabe erfolgt in der mapbender.conf CHARSET)
-
- * wfs configuration: WFS Konfiguration erzeugte Fehler mit der PostgreSQL-Datenbank.
-
- * copyright: Neue element_var mod_copyright_text, Angabe zum Copyright-Text über die Administrationsoberfläche.
-
- * fixed: Fehler in class_log behoben.
-
- * Datenbankänderungen
-
-
-Changelog 2.2.2
-
-english
-
- * Unfortunately there was a bug left in the PostgreSQL database-module. In the edit gui-menu no templates from other guis were shown so that it was impossible to modify guis.
-
-To fix this, minor changes in the PostgreSQL database-structure were necessary. If you are updating, please do not use an already existing V. 2.2.1-database and create the database with the SQL-dumps attached to this version instead.
-
-
-
-deutsch
-
- * Leider war noch ein Fehler im PostgreSQL Datenbank-Modul übersehen worden. Da im Menü Oberflächenelemente editieren die bestehenden GUIs und deren Elemente nicht angezeigt wurden, um sie als Templates zu verwenden, ließen sich die GUIs nicht nach den eigenen Bedürfnissen anpassen.
-
-Um diesen Fehler zu beheben wurden kleinere Änderungen in der PostgreSQL Datenbank-Struktur vorgenommen. Bitte verwenden Sie daher keine bereits existierende V. 2.2.1-Datenbank falls Sie updaten, sondern benutzen Sie bitte die SQL-Dumps, die dieser Version beigefügt sind.
-
-Changelog 2.2.1
-
-english
-
-We have been a bit quick with the release 2.2 and didn't put the focus on documentation and debugging. But with the help of the users of Mapbender we fixed the bugs and now there is the next Mapbender version for download.
-
- * There where some bugs when you run Mapbender with PostgreSQL. Hope they are fixed. Have a look at the Installation to find out about how to configure Mapbender (configuration files have been consolidated into ./conf/mapbender.conf)
-
- * the name of two columns had to be changed:
- o mb_log.session changes to mb_log.mb_session (session is a reserved name in postgresql)
- o gui_element.e_closeTag changed to gui_element.e_closetag (all table- and columnnames are handled in lower case)
-
- * Sequences in PostgreSQL: if you use postgresql you have to set sequences for the serial columns so that the next value for the serial is fixed. user mapbender/resources/db/pgsql_serial_set_sequences.sql to set the sequences
-
- * changeEPSG and calculating areas at the moment is only possible for user with PostgreSQL/PostGIS database
-
-
-deutsch
-
-Vielleicht waren wir etwas voreilig mit dem Mapbender Release 2.2 und haben den Fokus nicht auf die Dokumentation und das Debuggig gesetzt. Aber mit Hilfe der User sind viele Fehler aufgezeigt worden und konnten gelöst werden. Hier nun der neue Mapbender 2.2.1. Derzeit gibt es noch keine Dokumentation und auch kein Skript für den automatisierten Update einer bestehenden Mapbender Installation. Die vormals eingesetzen Skripte mapbender_setup.php und validate_db.php können derzeit nicht mehr verwendet werden und wurden aus dem Paket entfernt. Die Skripte müssen erst wieder auf den neuen Release angepaßt werden, damit sie wieder zum Einsatz kommen können.
-
- * es lagen einige Bugs bei der Verwendung von PostgreSQL als Administrationsdatenbank vor. Diese sind hoffentlich alle beseitigt. In der Installationsanleitung unter
-
-mapbender.conf findet sich alles wichtige zur Installation (Alles ist nun einfacher. Es muß nur noch die Datei mapbender.conf angepaßt werden)
-
- * der Name zweier Spalten hat sich geändert:
- o mb_log.session geändert in mb_log.mb_session (session reserviertes Wort in PostgreSQL)
- o gui_element.e_closeTag geändert in gui_element.e_closetag (alle Tabellen- und Spaltennamen in Kleinbuchstaben)
-
- * Sequences in PostgreSQL: bei der Verwendung von PostgreSQL müssen die Sequenzen der Autowerte nach dem Laden der Daten explizit gesetzt werden. Dazu steht die Datei mapbender/resources/db/pgsql_serial_set_sequences.sql zur Verfügung
-
- * changeEPSG und Flächenberechnung steht derzeit nur Benutzern mit einer PostgreSQL-Datenbank zur Verfügung
-
-
-Changelog 2.2.0
-[edit]
-english
-
-Here you find a list with the changes in Mapbender 2.2.0:
-
- * The configuration files have been consolidated into one single mapbender.conf
- * Now Mapbender 2.2.0 is able to work with MySQL- or PostgreSQL-database. Configure the settings in the mapbender.conf.
- * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var).
- * WFS
- * Proxy
- * PrintPDF. This module enables you to configure the PrintPDF containing an overview, legend, northarrow and your logo.
- * Click on a Layer refers to the WMS METADATAURL - new column layer_metadataurl.
- * The legend is displayed by the LEGENDURL.
- * New Wiki: To edit the new wiki you have to ask for an account at mailto:info at mapbender.org.
- * ToggleModule to define a function to be active when the gui is opened
-
-Here you already find a list with the changes in Mapbender 2.2:
-
- * Mapbender for MySQL or PostgreSQL
- * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var)
- * click on a Layer refers to the WMS METADATAURLD - new column layer_metadataurl
- * the legend is displayed by the LEGENDURL
-
-
-deutsch
-
-Hier die Änderungen, die mit der Version 2.2 erfolgt sind:
-
- * Nun ist es möglich Mapbender mit einer MySQL- oder PostgreSQL-Datenbank zu installieren. Konfigurieren Sie die Einstellungen in der Datei mapbender.conf.
- * Sie können die einzelnen Elemente einer GUI mit der Mapbender-Administration editieren (Tabelle element_vars/ css-files/ var).
- * WFS
- * Proxy
- * PrintPDF. Dieses Modul erlaubt es dem Benutzer den PrintPDF zu konfigurieren und beinhaltet Overview, Legende, Nordpfeil und ein Logo.
- * Neue Buttons (button_oo) sind in der GUI 'gui' verfügbar.
- * Ein Klick auf einen Layer referenziert die WMS METADATAURL - neue Spalte layer_metadataurl.
- * Die Legende wird durch die LEGENDURL dargestellt.
- * Neues Wiki: Um im neuen Wiki editieren zu können, müssen Sie einen Account beantragen bei CCGIS.
- * ToggleModule - definiert ein Element, das beim Start der GUI aktiviert sein soll
-
-Hier aber schonmal die Änderungen, die uns mit der Version 2.2 erwarten:
-
- * Mapbender für MySQL oder PostgreSQL
- * Anpassung der einzelnen Elemente einer GUI über die Mapbender-Administration (element_vars)
- * Metadataurl
- * Legendurl
-
-
-Changelog 2.1.0
-
-english
-
- * communication by email mail.conf
- * new button myGUIlist in the administration-guis to go back to the list of myGUIs
- * New table mb_log
- * New column in table wms wms_getCapabilities_doc
- * ChangeEpsg_dynamic
- * Edit gui shows the images of a gui as little pictures (better orientation)
- * sql to update the mapbender standard guis Update Mapbender
- * mapbender/http/tools/validate_db.php - php to update the database and add new columns and tables if necessary
- * New column layer_dataurl in table layer
- * New columns legendurl and legendurlformat in table layer_style
- * New table wms_srs
- * Security update in Edit GUI Elements
-
-
-deutsch
-
- * Kommunikation über email mail.conf
- * Neuer Button myGUIlist für die Administrations-GUIs, um in die Liste von meinenGUIs zurück zu kommen.
- * Neue Tabelle mb_log
- * Neue Spalte in der Tabelle wms wms_getCapabilities_doc
- * ChangeEpsg_dynamic
- * Die Rubrik 'Oberflächenelemente editieren' zeigt nun kleine Bilder der Oberfläche zur besseren Orientierung.
- * SQL zur Aktualisierung Ihrer GUIs: siehe Update Mapbender
- * mapbender/http/tools/validate_db.php - PHP, um die Datenbank zu aktualisieren und wenn nötig neue Spalten und Tabellen hinzuzufügen.
- * Neue Spalte layer_dataurl in der Tabelle layer hinzugefügt.
- * Neue Spalten 'legendurl' und 'legendurlformat' in der Tabelle layer_style hinzugefügt.
- * Neue Tabelle wms_srs
-
-
-Changelog 2.1.0 rc1
-
-english
-
- * Print with Mapbender Version 2.1.0 pdf-print is used as standard. You have the possibility to choose A4 or A3 and landscape or portrait. The printframe can be styled to your own design by editing a configuration file.
- * GUIOwner a new parameter <owner> has been added to the user management. This allows a distinction between reading/using a GUI and being allowed to change it ( edit GUI elements). This feature is necessary as a preliminary step to open Mapbender as a portal with anonymous access which is needed to implement Wikimaps functionality. Additionally this enables setting up a hierarchical administration.
- * Overview The overview map should be addressed with the module Overview, (<Overview0>, <Overview1>, <Overview2>, ... are deprecated). The module can be parameterized with the field "wms". It contains the index of the WMS which should be displayed in the overview map. (starting at 0).
- * showCoords_div On button click the coordinate of the mouseposition will be displayed below the target (e.g. mapframe1)
- * Detailed metadatainformation for a GUI. Also information about the last requests as a link.
- * Additional default GUIs are added to the Mapbender database.
- * After installing Mapbender a set of worldwide WMS are already contained in several GUIs.
- * Copy a GUI copyGUI / rename a GUI RenameGUI.
- * AddWMS Add a new web map service dynamically by entering the URL to an OGC WMS Capabilities document. Current extent, layers and settings are not affected.
- * Add WMS from list Dynamically add WMS from a list of all OGC WMS contained in the Mapbender database to the current GUI.
- * Add WMS from filtered list Dynamically add WMS from a list (filtered by group or gui) to a GUI.
- * setBackground Define several WMS to be displayed in the background.
- * setBackground_all You can define one or more WMS to be displayed in the background.
- * DeleteGUI Delete a selected GUI.
- * DeleteWMS Delete a selected WMS.
- * Edit GUI Elements - added: GUI description editable.
- * Edit GUI WMS - added: show WMS ID.
- * showCoords_div - shows the coordinate below the target (i.e. mapframe1).
- * setScaleHint - set scale hints for mapframes.
- * tabs_vertical - handle iframes with vertical tabs.
- * WMS_preferences - edit service settings of the loaded WMS, change order, remove wms, change settings.
-
-
-deutsch
-
- * Print Ab der Mapbender Version 2.1.0 erfolgt der Standardausdruck von Mapbender als PDF. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat. Der Kartenspiegel kann dabei über eine Konfigurationsdatei an das eigene Design angepaßt werden. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat.
-
- * GUIOwner Der neue Parameter <owner> (Besitzer) wurde der Benutzerverwaltung hinzugefügt. Dies erlaubt eine Unterscheidung zwischen lesen/benutzen einer GUI und der Berechtigung die GUI zu ändern ( edit GUI elements). Dieses Feature ist notwendig als Vorbereitung Mapbender als Portal mit anonymem Zugang einzusetzen, was wiederum notwendig ist, um Wikimap-Funktionalität zu implementieren. Zusätzlich ermöglicht diese Einstellung den Aufbau einer hierarchischen Verwaltung.
- * Overview Die Übersichtskarte sollte mit dem Modul Overview adressiert werden (<Overview0>, <Overview1>, <Overview2>, ... wurden eingestellt). Das Modul kann mit dem Feld "wms" parametriert werden. Es beinhaltet den Index des WMS, der nicht in der Übersichtskarte angezeigt werden sollte (beginnend bei 0).
- * showCoords_div Bei Aktivierung dieses Buttons werden die Koordinaten der Mausposition unter dem Ziel (target = z.B. mapframe1) angezeigt.
- * Detaillierte Metadatainformationen für eine GUI. Ebenso Information über die letzte Anfrage als Link.
- * Zusätzliche Standard-GUIs wurden der Mapbender Datenbank hinzugefügt.
- * Nach der Installation von Mapbender ist bereits ein Set von weltweiten WMSen in verschiedenen GUIs enthalten.
- * Kopieren einer GUI copyGUI / Umbenennen einer GUI RenameGUI.
- * AddWMS Dynamisches Hinzufügen eines neuen Web Map Services durch die Eingabe der URL in ein OGC WMS Capabilities Dokument. Der aktuelle Ausschnitt, Layer und Einstellungen sind davon nicht betroffen.
- * Add WMS from list Dynamisches Hinzufügen eines WMS von einer Liste von allen OGC WMS, die in der Mapbender Datenbank enthalten sind für die aktuelle GUI.
- * Add WMS from filtered list Dynamisches Hinzufügen eines WMS von einer Liste (gefiltert für eine Gruppe oder GUI) für eine GUI .
- * setBackground Definiert einige WMS, die im Hintergrund angezeigt werden.
- * setBackground_all Definieren Sie hier einen oder mehrere WMS, die im Hintergrund angezeigt werden.
- * DeleteGUI Löschen einer ausgewählten GUI.
- * DeleteWMS Löschen eines ausgewählten WMS.
- * Oberflächenelemente editieren (Edit GUI Elements) - Hinzugefügt: GUI Beschreibung editierbar.
- * WMS GUI Einstellungen (Edit GUI WMS/ WMS GUI settings) - Hinzugefügt: Anzeige der WMS ID.
- * showCoords_div - Anzeige der Koordinaten unter dem Ziel (target, z.B. mapframe1).
- * setScaleHint - Setzen eines Maßstabes für Kartenframes.
- * tabs_vertical - Handhaben von Iframes mit vertikal Karteireitern.
- * WMS_preferences - Bearbeiten der Einstellungen eines Dienstes eines geladenen WMS, Änderung der Reihenfolge, Entfernen eines WMS, Änderung der Einstellungen.
\ No newline at end of file
Copied: branches/google_dev/trunk/Changes.txt (from rev 3782, trunk/mapbender/Changes.txt)
===================================================================
--- branches/google_dev/trunk/Changes.txt (rev 0)
+++ branches/google_dev/trunk/Changes.txt 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,52 @@
+The following Link gives a review on the changes in Mapbender you can get in the WIKI
+
+http://www.mapbender.org/index.php/Version_History
+
+Also have a look in the trac for detailed informations:
+http://trac.osgeo.org/mapbender/query?status=closed&milestone=2.5.1+release
+
+Changelog 2.6
+
+see
+
+http://trac.osgeo.org/mapbender/query?status=closed&group=type&milestone=2.6+release&order=priority
+
+
+
+------------------------
+Changelog 2.5.1
+
+374 WFS tables column size is too small
+380 missing trsid in data SQL
+28 "change personal settings" cannot be de-activated
+341 add email field to forgotten password dialogue
+364 Overview is not displayed correctly after Load WMC
+64 Digitize Problem with 3 buttons (Stützpunkte) caused by z-index
+304 Cannot load WMS with empty style name
+310 Mapbender.po files contain errors
+311 wrong Sonderzeichen (Encoding) in update_guis_2.4.5_to_2.5_pgsql_UTF-8.sql
+312 i18n Translation does not work on all server class_locale.php
+317 Layer with named styles: gui_layer_style set to null
+320 treeConfGDE does not work, iframe is empty
+321 Faulty character encoding when loading WMC
+326 mapbender_setup.php - set php Version to => 5.2.0
+328 Rechtswert/Hochwert mix up in print
+329 WFS spatial request: Duplicate search results
+330 Spatial Request fails if layer not querylayer
+331 activate element setBBOX in gui (it is needed for modul meeting point)
+333 mod_exportMapImage: class_stripRequest.php => function missing
+349 Add Dokumentation_mapbender25_de.pdf to folder documents
+353 treeGDE2 - element_var switchwms=false shows NULL
+358 treeConfGDE: mb_mapObj[ind] is not defined
+359 missing and incorrect locales in class_locale.php
+361 PHP Warning: missing parameter 4 for class_bbox, class_point
+362 DB connection for sld-editor in file sld_function_getusersld.php
+373 featureTypeArray is not defined
+378 Missing line break in map.php causes JS bugs
+295 Change personal settings
+309 After zoom to digitized geometry, highlight is not updated
+325 Layer style without name: cannot display legend icon
+332 element_var and line-break leads to errors
+346 mod_editGuiWms.php - getCapabilities Request Link
+356 "update" and "delete" button after a digitize error
+313 'ZoomFull' has CloseTag img
\ No newline at end of file
Deleted: branches/google_dev/trunk/Install.txt
===================================================================
--- trunk/mapbender/Install.txt 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/Install.txt 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,97 +0,0 @@
-Read the description in the Mapbender Wiki
-
-http://www.mapbender.org/index.php/Installation
-
-Every Mapbender User is invited to let the Mapbender Wiki grow.
-If you want an account to edit any of these Wiki pages please write an email to info at mapbender.org and request for an ID and password.
-You need a valid email address to be able to edit this Wiki.
-
-
-----
--- 1. Database:
-----
-
---
--- MySQL --
---
-
--- Create a Database:
--- select the encoding to run your databse: UTF8 or Latin is possible (choose in the mapbender.conf)
--- To Show the possible character sets:
-SHOW CHARACTER SET;
-SHOW COLLATION;
-SHOW databases;
-
-
--- database with utf8 encoding
-CREATE DATABASE mapbender CHARACTER SET utf8 COLLATE utf8_general_ci ;
-
-
--- database with ISO-8859-1 encoding
-CREATE DATABASE mapbender CHARACTER SET latin1 COLLATE latin1_german1_ci ;
-
-
--- select the database mapbender
-use mapbender
-
--- special: update the mb_user_password to md5 for an existing Mapbender installation that used password()-encryption
-in the file mapbender/frames/login.php there is a variable $setEncPw.
-Set $setEncPw = true to transform the password to md5 when the user logged in with the right password.
-This helps you to transform the passwords step by step from password() to md5().
-
-
-
---If you want to run Mapbender with MySQL load the following files:
-1. mysql_schema.sql (creates tables, keys, constraints)
-2. mysql_data.sql (loads data)
-
--- run the scripts as follow:
-source mysql_schema.sql
-source mysql_data.sql (make sure, that you use the right sql for the right encoding)
-
-
---
--- PostgreSQL --
---
-
--- Create a Database with Latin1 or UTF8 encoding
-CREATE DATABASE mapbender ENCODING = 'UTF8';
-
-or
-
-CREATE DATABASE mapbender ENCODING = 'LATIN1';
-
-
-If you want to run Mapbender with PostgreSQL load the following files:
-1. pgsql_schema.sql (creates tables, keys, constraints)
-2. pgsql_data.sql (loads data)
-3. pgsql_serial_set_sequences_7x.sql or pgsql_serial_set_sequences.sql
-(depending on wich postgresql version you use, sets the values for the sequences)
-- Zaehlerstand der Sequenz fuer Serial-Felder (Autowerte)
-
-
--- How to load the sqls in PostgreSQL:
-psql -f pgsql_schema.sql <dbname>
-psql -f pgsql_data.sql <dbname>
-psql -f pgsql_serial_set_sequences.sql <dbname>
-
-
-
-----
--- 2. mapbender configuration
-----
-configure the file mapbender.conf
-
--- check the database connection
-http://localhost/tools/mapbender_setup.php
-
-----
--- 3. print configuration
-----
-
-to use the pdfprint configure the files:
-
-mapbender\http\print\printPDF.conf (if you use the print in an iframe)
-
-mapbender\http\print\printPDF_b.conf (if you use the print with a button - b for button)
-
Copied: branches/google_dev/trunk/Install.txt (from rev 3782, trunk/mapbender/Install.txt)
===================================================================
--- branches/google_dev/trunk/Install.txt (rev 0)
+++ branches/google_dev/trunk/Install.txt 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,318 @@
+Read the description in the Mapbender Wiki
+
+http://www.mapbender.org/index.php/Installation
+
+To update a running Mapbender Installation have a look at: http://www.mapbender.org/Update_Mapbender
+
+
+Every Mapbender User is invited to let the Mapbender Wiki grow.
+If you want an account to edit any of these Wiki pages please write an email to info at mapbender.org and request for an ID and password.
+You need a valid email address to be able to edit this Wiki.
+
+----
+-- Prerequisite
+----
+To be able to install and operate your own copy of Mapbender you need:
+ * Webserver (Apache, MS IIS)
+ * an installation of PHP (scripting language, version > 5.1.x)
+ * Database (PostgreSQL >7.3 or MySQL > 4k)
+The following instructions only describe the configuration process for these packages, please follow the installation instructions for your operating system individually as the paths to files will vary on your systems.
+
+----
+-- 1. Download of the package
+----
+Download the newest Mapbender OSGeo installation package.
+For further details see Download Mapbender.
+Extracting the package
+Mapbender consists of multiple PHP-files in different directories which can be downloaded in one ZIP-file. To extract the ZIP-file you will need archiving software like unzip (commandline) or FileZip (Windows).
+
+Directories
+After downloading and unpacking Mapbender you find the following directories:
+ * conf - directory for the configuration file mapbender.conf
+ * core
+ * documents
+ * http - directory for the application. Within this directory the modules are sorted by type in subdirectories. Some modules are pure JavaScript applications, even though they have .php as suffix.
+ * lib
+ * license - license information files
+ * log - logfiles will be saved here
+ * owsproxy
+ * resource - directory for the SQL-Dump to build up the Mapbender database or update the database; also contains translation files
+
+----
+-- 2. Internationalisation
+----
+* Set USE_I18N to true in mapbender.conf.
+ define("USE_I18N", true);
+* Define default language
+ define("LANGUAGE", "en"); // "en", "de", "bg", "gr", "nl", "it", es"
+* Compile the .po files into .mo files via msgfmt, see http://www.mapbender.org/gettext.
+ msgfmt resources/locale/bg_BG/LC_MESSAGES/Mapbender.po -o resources/locale/bg_BG/LC_MESSAGES/Mapbender.mo
+ msgfmt resources/locale/de_DE/LC_MESSAGES/Mapbender.po -o resources/locale/de_DE/LC_MESSAGES/Mapbender.mo
+ msgfmt resources/locale/fr_FR/LC_MESSAGES/Mapbender.po -o resources/locale/fr_FR/LC_MESSAGES/Mapbender.mo
+ msgfmt resources/locale/el_GR/LC_MESSAGES/Mapbender.po -o resources/locale/el_GR/LC_MESSAGES/Mapbender.mo
+ msgfmt resources/locale/it_IT/LC_MESSAGES/Mapbender.po -o resources/locale/it_IT/LC_MESSAGES/Mapbender.mo
+
+
+----
+-- 3. Apache virtual directory
+----
+After installation create a virtual directory. Edit /etc/apache/httpd.conf (path varies, for apache2 /etc/apache2/sites-available/default):
+
+ Alias /mapbender /path/to/mapbender2/http/
+
+ <Directory /path/to/mapbender2/http>
+ Options MultiViews
+ DirectoryIndex index.php
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+For example using Ubuntu edit: /etc/apache2/sites-available/default
+
+ Alias /mapbender /var/www/apache2-default/mapbender_2.4.3/http/
+
+ <Directory /var/www/apache2-default/mapbender_2.4.3/http>
+ Options MultiViews
+ DirectoryIndex index.php
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+You must reload (or stop and restart) the Apache program after making changes to the configuration file to make them take effect. If you want to enable directory browsing, e.g. for debugging purposes add Indexes to the Options line.
+
+----
+-- 4. Apache output compression
+----
+For optimal performance, enable output compression of your web server. Here's an instruction for Apache (see http://httpd.apache.org/docs/2.0/mod/mod_deflate.html for more details). Just append the content in bold to your Directory settings
+
+ <Directory /var/www/apache2-default/mapbender_2.4.3/http>
+ Options Indexes MultiViews FollowSymLinks
+ AllowOverride None
+ Order deny,allow
+ Deny from all
+ Allow from 127.0.0.0/255.0.0.0 ::1/128
+
+ # Insert filter
+ SetOutputFilter DEFLATE
+
+ # Netscape 4.x has some problems...
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+
+ # Netscape 4.06-4.08 have some more problems
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+
+ # MSIE masquerades as Netscape, but it is fine
+ # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
+ # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
+ # the above regex won't work. You can use the following
+ # workaround to get the desired effect:
+ BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
+
+ # Don't compress images
+ SetEnvIfNoCase Request_URI \
+ \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+ # Make sure proxies don't deliver the wrong content
+ Header append Vary User-Agent env=!dont-vary
+ </Directory>
+
+Make sure you have loaded the required modules (for example, Ubuntu and Apache2)
+* a2enmod deflate
+* a2enmod headers
+
+For Windows and Apache2, you have to activate the modules at httpd.conf.
+* LoadModule deflate_module modules/mod_deflate.so
+* LoadModule headers_module modules/mod_headers.so
+
+Mapbender will load almost twice as fast!
+
+----
+-- 5. PHP Configuration
+----
+You might have to make some adjustments to the file php.ini. Changes in the php.ini also become operative only after restarting the Apache web server !
+
+1. During the test and installation phase of Mapbender it can be helpful to display error messages. To see error messages displayed configure the file php.ini as follows:
+
+error_reporting = E_ALL & ~E_NOTICE
+display_errors = On
+
+2. After testing and installing, error messages should not be displayed anymore, turn this setting off again:
+
+display_errors = Off
+
+3. Check the following details in php.ini allow_url_fopen parameter:
+extension_dir = (path to extensions-directory)
+allow_url_fopen = On
+
+4. Mapbender manages access authorization in SESSIONS. Check the following details:
+session.save_handler = files
+session.save_path = (Path to SESSIONS-Directory). (Check authorisation!)
+
+
+5. Further details of session management should be customized according to server load (see 'garbage collection' in php.ini)
+
+6. With regard to other modules the extension gd2 should be included in the installation and configuration process.
+extension=php_gd2.dll (Windows)
+extension=gd.so (Linux)
+
+On a Debian-System you find this lib in /usr/lib/libgd.so. If it is not installed zou can do that using the command (or use Synaptic Packet Manager or similar):
+# apt.get install lbgd2-dev
+
+7. For some Mapbender modules access to a PostgreSQL database is required. If these modules should be used, you have to check the availability of the required extension in the php.ini file:
+extension=php_pgsql.dll (Windows)
+extension=pgsql.so (Linux)
+
+8. from Mapbender 2.5 on we need gettext and mbstring
+extension=php_gettext.dll (Windows)
+extension=php_mbstring.dll (Windows)
+
+Furthermore check, whether the database information in ./conf/mapbender.conf is correct.
+
+
+----
+-- 6. Database:
+----
+
+(NOTE: If want to save time, use the new shell script at
+
+resources/db/install.sh
+
+BEWARE! THIS SHELL SCRIPT IS NOT STABLE! USE AT YOUR OWN RISK!)
+
+--
+-- MySQL --
+--
+
+-- Create a Database:
+-- select the encoding to run your databse: UTF8 or Latin is possible (choose in the mapbender.conf)
+-- To Show the possible character sets:
+SHOW CHARACTER SET;
+SHOW COLLATION;
+SHOW databases;
+
+
+-- database with utf8 encoding
+CREATE DATABASE mapbender CHARACTER SET utf8 COLLATE utf8_general_ci ;
+
+
+-- database with ISO-8859-1 encoding
+CREATE DATABASE mapbender CHARACTER SET latin1 COLLATE latin1_german1_ci ;
+
+
+-- select the database mapbender
+use mapbender
+
+-- special: update the mb_user_password to md5 for an existing Mapbender installation that used password()-encryption
+in the file mapbender/frames/login.php there is a variable $setEncPw.
+Set $setEncPw = true to transform the password to md5 when the user logged in with the right password.
+This helps you to transform the passwords step by step from password() to md5().
+
+
+
+--If you want to run Mapbender with MySQL load the following files:
+1. mysql_schema_<version>.sql (creates tables, keys, constraints)
+2. mysql_data_<version>.sql (loads data)
+
+-- run the scripts as follow:
+source mysql_schema_<version>.sql
+source mysql_data_<version>.sql (make sure, that you use the right sql for the right encoding)
+
+-- Load the update SQL to update from 2.5 to 2.6
+source update/update_2.5_to_2.5.1rc1_<dbtype>_<charset>.sql
+source update/update_2.5.1rc1_to_2.5.1_<dbtype>_<charset>.sql
+source update/update_2.5.1_to_2.6rc1_<dbtype>_<charset>.sql
+
+
+--
+-- PostgreSQL --
+--
+
+-- Create a Database with Latin1 or UTF8 encoding
+CREATE DATABASE mapbender ENCODING = 'UTF8';
+
+or
+
+CREATE DATABASE mapbender ENCODING = 'LATIN1';
+
+
+If you want to run Mapbender with PostgreSQL load the following files:
+1. pgsql_schema_<version>.sql (creates tables, keys, constraints)
+2. pgsql_data_<version>.sql (loads data)
+3. pgsql_serial_set_sequences_7x_<version>.sql or pgsql_serial_set_sequences_<version>.sql
+(depending on wich postgresql version you use, sets the values for the sequences)
+- Zaehlerstand der Sequenz fuer Serial-Felder (Autowerte)
+
+
+-- How to load the sqls in PostgreSQL:
+psql -f pgsql_schema_<version>.sql <dbname>
+psql -f pgsql_data_<version>.sql <dbname>
+psql -f pgsql_serial_set_sequences_<version>.sql <dbname>
+
+
+-- Load the update SQL to update from 2.5 to 2.6
+psql -f update/update_2.5_to_2.5.1rc1_<dbtype>_<charset>.sql
+psql -f update/update_2.5.1rc1_to_2.5.1_<dbtype>_<charset>.sql
+psql -f update/update_2.5.1_to_2.6rc1_<dbtype>_<charset>.sql
+
+----
+-- 7. mapbender configuration
+----
+The Mapbender Configuration File is found in the directory "conf".
+Here you find the file mapbender.conf-dist. Rename the file to mapbender.conf.
+You won't loose your configuration at the next update of Mapbender.
+
+-- check the database connection
+http://localhost/tools/mapbender_setup.php
+
+
+----
+-- 8. print configuration
+----
+to use the pdfprint configure the files:
+mapbender\http\print\printPDF.conf (if you use the print in an iframe)
+mapbender\http\print\printPDF_b.conf (if you use the print with a button - b for button)
+In Linux : change the permission of tmp folder to 777
+$ chmod -R 777 log
+
+
+----
+-- 9. Change the Permission of log Folder
+----
+In Linux : change the permission of log folder to 777 so that php script can write logs in it.
+$ chmod -R 777 log
+
+
+---
+-- 10. Checking the Setup
+---
+The script moved to tools directory:
+http://localhost/mapbender/tools/mapbender_setup.php
+
+mapbender_setup.php tests the data connections. If you use PostgreSQL it checks if PostGIS and MD5 are available.
+
+Further more you have to check the settings in pg_hba.conf (e.g. you have to set ident sameUser to trust).
+
+After the installation - first Login
+For login you can use the user account with username root and the inital password root. Make sure to change this password asap in order to secure your Mapbender installation.
+
+
+---
+-- 11. OWSPROXY
+---
+Create an ALIAS for owsproxy:
+
+Alias /owsproxy/ "/data/mapbender/owsproxy/"
+ <Directory /data/mapbender/owsproxy/>
+ AllowOverride None
+ Order Deny,Allow
+ Allow from all
+ </Directory>
+
+URL to owsproxy (no terminating slash)
+ define("OWSPROXY", "http://<ip or name>/owsproxy");
+
+Apache configuration:
+ RedirectMatch ^.*owsproxy.([^i][\w\d]+)\/([\w\d]+)\/?$ http://<name or ip>/owsproxy/http/index.php?sid=$1\&wms=$2\&
+
+Replace <name or ip> with the owsproxy URL.
Deleted: branches/google_dev/trunk/conf/digitize_default.conf
===================================================================
--- trunk/mapbender/conf/digitize_default.conf 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/conf/digitize_default.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,62 +0,0 @@
-// * List of buttons for digitizing within the tabulator 'Digitize'.
-// * Set the first 1 in row to 0 to disable digitizing for a certain
-// kind of digitizing (e.g. point, line, or polygon)
-// * Do not change the ID (first entry)!!
-
-addButtonDig("Point", 1, "point_off.png", "", "", 0, 0);
-addButtonDig("Line", 1, "line_off.png", "", "", 28, 0);
-addButtonDig("Polygon", 1, "polygon_off.png", "", "", 56, 0);
-addButtonDig("dragBasePoint", 1, "move_node_off.png", "", "", 84, 0);
-addButtonDig("setBasePoint", 1, "new_node_off.png", "", "", 112, 0);
-addButtonDig("delBasePoint", 1, "delete_node_off.png", "", "", 140, 0);
-addButtonDig("clear", 1, "del_off.png", "", "", 168, 0);
-addButtonDig("digitizeSplit", 1, "splitPolygon_off.png", "", "", 0, 28);
-addButtonDig("digitizeDifference", 1, "punchPolygon_off.png", "", "", 28, 28);
-addButtonDig("digitizeMerge", 1, "mergePolygons_off.png", "", "", 56, 28);
-
-//definition of directory of digitize buttons
-buttonDig_imgdir = "../img/button_digitize/";
-
-var buttonDig_wfs_src = "geomInfo.png";
-var buttonDig_remove_src = "geomRemove.png";
-var buttonDig_removeDb_src = "geomRemoveDb.png";
-
-var dotDistance = 7;
-var linepointColor = "#ffff00";
-var mod_digitize_elName = "digitize";
-var snappingColor = "#ff0000";
-var snappingTolerance = 12;
-
-var snappingHighlightZIndex = 120;
-var digitizeTransactionalZIndex = 80;
-var digitizeNonTransactionalZIndex = 20;
-// see also "generalHighlightZIndex" in wfs_default.conf
-
-//
-// measuring
-//
-var measureTagName = "dependentDiv";
-var measureTagTarget = "";
-
-//style is ignored when tag already exists
-var measureTagStyle = {
- position:"absolute",
- top:"530px",
- left:"250px",
- width:"5000px",
- height:"30px",
- zIndex:"1"
-};
-var measureNumberOfDigits = 3;
-
-var showSaveButtonForExistingGeometries = false;
-
-var nonTransactionalEditable = false;
-var nonTransactionalColor = "#ff66cc";
-var nonTransactionalLineWidth = 2;
-
-var wfsWindowWidth = 400;
-var wfsWindowHeight = 300;
-
-// deprecated! check wfs_default.conf to configure this behaviour
-//var spatialRequestResultToDigitize = 1;
\ No newline at end of file
Copied: branches/google_dev/trunk/conf/digitize_default.conf (from rev 3972, trunk/mapbender/conf/digitize_default.conf)
===================================================================
--- branches/google_dev/trunk/conf/digitize_default.conf (rev 0)
+++ branches/google_dev/trunk/conf/digitize_default.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,67 @@
+// * List of buttons for digitizing within the tabulator 'Digitize'.
+// * Set the first 1 in row to 0 to disable digitizing for a certain
+// kind of digitizing (e.g. point, line, or polygon)
+// * Do not change the ID (first entry)!!
+
+addButtonDig("Point", 1, "point_off.png", "", "", 0, 0);
+addButtonDig("Line", 1, "line_off.png", "", "", 28, 0);
+addButtonDig("Polygon", 1, "polygon_off.png", "", "", 56, 0);
+addButtonDig("dragBasePoint", 1, "move_node_off.png", "", "", 84, 0);
+addButtonDig("setBasePoint", 1, "new_node_off.png", "", "", 112, 0);
+addButtonDig("delBasePoint", 1, "delete_node_off.png", "", "", 140, 0);
+addButtonDig("clear", 1, "del_off.png", "", "", 168, 0);
+addButtonDig("digitizeSplit", 1, "splitPolygon_off.png", "", "", 0, 28);
+addButtonDig("digitizeDifference", 1, "punchPolygon_off.png", "", "", 28, 28);
+addButtonDig("digitizeMerge", 1, "mergePolygons_off.png", "", "", 56, 28);
+
+//definition of directory of digitize buttons
+buttonDig_imgdir = "../img/button_digitize/";
+
+var buttonDig_wfs_src = "geomInfo.png";
+var buttonDig_remove_src = "geomRemove.png";
+var buttonDig_removeDb_src = "geomRemoveDb.png";
+var buttonDig_clone_src = "geomClone.png";
+
+var dotDistance = 7;
+var linepointColor = "#ffff00";
+var mod_digitize_elName = "digitize";
+var snappingColor = "#ff0000";
+var snappingTolerance = 12;
+
+var geomHighlightColour = "#ff0000";
+
+var snappingHighlightZIndex = 120;
+var digitizeTransactionalZIndex = 80;
+var digitizeNonTransactionalZIndex = 20;
+// see also "generalHighlightZIndex" in wfs_default.conf
+
+//
+// measuring
+//
+var measureTagName = "dependentDiv";
+var measureTagTarget = "";
+
+//style is ignored when tag already exists
+var measureTagStyle = {
+ position:"absolute",
+ top:"530px",
+ left:"250px",
+ width:"5000px",
+ height:"30px",
+ zIndex:"1"
+};
+var measureNumberOfDigits = 3;
+
+var showSaveButtonForExistingGeometries = false;
+
+var nonTransactionalEditable = false;
+var nonTransactionalColor = "#ff66cc";
+var nonTransactionalLineWidth = 2;
+
+var addCloneGeometryButton = false;
+
+var wfsWindowWidth = 400;
+var wfsWindowHeight = 300;
+
+// deprecated! check wfs_default.conf to configure this behaviour
+//var spatialRequestResultToDigitize = 1;
\ No newline at end of file
Modified: branches/google_dev/trunk/conf/session.conf
===================================================================
--- trunk/mapbender/conf/session.conf 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/conf/session.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -2,7 +2,8 @@
$_SESSION["mb_user_password"] = $password;
$_SESSION["mb_user_id"] = $row["mb_user_id"];
$_SESSION["mb_user_name"] = $name;
-$_SESSION["mb_user_ip"] = $_SERVER['REMOTE_ADDR'];
+$_SESSION["mb_user_ip"] = getRealIpAddr();
+//$_SESSION["mb_user_ip"] = $_SERVER['REMOTE_ADDR'];
$_SESSION["mb_myBBOX"] = $_REQUEST["mb_myBBOX"];
$_SESSION["mb_myKml"] = $_REQUEST["kml_id"];
$_SESSION["mb_myPOI"] = $_REQUEST["mb_myPOI"];
Deleted: branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf
===================================================================
--- trunk/mapbender/conf/wfs_additional_spatial_search.conf 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,41 +0,0 @@
-/**
- * definition of buttons for spatialRequest
- *
- * [@param {integer} status show this button (value is 1 or 0)
- * [@param {string} img image for the button
- * [@param {string} title for the button
- * [@param {string} filteroption type of filter for search (values: "intersects" or "within"), used for buttons buttonRectangle and buttonPolygon
- */
-
-var buttonRectangle = {"status":1,"img":"select_rectangle_off.png","title":"select by rectangle","filteroption":"intersects"};
-var buttonPolygon = {"status":1,"img":"select_polygon_off.png","title":"select by polygon","filteroption":"intersects"};
-var buttonPoint = {"status":1, "img":"select_point_off.png","title":"select by point"};
-var buttonExtent = {"status":1,"img":"select_extent_off.png","title":"select by extent"};
-
-var mb_wfs_tolerance = 8;
-
-var spatialRequestIsSetMessage = "Spatial filter is set.";
-var clearFilterButtonLabel = "New";
-
-var noResultMsg = "No result";
-
-var buttonWfs_imgdir = "../img/button_gray/";
-var buttonWfs_zIndex = 10;
-
-var generalHighlightZIndex = 90;
-var generalHighlightLineWidth = 2;
-
-var wfsResultModulePath = "php/";
-var wfsResultModuleFilename = "mod_wfs_result.php";
-
-var searchPopupTitle = "Search results";
-var searchPopupWidth = 400;
-var searchPopupHeight =250;
-var searchPopupX = 750;
-var searchPopupY = 80;
-
-var detailPopupTitle = "Details";
-var detailPopupWidth = 400;
-var detailPopupHeight = 200;
-var detailPopupX = 750;
-var detailPopupY = 410;
Copied: branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf (from rev 3726, trunk/mapbender/conf/wfs_additional_spatial_search.conf)
===================================================================
--- branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf (rev 0)
+++ branches/google_dev/trunk/conf/wfs_additional_spatial_search.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,41 @@
+/**
+ * definition of buttons for spatialRequest
+ *
+ * [@param {integer} status show this button (value is 1 or 0)
+ * [@param {string} img image for the button
+ * [@param {string} title for the button
+ * [@param {string} filteroption type of filter for search (values: "intersects" or "within"), used for buttons buttonRectangle and buttonPolygon
+ */
+
+var buttonRectangle = {"status":1,"img":"select_rectangle_off.png","title":"<?php echo _mb("select by rectangle");?>","filteroption":"intersects"};
+var buttonPolygon = {"status":1,"img":"select_polygon_off.png","title":"<?php echo _mb("select by polygon");?>","filteroption":"intersects"};
+var buttonPoint = {"status":1, "img":"select_point_off.png","title":"<?php echo _mb("select by point");?>"};
+var buttonExtent = {"status":1,"img":"select_extent_off.png","title":"<?php echo _mb("select by extent");?>"};
+
+var mb_wfs_tolerance = 8;
+
+var spatialRequestIsSetMessage = '<?php echo _mb("Spatial filter is set.");?>';
+var clearFilterButtonLabel = '<?php echo _mb("New");?>';
+
+var noResultMsg = '<?php _mb("No result");?>';
+
+var buttonWfs_imgdir = "../img/button_gray/";
+var buttonWfs_zIndex = 10;
+
+var generalHighlightZIndex = 90;
+var generalHighlightLineWidth = 2;
+
+var wfsResultModulePath = "php/";
+var wfsResultModuleFilename = "mod_wfs_result.php";
+
+var searchPopupTitle = '<?php echo _mb("Search results");?>';
+var searchPopupWidth = 400;
+var searchPopupHeight =250;
+var searchPopupX = 750;
+var searchPopupY = 80;
+
+var detailPopupTitle = '<?php echo _mb("Details");?>';
+var detailPopupWidth = 400;
+var detailPopupHeight = 200;
+var detailPopupX = 750;
+var detailPopupY = 410;
Deleted: branches/google_dev/trunk/conf/wfs_default.conf
===================================================================
--- trunk/mapbender/conf/wfs_default.conf 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/conf/wfs_default.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,44 +0,0 @@
-/**
- * definition of buttons for spatialRequest
- *
- * [@param {integer} status show this button (value is 1 or 0)
- * [@param {integer} x position left
- * [@param {integer} y position top
- * [@param {string} img image for the button
- * [@param {string} filteroption type of filter for search (values: "intersects" or "within"), used for buttons buttonRectangle and buttonPolygon
- */
-
-var buttonRectangle = {"status":1, "x":750, "y":10, "img":"select_rectangle_off.png","filteroption":"intersects"};
-var buttonPolygon = {"status":1, "x":780, "y":10, "img":"select_polygon_off.png","filteroption":"intersects"};
-var buttonPoint = {"status":1, "x":810, "y":10, "img":"select_point_off.png"};
-var buttonExtent = {"status":1, "x":840, "y":10, "img":"select_extent_off.png"};
-var buttonDialogue = {"status":1, "x":870, "y":10, "img":"select_choose_off.png"};
-
-var mb_wfs_tolerance = 8;
-
-var buttonWfs_imgdir = "../img/button_gray/";
-var buttonWfs_zIndex = 10;
-
-// if wfsResultToPopupDiv is 0, this is automatically 1
-var buttonWfs_toDigitize_on = 1;
-var buttonWfs_toDigitize_target = "digitize";
-var buttonWfs_toDigitize_src = "../img/pencil.png";
-
-var generalHighlightZIndex = 90;
-var generalHighlightLineWidth = 2;
-
-var wfsResultModulePath = "php/";
-var wfsResultModuleFilename = "mod_wfs_result.php";
-
-var wfsResultToPopupDiv = 0;
-var searchPopupTitle = "Search results";
-var searchPopupWidth = 300;
-var searchPopupHeight =250;
-var searchPopupX = 800;
-var searchPopupY = 100;
-
-var detailPopupTitle = "Details";
-var detailPopupWidth = 300;
-var detailPopupHeight = 250;
-var detailPopupX = 800;
-var detailPopupY = 400;
\ No newline at end of file
Copied: branches/google_dev/trunk/conf/wfs_default.conf (from rev 3895, trunk/mapbender/conf/wfs_default.conf)
===================================================================
--- branches/google_dev/trunk/conf/wfs_default.conf (rev 0)
+++ branches/google_dev/trunk/conf/wfs_default.conf 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,155 @@
+// --------------------------------------------------------
+//
+// Settings of spatial request buttons
+//
+// --------------------------------------------------------
+
+/**
+ * definition of buttons for spatialRequest
+ *
+ * [@param {integer} status show this button (value is 1 or 0)
+ * [@param {integer} x position left
+ * [@param {integer} y position top
+ * [@param {string} img image for the button
+ * [@param {string} filteroption type of filter for search (values: "intersects" or "within"), used for buttons buttonRectangle and buttonPolygon
+ */
+var buttonRectangle = {"status":1, "x":750, "y":10, "img":"select_rectangle_off.png","filteroption":"intersects"};
+var buttonPolygon = {"status":1, "x":780, "y":10, "img":"select_polygon_off.png","filteroption":"intersects"};
+var buttonPoint = {"status":1, "x":810, "y":10, "img":"select_point_off.png"};
+var buttonExtent = {"status":1, "x":840, "y":10, "img":"select_extent_off.png"};
+var buttonDialogue = {"status":1, "x":870, "y":10, "img":"select_choose_off.png"};
+
+/**
+ * directory that contains the buttons mentioned above
+ */
+var buttonWfs_imgdir = "../img/button_gray/";
+
+/**
+ * z-Index of the buttons mentioned above
+ */
+var buttonWfs_zIndex = 10;
+
+
+// --------------------------------------------------------
+//
+// General WFS request settings
+//
+// --------------------------------------------------------
+
+/**
+ * This is the buffer around query points for spatial requests (in pixel)
+ */
+var mb_wfs_tolerance = 8;
+
+/**
+ * if features found via WFS request do not match
+ * the current client SRS, a warning with a
+ * confirmation prompt is displayed. Useful
+ * in applications with switchEPSG
+ */
+var displaySrsWarning = false;
+
+/**
+ * Path to the server-side module that performs the WFS request
+ */
+var wfsResultModulePath = "php/";
+
+/**
+ * File name of the server-side module that performs the WFS request
+ */
+var wfsResultModuleFilename = "mod_wfs_result.php";
+
+
+// --------------------------------------------------------
+//
+// Result geometry highlight settings
+//
+// --------------------------------------------------------
+
+/**
+ * z-Index of the highlighted geometries
+ */
+var generalHighlightZIndex = 90;
+
+/**
+ * Line width of the highlighted geometries in pixel
+ */
+var generalHighlightLineWidth = 2;
+
+/**
+ * Colour of the highlighted geometries in RGB,
+ * f.e. "#FF0000" for red.
+ */
+var resultHighlightColour = "#FF0000";
+
+
+
+// --------------------------------------------------------
+//
+// Setting for an optional popup div that contains the
+// result geometries from the request
+//
+// --------------------------------------------------------
+
+/**
+ * Displays a popup div that contains the result geometries.
+ * If you want to add a button that exports these geometries
+ * to the digitizing tool, also set the variable "buttonWfs_toDigitize_on"
+ */
+var wfsResultToPopupDiv = 1;
+
+/**
+ * This setting depends on wfsResultToPopupDiv:
+ * if wfsResultToPopupDiv is 1, this setting determines whether
+ * a button appears within the div, that allows to export the
+ * geometries to the digitizing tool.
+ * if wfsResultToPopupDiv is 0, this is setting is ignored,
+ * and geometries will be automatically exported to
+ * the digitizing tool
+ */
+var buttonWfs_toDigitize_on = 1;
+
+/**
+ * Element ID of the digitizing tool
+ */
+var buttonWfs_toDigitize_target = "digitize";
+
+/**
+ * Path and file name of the button, that exports the
+ * geometries to the digitizing tool
+ */
+var buttonWfs_toDigitize_src = "../img/pencil.png";
+
+/**
+ * Title of the result popup
+ */
+var searchPopupTitle = "Search results";
+
+/**
+ * Width and height of the result popup (in pixel)
+ */
+var searchPopupWidth = 300;
+var searchPopupHeight = 250;
+
+/**
+ * Absolute position of the result popup (in pixel)
+ */
+var searchPopupX = 800;
+var searchPopupY = 100;
+
+/**
+ * Title of the result details popup
+ */
+var detailPopupTitle = "Details";
+
+/**
+ * Width and height of the result details popup (in pixel)
+ */
+var detailPopupWidth = 300;
+var detailPopupHeight = 250;
+
+/**
+ * Absolute position of the result details popup (in pixel)
+ */
+var detailPopupX = 800;
+var detailPopupY = 400;
\ No newline at end of file
Modified: branches/google_dev/trunk/core/globalSettings.php
===================================================================
--- trunk/mapbender/core/globalSettings.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/core/globalSettings.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -16,6 +16,21 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+function getRealIpAddr() {
+ //check ip from share internet
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
+ }
+ //to check ip is pass from proxy
+ elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
+ }
+ else {
+ $ip=$_SERVER['REMOTE_ADDR'];
+ }
+ return $ip;
+}
+
//
// start the session
//
Deleted: branches/google_dev/trunk/core/system.php
===================================================================
--- trunk/mapbender/core/system.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/core/system.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,39 +0,0 @@
-<?php
-# $Id$
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#
-# mapbender version
-#
-define("MB_VERSION_NUMBER", "2.6");
-define("MB_VERSION_APPENDIX", "trunk");
-define("MB_RELEASE_DATE", mktime(0,0,0,7,22,2008));//h, min,sec,month,day,year
-
-#
-# constants from map.js
-#
-define("MB_RESOLUTION", "28.35");
-define("MB_FEATURE_COUNT", "100");
-define("MB_SECURITY_PROXY", "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=");
-#
-# available log levels
-#
-define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
-
-define("ZOOM_MOUSEWHEEL", "1.1");
-
-define("MODULES_NOT_RELYING_ON_GLOBALS", "back,forward,zoomIn1,copyright,dependentDiv,dragMapSize,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBBOX,setPOI2Scale");
Copied: branches/google_dev/trunk/core/system.php (from rev 3904, trunk/mapbender/core/system.php)
===================================================================
--- branches/google_dev/trunk/core/system.php (rev 0)
+++ branches/google_dev/trunk/core/system.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,39 @@
+<?php
+# $Id$
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#
+# mapbender version
+#
+define("MB_VERSION_NUMBER", "2.6");
+define("MB_VERSION_APPENDIX", "rc1");
+define("MB_RELEASE_DATE", mktime(0,0,0,3,17,2009));//h, min,sec,month,day,year
+
+#
+# constants from map.js
+#
+define("MB_RESOLUTION", "28.35");
+define("MB_FEATURE_COUNT", "100");
+define("MB_SECURITY_PROXY", "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=");
+#
+# available log levels
+#
+define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
+
+define("ZOOM_MOUSEWHEEL", "1.1");
+
+define("MODULES_NOT_RELYING_ON_GLOBALS", "featureInfo1,gazetteerWFS,back,forward,zoomIn1,zoomOut1,selArea1,pan1,copyright,dependentDiv,dragMapSize,dynamicOverview,FeatureInfoRedirect,highlightPOI,navFrame,sandclock,scaleBar,scaleSel,setBBOX,setPOI2Scale");
Copied: branches/google_dev/trunk/http/classes (from rev 3876, trunk/mapbender/http/classes)
Deleted: branches/google_dev/trunk/http/classes/class_gml_2_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_2_factory.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_2_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,314 +0,0 @@
-<?php
-# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
-# http://www.mapbender.org/index.php/class_wfs.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_factory.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_2.php");
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-/**
- * Creates GML 2 objects from a GML documents.
- *
- * @return Gml_2
- */
-class Gml_2_Factory extends GmlFactory {
-
- /**
- * Creates a GML object from a GeoJSON (http://www.geojson.org) String
- *
- * @return Gml_3
- * @param $geoJson String
- */
- public function createFromGeoJson ($geoJson) {
- $gml2 = new Gml_2();
-
- return parent::createFromGeoJson($geoJson, $gml2);
- }
-
- function findNameSpace($s){
- list($ns,$FeaturePropertyName) = split(":",$s);
- $nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
- return $nodeName;
- }
-
- private function parsePoint ($domNode, $gmlPoint) {
- $currentSibling = $domNode->firstChild;
- while ($currentSibling) {
- list($x, $y, $z) = explode(",", $currentSibling->nodeValue);
- $gmlPoint->setPoint($x, $y);
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
- private function parseLine ($domNode, $gmlLine) {
- $currentSibling = $domNode->firstChild;
- while ($currentSibling) {
-
- foreach(explode(' ',$currentSibling->nodeValue) as $cords){
- list($x,$y,$z) = explode(',',$cords);
- $gmlLine->addPoint($x, $y);
- }
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
- private function parsePolygon ($domNode, $gmlPolygon) {
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allCoords = $simpleXMLNode->xpath("gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
-
- $cnt=0;
- foreach ($allCoords as $Coords) {
- $coordsDom = dom_import_simplexml($Coords);
-
- foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
-
- list($x,$y,$z) = explode(',',$pointCoords);
- $gmlPolygon->addPoint($x, $y);
- }
-
- $cnt++;
- }
-
- $innerRingNodeArray = $simpleXMLNode->xpath("gml:innerBoundaryIs/gml:LinearRing");
- if ($innerRingNodeArray) {
- $ringCount = 0;
- foreach ($innerRingNodeArray as $ringNode) {
- $coordinates = $ringNode->xpath("gml:coordinates");
- foreach ($coordinates as $coordinate) {
- $coordsDom = dom_import_simplexml($coordinate);
-
- foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
-
- list($x,$y,$z) = explode(',',$pointCoords);
- $gmlPolygon->addPointToRing($ringCount, $x, $y);
- }
- }
- $ringCount++;
- }
- }
- }
-
- private function parseMultiLine ($domNode, $gmlMultiLine) {
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allCoords = $simpleXMLNode->xpath("gml:lineStringMember/gml:LineString/gml:coordinates");
-
- $cnt=0;
- foreach ($allCoords as $Coords) {
-
- $gmlMultiLine->lineArray[$cnt] = array();
-
- $coordsDom = dom_import_simplexml($Coords);
-
-// $name = $coordsDom->nodeName;
-// $value = $coordsDom->nodeValue;
-// echo "===> name: ".$name. ", Value: ".$value."<br>";
-
- foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
- list($x,$y,$z) = explode(',',$pointCoords);
- $gmlMultiLine->addPoint($x, $y, $cnt);
- }
-
- $cnt++;
- }
- }
-
- private function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
-// echo $domNode->nodeName."<br>";
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allPolygons = $simpleXMLNode->xpath("gml:polygonMember/gml:Polygon");
-
- $cnt=0;
- foreach ($allPolygons as $polygon) {
- $allCoords = $polygon->xpath("gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
-
- $gmlMultiPolygon->polygonArray[$cnt] = array();
- foreach ($allCoords as $Coords) {
-
- $coordsDom = dom_import_simplexml($Coords);
-
- foreach (explode(' ',$coordsDom->nodeValue) as $pointCoords) {
- list($x,$y,$z) = explode(',',$pointCoords);
- $gmlMultiPolygon->addPoint($x, $y, $cnt);
- }
- }
-
- $gmlMultiPolygon->innerRingArray[$cnt] = array();
- $innerRingNodeArray = $polygon->xpath("gml:innerBoundaryIs");
- if ($innerRingNodeArray) {
- $ringCount = 0;
- foreach ($innerRingNodeArray as $ringNode) {
- $currentRingNode = $ringNode->xpath("gml:LinearRing");
- foreach ($currentRingNode as $node) {
- $coordinates = $node->xpath("gml:coordinates");
- foreach ($coordinates as $coordinate) {
- $coordsDom = dom_import_simplexml($coordinate);
-
- foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
-
- list($x,$y,$z) = explode(',',$pointCoords);
- $gmlMultiPolygon->addPointToRing($cnt, $ringCount, $x, $y);
- }
- }
- $ringCount++;
-
- }
- }
- }
- $cnt++;
-// new mb_exception("create multipolygon " . serialize($gmlMultiPolygon->innerRingArray));
- }
- }
-
- /**
- * Parses the feature segment of a GML and stores the geometry in the
- * $geometry variable of the class.
- *
- * Example of a feature segment of a GML.
- * <gml:featureMember>
- * <ms:ROUTE fid="ROUTE.228168">
- * <gml:boundedBy>
- * <gml:Box srsName="EPSG:31466">
- * <gml:coordinates>2557381.0,5562371.1 2557653.7,5562526.0</gml:coordinates>
- * </gml:Box>
- * </gml:boundedBy>
- * <ms:geometry>
- * <gml:LineString>
- * <gml:coordinates>
- * 2557380.97,5562526 2557390.96,
- * 5562523.22 2557404.03,5562518.2 2557422.31,
- * 5562512 2557437.16,5562508.37 2557441.79,
- * 5562507.49 2557454.31,5562505.1 2557464.27,
- * 5562503.97 2557473.24,5562502.97 2557491.67,
- * 5562502.12 2557505.65,5562502.43 2557513.78,
- * 5562501.12 2557520.89,5562498.79 2557528.5,
- * 5562495.07 2557538.9,5562488.91 2557549.5,
- * 5562483.83 2557558.55,5562476.61 2557569.07,
- * 5562469.82 2557576.61,5562462.72 2557582.75,
- * 5562457.92 2557588.57,5562452.56 2557590.38,
- * 5562449.69 2557593.57,5562445.07 2557596.17,
- * 5562441.31 2557601.71,5562433.93 2557612.97,
- * 5562421.03 2557626,5562405.33 2557639.66,
- * 5562389.75 2557653.69,5562371.12
- * </gml:coordinates>
- * </gml:LineString>
- * </ms:geometry>
- * <code>354</code>
- * <Verkehr>0</Verkehr>
- * <rlp>t</rlp>
- * </ms:ROUTE>
- * </gml:featureMember>
- *
- * @return void
- * @param $domNode DOMNodeObject the feature tag of the GML
- * (<gml:featureMember> in the above example)
- */
- protected function parseFeature($domNode, $feature, $wfsConf) {
- $geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
-
- $currentSibling = $domNode;
-
- $feature->fid = $currentSibling->getAttribute("fid");
-
- $currentSibling = $currentSibling->firstChild;
-
- while ($currentSibling) {
-
- $name = $currentSibling->nodeName;
- $value = $currentSibling->nodeValue;
-
- $namespace = $this->findNameSpace($name);
- $ns = $namespace['ns'];
- $columnName = $namespace['value'];
- $isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
-
- // check if this node is a geometry node.
- // however, even if it is a property node,
- // it has a child node, the text node!
- // So we might need to do something more
- // sophisticated here...
- if ($currentSibling->hasChildNodes() && $isGeomColumn){
- $geomNode = $currentSibling->firstChild;
- if ($geomNode->hasAttribute("srsName")) {
- $srs = $geomNode->getAttribute("srsName");
- }
- $geomType = $geomNode->nodeName;
- switch ($geomType) {
- case "gml:Polygon" :
- $feature->geometry = new GMLPolygon();
- $feature->geometry->srs = $srs;
- $this->parsePolygon($geomNode, $feature->geometry);
- break;
- case "gml:LineString" :
- $feature->geometry = new GMLLine();
- $feature->geometry->srs = $srs;
- $this->parseLine($geomNode, $feature->geometry);
- break;
- case "gml:Point" :
- $feature->geometry = new GMLPoint();
- $feature->geometry->srs = $srs;
- $this->parsePoint($geomNode, $feature->geometry);
- break;
- case "gml:MultiLineString" :
- $feature->geometry = new GMLMultiLine();
- $feature->geometry->srs = $srs;
- $this->parseMultiLine($geomNode, $feature->geometry);
- break;
- case "gml:MultiPolygon" :
- $feature->geometry = new GMLMultiPolygon();
- $feature->geometry->srs = $srs;
- $this->parseMultiPolygon($geomNode, $feature->geometry);
- break;
- default:
- $feature->properties[$columnName] = $value;
- break;
- }
- }
- else {
- if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
- $feature->properties[$columnName] = $value;
- }
- }
-
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
-
- /**
- * Creates GML 2 objects from GML documents.
- *
- * @return Gml_2
- * @param $xml String
- */
- public function createFromXml ($xml, $wfsConf) {
- $gml2 = new Gml_2();
- return parent::createFromXml($xml, $wfsConf, $gml2);
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_2_factory.php (from rev 3891, trunk/mapbender/http/classes/class_gml_2_factory.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_2_factory.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_2_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,322 @@
+<?php
+# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
+# http://www.mapbender.org/index.php/class_wfs.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_2.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+/**
+ * Creates GML 2 objects from a GML documents.
+ *
+ * @return Gml_2
+ */
+class Gml_2_Factory extends GmlFactory {
+
+ /**
+ * Creates a GML object from a GeoJSON (http://www.geojson.org) String
+ *
+ * @return Gml_3
+ * @param $geoJson String
+ */
+ public function createFromGeoJson ($geoJson) {
+ $gml2 = new Gml_2();
+
+ return parent::createFromGeoJson($geoJson, $gml2);
+ }
+
+ function findNameSpace($s){
+ list($ns,$FeaturePropertyName) = split(":",$s);
+ $nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
+ return $nodeName;
+ }
+
+ public static function parsePoint ($domNode) {
+ $gmlPoint = new GmlPoint();
+
+ $currentSibling = $domNode->firstChild;
+ while ($currentSibling) {
+ list($x, $y, $z) = explode(",", $currentSibling->nodeValue);
+ $gmlPoint->setPoint($x, $y);
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ return $gmlPoint;
+ }
+
+ public static function parseLine ($domNode) {
+ $gmlLine = new GmlLine();
+
+ $currentSibling = $domNode->firstChild;
+ while ($currentSibling) {
+
+ foreach(explode(' ',$currentSibling->nodeValue) as $cords){
+ list($x,$y,$z) = explode(',',$cords);
+ $gmlLine->addPoint($x, $y);
+ }
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ return $gmlLine;
+ }
+
+ public static function parsePolygon ($domNode) {
+ $gmlPolygon = new GmlPolygon();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allCoords = $simpleXMLNode->xpath("gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
+
+ $cnt=0;
+ foreach ($allCoords as $Coords) {
+ $coordsDom = dom_import_simplexml($Coords);
+
+ foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
+
+ list($x,$y,$z) = explode(',',$pointCoords);
+ $gmlPolygon->addPoint($x, $y);
+ }
+
+ $cnt++;
+ }
+
+ $innerRingNodeArray = $simpleXMLNode->xpath("gml:innerBoundaryIs/gml:LinearRing");
+ if ($innerRingNodeArray) {
+ $ringCount = 0;
+ foreach ($innerRingNodeArray as $ringNode) {
+ $coordinates = $ringNode->xpath("gml:coordinates");
+ foreach ($coordinates as $coordinate) {
+ $coordsDom = dom_import_simplexml($coordinate);
+
+ foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
+
+ list($x,$y,$z) = explode(',',$pointCoords);
+ $gmlPolygon->addPointToRing($ringCount, $x, $y);
+ }
+ }
+ $ringCount++;
+ }
+ }
+ return $gmlPolygon;
+ }
+
+ public static function parseMultiLine ($domNode) {
+ $gmlMultiLine = new GmlMultiLine();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allCoords = $simpleXMLNode->xpath("gml:lineStringMember/gml:LineString/gml:coordinates");
+
+ $cnt=0;
+ foreach ($allCoords as $Coords) {
+
+ $gmlMultiLine->lineArray[$cnt] = array();
+
+ $coordsDom = dom_import_simplexml($Coords);
+
+// $name = $coordsDom->nodeName;
+// $value = $coordsDom->nodeValue;
+// echo "===> name: ".$name. ", Value: ".$value."<br>";
+
+ foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
+ list($x,$y,$z) = explode(',',$pointCoords);
+ $gmlMultiLine->addPoint($x, $y, $cnt);
+ }
+
+ $cnt++;
+ }
+ return $gmlMultiLine;
+ }
+
+ public static function parseMultiPolygon ($domNode) {
+ $gmlMultiPolygon = new GmlMultiPolygon();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allPolygons = $simpleXMLNode->xpath("gml:polygonMember/gml:Polygon");
+
+ $cnt=0;
+ foreach ($allPolygons as $polygon) {
+ $allCoords = $polygon->xpath("gml:outerBoundaryIs/gml:LinearRing/gml:coordinates");
+
+ $gmlMultiPolygon->polygonArray[$cnt] = array();
+ foreach ($allCoords as $Coords) {
+
+ $coordsDom = dom_import_simplexml($Coords);
+
+ foreach (explode(' ',$coordsDom->nodeValue) as $pointCoords) {
+ list($x,$y,$z) = explode(',',$pointCoords);
+ $gmlMultiPolygon->addPoint($x, $y, $cnt);
+ }
+ }
+
+ $gmlMultiPolygon->innerRingArray[$cnt] = array();
+ $innerRingNodeArray = $polygon->xpath("gml:innerBoundaryIs");
+ if ($innerRingNodeArray) {
+ $ringCount = 0;
+ foreach ($innerRingNodeArray as $ringNode) {
+ $currentRingNode = $ringNode->xpath("gml:LinearRing");
+ foreach ($currentRingNode as $node) {
+ $coordinates = $node->xpath("gml:coordinates");
+ foreach ($coordinates as $coordinate) {
+ $coordsDom = dom_import_simplexml($coordinate);
+
+ foreach(explode(' ',$coordsDom->nodeValue) as $pointCoords){
+
+ list($x,$y,$z) = explode(',',$pointCoords);
+ $gmlMultiPolygon->addPointToRing($cnt, $ringCount, $x, $y);
+ }
+ }
+ $ringCount++;
+
+ }
+ }
+ }
+ $cnt++;
+ }
+ return $gmlMultiPolygon;
+ }
+
+ /**
+ * Parses the feature segment of a GML and stores the geometry in the
+ * $geometry variable of the class.
+ *
+ * Example of a feature segment of a GML.
+ * <gml:featureMember>
+ * <ms:ROUTE fid="ROUTE.228168">
+ * <gml:boundedBy>
+ * <gml:Box srsName="EPSG:31466">
+ * <gml:coordinates>2557381.0,5562371.1 2557653.7,5562526.0</gml:coordinates>
+ * </gml:Box>
+ * </gml:boundedBy>
+ * <ms:geometry>
+ * <gml:LineString>
+ * <gml:coordinates>
+ * 2557380.97,5562526 2557390.96,
+ * 5562523.22 2557404.03,5562518.2 2557422.31,
+ * 5562512 2557437.16,5562508.37 2557441.79,
+ * 5562507.49 2557454.31,5562505.1 2557464.27,
+ * 5562503.97 2557473.24,5562502.97 2557491.67,
+ * 5562502.12 2557505.65,5562502.43 2557513.78,
+ * 5562501.12 2557520.89,5562498.79 2557528.5,
+ * 5562495.07 2557538.9,5562488.91 2557549.5,
+ * 5562483.83 2557558.55,5562476.61 2557569.07,
+ * 5562469.82 2557576.61,5562462.72 2557582.75,
+ * 5562457.92 2557588.57,5562452.56 2557590.38,
+ * 5562449.69 2557593.57,5562445.07 2557596.17,
+ * 5562441.31 2557601.71,5562433.93 2557612.97,
+ * 5562421.03 2557626,5562405.33 2557639.66,
+ * 5562389.75 2557653.69,5562371.12
+ * </gml:coordinates>
+ * </gml:LineString>
+ * </ms:geometry>
+ * <code>354</code>
+ * <Verkehr>0</Verkehr>
+ * <rlp>t</rlp>
+ * </ms:ROUTE>
+ * </gml:featureMember>
+ *
+ * @return void
+ * @param $domNode DOMNodeObject the feature tag of the GML
+ * (<gml:featureMember> in the above example)
+ */
+ protected function parseFeature($domNode, $feature, $wfsConf) {
+ $geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
+
+ $currentSibling = $domNode;
+
+ $feature->fid = $currentSibling->getAttribute("fid");
+
+ $currentSibling = $currentSibling->firstChild;
+
+ while ($currentSibling) {
+
+ $name = $currentSibling->nodeName;
+ $value = $currentSibling->nodeValue;
+
+ $namespace = $this->findNameSpace($name);
+ $ns = $namespace['ns'];
+ $columnName = $namespace['value'];
+ $isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
+
+ // check if this node is a geometry node.
+ // however, even if it is a property node,
+ // it has a child node, the text node!
+ // So we might need to do something more
+ // sophisticated here...
+ if ($currentSibling->hasChildNodes() && $isGeomColumn){
+ $geomNode = $currentSibling->firstChild;
+ if ($geomNode->hasAttribute("srsName")) {
+ $srs = $geomNode->getAttribute("srsName");
+ }
+ $geomType = $geomNode->nodeName;
+ switch ($geomType) {
+ case "gml:Polygon" :
+ $feature->geometry = self::parsePolygon($geomNode);
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:LineString" :
+ $feature->geometry = self::parseLine($geomNode);
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:Point" :
+ $feature->geometry = self::parsePoint($geomNode);
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:MultiLineString" :
+ $feature->geometry = self::parseMultiLine($geomNode);
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:MultiPolygon" :
+ $feature->geometry = self::parseMultiPolygon($geomNode);
+ $feature->geometry->srs = $srs;
+ break;
+ default:
+ $feature->properties[$columnName] = $value;
+ break;
+ }
+ }
+ else {
+ if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
+ $feature->properties[$columnName] = $value;
+ }
+ }
+
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ }
+
+
+ /**
+ * Creates GML 2 objects from GML documents.
+ *
+ * @return Gml_2
+ * @param $xml String
+ */
+ public function createFromXml ($xml, $wfsConf) {
+ $gml2 = new Gml_2();
+ return parent::createFromXml($xml, $wfsConf, $gml2);
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_3_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_3_factory.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_3_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,337 +0,0 @@
-<?php
-# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
-# http://www.mapbender.org/index.php/class_wfs.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_factory.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_3.php");
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-/**
- * Creates GML 3 objects from a GML documents.
- *
- * @return Gml_3
- */
-class Gml_3_Factory extends GmlFactory {
-
- /**
- * Creates a GML object from a GeoJSON (http://www.geojson.org) String
- *
- * @return Gml_3
- * @param $geoJson String
- */
- public function createFromGeoJson ($geoJson) {
- $gml3 = new Gml_3();
-
- return parent::createFromGeoJson($geoJson, $gml3);
- }
-
- /**
- * Creates GML 3 objects from GML documents.
- *
- * @return Gml_3
- * @param $xml String
- */
- public function createFromXml ($xml, $wfsConf) {
- $gml3 = new Gml_3();
- return parent::createFromXml($xml, $wfsConf, $gml3);
- }
-
- protected function getDimensionFromNode ($domNode) {
- if (!$domNode->hasAttribute("srsDimension")) {
- return 2;
- }
- $dim = intval($domNode->getAttribute("srsDimension"), 10);
- if (2 == $dim || 3 == $dim) {
- return $dim;
- }
- return 2;
- }
-
- function findNameSpace($s){
- list($ns,$FeaturePropertyName) = split(":",$s);
- $nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
- return $nodeName;
- }
-
- private function parsePoint ($domNode, $gmlPoint) {
- $currentSibling = $domNode->firstChild;
- while ($currentSibling) {
- $coordArray = explode(" ", $currentSibling->nodeValue);
- $gmlPoint->setPoint($coordArray[0], $coordArray[1]);
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
- private function parseLine ($domNode, $gmlLine) {
- $currentSibling = $domNode->firstChild;
- while ($currentSibling) {
-
- $dim = $this->getDimensionFromNode($currentSibling);
- $coordArray = explode(' ', trim($currentSibling->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlLine->addPoint($x, $y);
- }
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
- private function parsePolygon ($domNode, $gmlPolygon) {
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allCoords = $simpleXMLNode->xpath("gml:exterior/gml:LinearRing/gml:posList");
-
- $cnt=0;
- foreach ($allCoords as $Coords) {
- $coordsDom = dom_import_simplexml($Coords);
-
- $dim = $this->getDimensionFromNode($coordsDom);
- $coordArray = explode(' ', trim($coordsDom->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlPolygon->addPoint($x, $y);
- }
- $cnt++;
- }
-
- $innerRingNodeArray = $simpleXMLNode->xpath("gml:innerBoundaryIs/gml:LinearRing");
- if ($innerRingNodeArray) {
- $ringCount = 0;
- foreach ($innerRingNodeArray as $ringNode) {
- $coordinates = $ringNode->xpath("gml:coordinates");
- foreach ($coordinates as $coordinate) {
- $coordsDom = dom_import_simplexml($coordinate);
-
- $dim = $this->getDimensionFromNode($coordsDom);
- $coordArray = explode(' ', trim($coordsDom->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlPolygon->addPointToRing($ringCount, $x, $y);
- }
- }
- $ringCount++;
- }
- }
- }
-
- private function parseMultiLine ($domNode, $gmlMultiLine) {
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allCoords = $simpleXMLNode->xpath("gml:curveMember/gml:LineString/gml:posList");
-
- $cnt=0;
- foreach ($allCoords as $Coords) {
-
- $gmlMultiLine->lineArray[$cnt] = array();
-
- $coordsDom = dom_import_simplexml($Coords);
-
- $dim = $this->getDimensionFromNode($coordsDom);
- $coordArray = explode(' ', trim($coordsDom->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlMultiLine->addPoint($x, $y, $cnt);
- }
- $cnt++;
- }
- }
-
- private function parseMultiPolygon ($domNode, $gmlMultiPolygon) {
- $simpleXMLNode = simplexml_import_dom($domNode);
-
- $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- $allPolygons = $simpleXMLNode->xpath("gml:surfaceMember/gml:Polygon");
-
- $cnt=0;
- foreach ($allPolygons as $polygon) {
- $allCoords = $polygon->xpath("gml:exterior/gml:LinearRing/gml:posList");
-
- $gmlMultiPolygon->polygonArray[$cnt] = array();
- foreach ($allCoords as $Coords) {
-
- $coordsDom = dom_import_simplexml($Coords);
-
- $dim = $this->getDimensionFromNode($coordsDom);
- $coordArray = explode(' ', trim($coordsDom->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlMultiPolygon->addPoint($x, $y, $cnt);
- }
- }
-
- $gmlMultiPolygon->innerRingArray[$cnt] = array();
- $innerRingNodeArray = $polygon->xpath("gml:interior");
- if ($innerRingNodeArray) {
- $ringCount = 0;
- foreach ($innerRingNodeArray as $ringNode) {
- $currentRingNode = $ringNode->xpath("gml:LinearRing");
- foreach ($currentRingNode as $node) {
- $coordinates = $node->xpath("gml:posList");
- foreach ($coordinates as $coordinate) {
- $coordsDom = dom_import_simplexml($coordinate);
-
- $dim = $this->getDimensionFromNode($coordsDom);
- $coordArray = explode(' ', trim($coordsDom->nodeValue));
- for ($i = 0; $i < count($coordArray); $i += $dim) {
- $x = $coordArray[$i];
- $y = $coordArray[$i+1];
- $gmlMultiPolygon->addPointToRing($cnt, $ringCount, $x, $y);
- }
- }
- $ringCount++;
-
- }
- }
- }
- $cnt++;
-// new mb_exception("create multipolygon " . serialize($gmlMultiPolygon->innerRingArray));
- }
- }
-
- /**
- * Parses the feature segment of a GML and stores the geometry in the
- * $geometry variable of the class.
- *
- * Example of a feature segment of a GML.
- *
- * <gml:featureMember>
- * <ms:my_polygons gml:id="my_polygons.624">
- * <gml:boundedBy>
- * <gml:Envelope srsName="epsg:4326">
- * <gml:lowerCorner>39.700000 29.400000</gml:lowerCorner>
- * <gml:upperCorner>46.400000 35.400000</gml:upperCorner>
- * </gml:Envelope>
- * </gml:boundedBy>
- * <ms:the_geom>
- * <gml:MultiSurface srsName="epsg:4326">
- * <gml:surfaceMembers>
- * <gml:Polygon>
- * <gml:exterior>
- * <gml:LinearRing>
- * <gml:posList srsDimension="2">
- * 43.200000 35.400000
- * 46.400000 31.700000
- * 44.100000 31.000000
- * 41.700000 29.400000
- * 39.700000 31.400000
- * 43.300000 32.300000
- * 43.200000 35.400000
- * </gml:posList>
- * </gml:LinearRing>
- * </gml:exterior>
- * </gml:Polygon>
- * </gml:surfaceMembers>
- * </gml:MultiSurface>
- * </ms:the_geom>
- * <ms:oid>16752039</ms:oid>
- * <ms:gid>624</ms:gid>
- * <ms:name>inter_08</ms:name>
- * <ms:angle/>
- * <ms:annotation/>
- * <ms:style>3</ms:style>
- * </ms:my_polygons>
- * </gml:featureMember>
- *
- * @return void
- * @param $domNode DOMNodeObject the feature tag of the GML
- * (<gml:featureMember> in the above example)
- */
- protected function parseFeature($domNode, $feature, $wfsConf) {
- $geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
-
- $feature->fid = $domNode->getAttribute("gml:id");
-
- $currentSibling = $domNode->firstChild;
-
- while ($currentSibling) {
-
- $name = $currentSibling->nodeName;
- $value = $currentSibling->nodeValue;
-
- $namespace = $this->findNameSpace($name);
- $ns = $namespace['ns'];
- $columnName = $namespace['value'];
- $isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
-
- // check if this node is a geometry node.
- // however, even if it is a property node,
- // it has a child node, the text node!
- // So we might need to do something more
- // sophisticated here...
- if ($currentSibling->hasChildNodes() && $isGeomColumn){
- $geomNode = $currentSibling->firstChild;
- $geomType = $geomNode->nodeName;
- if ($geomNode->hasAttribute("srsName")) {
- $srs = $geomNode->getAttribute("srsName");
- }
- switch ($geomType) {
- case "gml:Polygon" :// untested!
- $feature->geometry = new GMLPolygon();
- $feature->geometry->srs = $srs;
- $this->parsePolygon($geomNode, $feature->geometry);
- break;
- case "gml:LineString" :// untested!
- $feature->geometry = new GMLLine();
- $feature->geometry->srs = $srs;
- $this->parseLine($geomNode, $feature->geometry);
- break;
- case "gml:Point" :
- $feature->geometry = new GMLPoint();
- $feature->geometry->srs = $srs;
- $this->parsePoint($geomNode, $feature->geometry);
- break;
- case "gml:MultiCurve" :
- $feature->geometry = new GMLMultiLine();
- $feature->geometry->srs = $srs;
- $this->parseMultiLine($geomNode, $feature->geometry);
- break;
- case "gml:MultiSurface" :
- $feature->geometry = new GMLMultiPolygon();
- $feature->geometry->srs = $srs;
- $this->parseMultiPolygon($geomNode, $feature->geometry);
- break;
- default:
- $feature->properties[$columnName] = $value;
- break;
- }
- }
- else {
- if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
- $feature->properties[$columnName] = $value;
- }
- }
-
- $currentSibling = $currentSibling->nextSibling;
- }
- }
-
-
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_3_factory.php (from rev 3891, trunk/mapbender/http/classes/class_gml_3_factory.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_3_factory.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_3_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,361 @@
+<?php
+# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
+# http://www.mapbender.org/index.php/class_wfs.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_3.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+/**
+ * Creates GML 3 objects from a GML documents.
+ *
+ * @return Gml_3
+ */
+class Gml_3_Factory extends GmlFactory {
+
+ /**
+ * Creates a GML object from a GeoJSON (http://www.geojson.org) String
+ *
+ * @return Gml_3
+ * @param $geoJson String
+ */
+ public function createFromGeoJson ($geoJson) {
+ $gml3 = new Gml_3();
+
+ return parent::createFromGeoJson($geoJson, $gml3);
+ }
+
+ /**
+ * Creates GML 3 objects from GML documents.
+ *
+ * @return Gml_3
+ * @param $xml String
+ */
+ public function createFromXml ($xml, $wfsConf) {
+ $gml3 = new Gml_3();
+ return parent::createFromXml($xml, $wfsConf, $gml3);
+ }
+
+ public static function getDimensionFromNode ($domNode) {
+ if (!$domNode->hasAttribute("srsDimension")) {
+ return 2;
+ }
+ $dim = intval($domNode->getAttribute("srsDimension"), 10);
+ if (2 == $dim || 3 == $dim) {
+ return $dim;
+ }
+ return 2;
+ }
+
+ function findNameSpace($s){
+ list($ns,$FeaturePropertyName) = split(":",$s);
+ $nodeName = array('ns' => $ns, 'value' => $FeaturePropertyName);
+ return $nodeName;
+ }
+
+ public static function parsePoint ($domNode) {
+ $gmlPoint = new GmlPoint();
+ $currentSibling = $domNode->firstChild;
+ while ($currentSibling) {
+ $coordArray = explode(" ", $currentSibling->nodeValue);
+ $gmlPoint->setPoint($coordArray[0], $coordArray[1]);
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ return $gmlPoint;
+ }
+
+ public static function parseLine ($domNode) {
+ $gmlLine = new GmlLine();
+
+ $currentSibling = $domNode->firstChild;
+ while ($currentSibling) {
+
+ $dim = self::getDimensionFromNode($currentSibling);
+ $coordArray = explode(' ', trim($currentSibling->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlLine->addPoint($x, $y);
+ }
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ return $gmlLine;
+ }
+
+ public static function parsePolygon ($domNode) {
+ $gmlPolygon = new GmlPolygon();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allCoords = $simpleXMLNode->xpath("gml:exterior/gml:LinearRing/gml:posList");
+
+ $cnt=0;
+ foreach ($allCoords as $Coords) {
+ $coordsDom = dom_import_simplexml($Coords);
+
+ $dim = self::getDimensionFromNode($coordsDom);
+ $coordArray = explode(' ', trim($coordsDom->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlPolygon->addPoint($x, $y);
+ }
+ $cnt++;
+ }
+
+ $innerRingNodeArray = $simpleXMLNode->xpath("gml:innerBoundaryIs/gml:LinearRing");
+ if ($innerRingNodeArray) {
+ $ringCount = 0;
+ foreach ($innerRingNodeArray as $ringNode) {
+ $coordinates = $ringNode->xpath("gml:coordinates");
+ foreach ($coordinates as $coordinate) {
+ $coordsDom = dom_import_simplexml($coordinate);
+
+ $dim = self::getDimensionFromNode($coordsDom);
+ $coordArray = explode(' ', trim($coordsDom->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlPolygon->addPointToRing($ringCount, $x, $y);
+ }
+ }
+ $ringCount++;
+ }
+ }
+ return $gmlPolygon;
+ }
+
+ public static function parseMultiLine ($domNode) {
+ $gmlMultiLine = new GmlMultiLine();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allCoords = $simpleXMLNode->xpath("gml:curveMember/gml:LineString/gml:posList");
+
+ $cnt=0;
+ foreach ($allCoords as $Coords) {
+
+ $gmlMultiLine->lineArray[$cnt] = array();
+
+ $coordsDom = dom_import_simplexml($Coords);
+
+ $dim = self::getDimensionFromNode($coordsDom);
+ $coordArray = explode(' ', trim($coordsDom->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlMultiLine->addPoint($x, $y, $cnt);
+ }
+ $cnt++;
+ }
+ return $gmlMultiLine;
+ }
+
+ public static function parseMultiPolygon ($domNode) {
+ $gmlMultiPolygon = new GmlMultiPolygon();
+
+ $simpleXMLNode = simplexml_import_dom($domNode);
+
+ $simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ $allPolygons = $simpleXMLNode->xpath("gml:surfaceMember/gml:Polygon");
+
+ $cnt=0;
+ foreach ($allPolygons as $polygon) {
+ $allCoords = $polygon->xpath("gml:exterior/gml:LinearRing/gml:posList");
+
+ $gmlMultiPolygon->polygonArray[$cnt] = array();
+ foreach ($allCoords as $Coords) {
+
+ $coordsDom = dom_import_simplexml($Coords);
+
+ $dim = self::getDimensionFromNode($coordsDom);
+ $coordArray = explode(' ', trim($coordsDom->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlMultiPolygon->addPoint($x, $y, $cnt);
+ }
+ }
+
+ $gmlMultiPolygon->innerRingArray[$cnt] = array();
+ $innerRingNodeArray = $polygon->xpath("gml:interior");
+ if ($innerRingNodeArray) {
+ $ringCount = 0;
+ foreach ($innerRingNodeArray as $ringNode) {
+ $currentRingNode = $ringNode->xpath("gml:LinearRing");
+ foreach ($currentRingNode as $node) {
+ $coordinates = $node->xpath("gml:posList");
+ foreach ($coordinates as $coordinate) {
+ $coordsDom = dom_import_simplexml($coordinate);
+
+ $dim = self::getDimensionFromNode($coordsDom);
+ $coordArray = explode(' ', trim($coordsDom->nodeValue));
+ for ($i = 0; $i < count($coordArray); $i += $dim) {
+ $x = $coordArray[$i];
+ $y = $coordArray[$i+1];
+ $gmlMultiPolygon->addPointToRing($cnt, $ringCount, $x, $y);
+ }
+ }
+ $ringCount++;
+
+ }
+ }
+ }
+ $cnt++;
+// new mb_exception("create multipolygon " . serialize($gmlMultiPolygon->innerRingArray));
+ }
+ return $gmlMultiPolygon;
+ }
+
+ /**
+ * Parses the feature segment of a GML and stores the geometry in the
+ * $geometry variable of the class.
+ *
+ * Example of a feature segment of a GML.
+ *
+ * <gml:featureMember>
+ * <ms:my_polygons gml:id="my_polygons.624">
+ * <gml:boundedBy>
+ * <gml:Envelope srsName="epsg:4326">
+ * <gml:lowerCorner>39.700000 29.400000</gml:lowerCorner>
+ * <gml:upperCorner>46.400000 35.400000</gml:upperCorner>
+ * </gml:Envelope>
+ * </gml:boundedBy>
+ * <ms:the_geom>
+ * <gml:MultiSurface srsName="epsg:4326">
+ * <gml:surfaceMembers>
+ * <gml:Polygon>
+ * <gml:exterior>
+ * <gml:LinearRing>
+ * <gml:posList srsDimension="2">
+ * 43.200000 35.400000
+ * 46.400000 31.700000
+ * 44.100000 31.000000
+ * 41.700000 29.400000
+ * 39.700000 31.400000
+ * 43.300000 32.300000
+ * 43.200000 35.400000
+ * </gml:posList>
+ * </gml:LinearRing>
+ * </gml:exterior>
+ * </gml:Polygon>
+ * </gml:surfaceMembers>
+ * </gml:MultiSurface>
+ * </ms:the_geom>
+ * <ms:oid>16752039</ms:oid>
+ * <ms:gid>624</ms:gid>
+ * <ms:name>inter_08</ms:name>
+ * <ms:angle/>
+ * <ms:annotation/>
+ * <ms:style>3</ms:style>
+ * </ms:my_polygons>
+ * </gml:featureMember>
+ *
+ * @return void
+ * @param $domNode DOMNodeObject the feature tag of the GML
+ * (<gml:featureMember> in the above example)
+ */
+ protected function parseFeature($domNode, $feature, $wfsConf) {
+ $geomFeaturetypeElement = $wfsConf->getGeometryColumnName();
+
+ $feature->fid = $domNode->getAttribute("gml:id");
+
+ $currentSibling = $domNode->firstChild;
+
+ while ($currentSibling) {
+
+ $name = $currentSibling->nodeName;
+ $value = $currentSibling->nodeValue;
+
+ $namespace = $this->findNameSpace($name);
+ $ns = $namespace['ns'];
+ $columnName = $namespace['value'];
+ $isGeomColumn = ($geomFeaturetypeElement == null || $columnName == $geomFeaturetypeElement);
+
+ // check if this node is a geometry node.
+ // however, even if it is a property node,
+ // it has a child node, the text node!
+ // So we might need to do something more
+ // sophisticated here...
+ if ($currentSibling->hasChildNodes() && $isGeomColumn){
+ $geomNode = $currentSibling->firstChild;
+ $geomType = $geomNode->nodeName;
+ if ($geomNode->hasAttribute("srsName")) {
+ $srs = $geomNode->getAttribute("srsName");
+ }
+ switch ($geomType) {
+ case "gml:Polygon" :// untested!
+ $feature->geometry = self::parsePolygon($geomNode);
+ if ($feature->geometry->isEmpty()) {
+ $feature->geometry = Gml_2_Factory::parsePolygon($geomNode);
+ }
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:LineString" :// untested!
+ $feature->geometry = self::parseLine($geomNode);
+ if ($feature->geometry->isEmpty()) {
+ $feature->geometry = Gml_2_Factory::parseLine($geomNode);
+ }
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:Point" :
+ $feature->geometry = self::parsePoint($geomNode);
+ if ($feature->geometry->isEmpty()) {
+ $feature->geometry = Gml_2_Factory::parsePoint($geomNode);
+ }
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:MultiCurve" :
+ $feature->geometry = self::parseMultiLine($geomNode);
+ if ($feature->geometry->isEmpty()) {
+ $feature->geometry = Gml_2_Factory::parseMultiLine($geomNode);
+ }
+ $feature->geometry->srs = $srs;
+ break;
+ case "gml:MultiSurface" :
+ $feature->geometry = self::parseMultiPolygon($geomNode);
+ if ($feature->geometry->isEmpty()) {
+ $feature->geometry = Gml_2_Factory::parseMultiPolygon($geomNode);
+ }
+ $feature->geometry->srs = $srs;
+ break;
+ default:
+ $feature->properties[$columnName] = $value;
+ break;
+ }
+ }
+ else {
+ if ($currentSibling->hasChildNodes() && $currentSibling->firstChild instanceof DOMText) {
+ $feature->properties[$columnName] = $value;
+ }
+ }
+
+ $currentSibling = $currentSibling->nextSibling;
+ }
+ }
+
+
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_factory.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,231 +0,0 @@
-<?php
-# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
-# http://www.mapbender.org/index.php/class_wfs.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-/**
- * Creates GML objects from GML documents.
- *
- * @return Gml
- */
-abstract class GmlFactory {
-
- public function removeWhiteSpace ($string) {
- return preg_replace("/\>(\s)+\</", "><", trim($string));
- }
-
- /**
- * Creates a GML object from a GeoJSON (http://www.geojson.org) String
- *
- * @return Gml
- * @param $geoJson String
- */
- public function createFromGeoJson ($geoJson, $gml) {
- $json = new Mapbender_JSON ();
- $jsonObj = $json->decode($geoJson);
-
- // check if valid feature collection
- new mb_exception("Is Array? " . is_array($jsonObj->features));
- new mb_exception("Type? " . strtoupper($jsonObj->type));
- if (strtoupper($jsonObj->type) != "FEATURECOLLECTION" || !is_array($jsonObj->features)) {
- $e = new mb_exception("Not a valid GeoJSON Feature Collection.");
- return null;
- }
-
- $gml->featureCollection = new FeatureCollection();
- foreach ($jsonObj->features as $currentFeature) {
- $feature = new Feature();
- if (!is_object($currentFeature->crs) || $currentFeature->crs->type !== "name") {
- $e = new mb_exception("Feature doesn't have a SRS.");
- return null;
- }
- $srs = $currentFeature->crs->properties->name;
-
- // set geometry
- if (is_object($currentFeature->geometry)) {
- $currentGeometry = $currentFeature->geometry;
- switch (strtoupper($currentGeometry->type)) {
- case "POLYGON":
- $geometry = new GMLPolygon();
- for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
- $currentRing = $currentGeometry->coordinates[$i];
-
- foreach ($currentRing as $coords) {
- list($x, $y) = $coords;
-
- // exterior ring
- if (0 == $i) {
- $geometry->addPoint($x, $y);
- }
- // interior ring
- else {
- $geometry->addPointToRing($i, $x, $y);
- }
- }
- }
- break;
- case "POINT":
- $geometry = new GMLPoint();
- list($x, $y) = $currentGeometry->coordinates;
- $geometry->setPoint($x, $y);
- break;
- case "LINESTRING":
- $geometry = new GMLLine();
- for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
- $currentLinePoint = $currentGeometry->coordinates[$i];
- list($x, $y) = $currentLinePoint;
- $geometry->addPoint($x, $y);
- }
- break;
- case "MULTIPOLYGON":
- $geometry = new GMLMultiPolygon();
- for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
- $currentPolygon = $currentGeometry->coordinates[$i];
-
- for ($j = 0; $j < count($currentPolygon); $j++) {
- $currentRing = $currentPolygon[$j];
-
- foreach ($currentRing as $coords) {
- list($x, $y) = $coords;
-
- // exterior ring
- if (0 == $j) {
- $geometry->addPoint($x, $y, $i);
- }
- // interior ring
- else {
- $geometry->addPointToRing($i, $j-1, $x, $y);
- }
- }
- }
- }
- break;
- case "MULTIPOINT":
- $e = new mb_exception($currentGeometry->type . " are not supported!");
- return null;
- break;
- case "MULTILINESTRING": // not tested!
- $geometry = new GMLMultiLine();
- for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
- $currentLine = $currentGeometry->coordinates[$i];
- foreach ($currentLine as $currentLinePoint) {
- list($x, $y) = $currentLinePoint;
- $geometry->addPoint($x, $y, $i);
- }
- }
- break;
- case "GEOMETRYCOLLECTION":
- $e = new mb_exception($currentGeometry->type . " are not supported!");
- return null;
- break;
- default:
- $e = new mb_exception($currentGeometry->type . " is not a valid geometry type");
- return null;
- break;
- }
- // add the geometry to the feature
- $geometry->srs = $srs;
- $feature->geometry = $geometry;
- }
- else {
- $e = new mb_exception("This feature does not have a geometry.");
- return null;
- }
-
-
- // set fid and properties
- if (is_object($currentFeature->properties)) {
- foreach ($currentFeature->properties as $pName => $pValue) {
- if ("fid" == $pName) {
- $feature->fid = $pValue;
- }
- else {
- $feature->properties[$pName] = $pValue;
- }
- }
- }
-
- $gml->featureCollection->addFeature($feature);
- }
- return $gml;
- }
-
- /**
- * Creates GML objects from GML documents.
- *
- * @return Gml
- * @param $xml String
- */
- public function createFromXml ($xml, $wfsConf, $gml) {
- try {
- $xml = $this->removeWhiteSpace($xml);
- $gmlDoc = new SimpleXMLElement($xml);
-
- // we need to find the name and namespaces of the featuretype
- // used in this WFS configuration
- $wfsFactory = new UniversalWfsFactory();
- $myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
- if (is_null($myWfs)) {
- return null;
- }
- $featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
-
- // register namespace of feature type
- $pos = strpos($featureType->name, ":");
- if ($pos !== false) {
- $ns = substr($featureType->name, 0, $pos);
- $url = $featureType->getNamespace($ns);
- $gmlDoc->registerXPathNamespace($ns, $url);
- }
-
- $gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls');
- $gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
- $gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
-
- // build feature collection
- $gml->featureCollection = new FeatureCollection();
-
- // segments of the featureCollection
- $gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
-
- if (count($gmlFeatureMembers) > 0) {
- foreach ($gmlFeatureMembers as $gmlFeatureMember) {
-
-// $e = new mb_exception($gmlFeatureMember->asXML());
- $featureMember_dom = dom_import_simplexml($gmlFeatureMember);
-
- $feature = new Feature();
- $this->parseFeature($featureMember_dom, $feature, $wfsConf);
- if (isset($feature->geometry)) {
- $gml->featureCollection->addFeature($feature);
- }
- }
- }
- return $gml;
- }
- catch (Exception $e) {
- $e = new mb_exception($e);
- return null;
- }
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_factory.php (from rev 3891, trunk/mapbender/http/classes/class_gml_factory.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_factory.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_factory.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,229 @@
+<?php
+# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
+# http://www.mapbender.org/index.php/class_wfs.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+/**
+ * Creates GML objects from GML documents.
+ *
+ * @return Gml
+ */
+abstract class GmlFactory {
+
+ public function removeWhiteSpace ($string) {
+ return preg_replace("/\>(\s)+\</", "><", trim($string));
+ }
+
+ /**
+ * Creates a GML object from a GeoJSON (http://www.geojson.org) String
+ *
+ * @return Gml
+ * @param $geoJson String
+ */
+ public function createFromGeoJson ($geoJson, $gml) {
+ $json = new Mapbender_JSON ();
+ $jsonObj = $json->decode($geoJson);
+
+ // check if valid feature collection
+ if (strtoupper($jsonObj->type) != "FEATURECOLLECTION" || !is_array($jsonObj->features)) {
+ $e = new mb_exception("Not a valid GeoJSON Feature Collection.");
+ return null;
+ }
+
+ $gml->featureCollection = new FeatureCollection();
+ foreach ($jsonObj->features as $currentFeature) {
+ $feature = new Feature();
+ if (!is_object($currentFeature->crs) || $currentFeature->crs->type !== "name") {
+ $e = new mb_exception("Feature doesn't have a SRS.");
+ return null;
+ }
+ $srs = $currentFeature->crs->properties->name;
+
+ // set geometry
+ if (is_object($currentFeature->geometry)) {
+ $currentGeometry = $currentFeature->geometry;
+ switch (strtoupper($currentGeometry->type)) {
+ case "POLYGON":
+ $geometry = new GMLPolygon();
+ for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
+ $currentRing = $currentGeometry->coordinates[$i];
+
+ foreach ($currentRing as $coords) {
+ list($x, $y) = $coords;
+
+ // exterior ring
+ if (0 == $i) {
+ $geometry->addPoint($x, $y);
+ }
+ // interior ring
+ else {
+ $geometry->addPointToRing($i, $x, $y);
+ }
+ }
+ }
+ break;
+ case "POINT":
+ $geometry = new GMLPoint();
+ list($x, $y) = $currentGeometry->coordinates;
+ $geometry->setPoint($x, $y);
+ break;
+ case "LINESTRING":
+ $geometry = new GMLLine();
+ for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
+ $currentLinePoint = $currentGeometry->coordinates[$i];
+ list($x, $y) = $currentLinePoint;
+ $geometry->addPoint($x, $y);
+ }
+ break;
+ case "MULTIPOLYGON":
+ $geometry = new GMLMultiPolygon();
+ for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
+ $currentPolygon = $currentGeometry->coordinates[$i];
+
+ for ($j = 0; $j < count($currentPolygon); $j++) {
+ $currentRing = $currentPolygon[$j];
+
+ foreach ($currentRing as $coords) {
+ list($x, $y) = $coords;
+
+ // exterior ring
+ if (0 == $j) {
+ $geometry->addPoint($x, $y, $i);
+ }
+ // interior ring
+ else {
+ $geometry->addPointToRing($i, $j-1, $x, $y);
+ }
+ }
+ }
+ }
+ break;
+ case "MULTIPOINT":
+ $e = new mb_exception($currentGeometry->type . " are not supported!");
+ return null;
+ break;
+ case "MULTILINESTRING": // not tested!
+ $geometry = new GMLMultiLine();
+ for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
+ $currentLine = $currentGeometry->coordinates[$i];
+ foreach ($currentLine as $currentLinePoint) {
+ list($x, $y) = $currentLinePoint;
+ $geometry->addPoint($x, $y, $i);
+ }
+ }
+ break;
+ case "GEOMETRYCOLLECTION":
+ $e = new mb_exception($currentGeometry->type . " are not supported!");
+ return null;
+ break;
+ default:
+ $e = new mb_exception($currentGeometry->type . " is not a valid geometry type");
+ return null;
+ break;
+ }
+ // add the geometry to the feature
+ $geometry->srs = $srs;
+ $feature->geometry = $geometry;
+ }
+ else {
+ $e = new mb_exception("This feature does not have a geometry.");
+ return null;
+ }
+
+
+ // set fid and properties
+ if (is_object($currentFeature->properties)) {
+ foreach ($currentFeature->properties as $pName => $pValue) {
+ if ("fid" == $pName) {
+ $feature->fid = $pValue;
+ }
+ else {
+ $feature->properties[$pName] = $pValue;
+ }
+ }
+ }
+
+ $gml->featureCollection->addFeature($feature);
+ }
+ return $gml;
+ }
+
+ /**
+ * Creates GML objects from GML documents.
+ *
+ * @return Gml
+ * @param $xml String
+ */
+ public function createFromXml ($xml, $wfsConf, $gml) {
+ try {
+ $xml = $this->removeWhiteSpace($xml);
+ $gmlDoc = new SimpleXMLElement($xml);
+
+ // we need to find the name and namespaces of the featuretype
+ // used in this WFS configuration
+ $wfsFactory = new UniversalWfsFactory();
+ $myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
+ if (is_null($myWfs)) {
+ return null;
+ }
+ $featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
+
+ // register namespace of feature type
+ $pos = strpos($featureType->name, ":");
+ if ($pos !== false) {
+ $ns = substr($featureType->name, 0, $pos);
+ $url = $featureType->getNamespace($ns);
+ $gmlDoc->registerXPathNamespace($ns, $url);
+ }
+
+ $gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls');
+ $gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
+ $gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+
+ // build feature collection
+ $gml->featureCollection = new FeatureCollection();
+
+ // segments of the featureCollection
+ $gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
+
+ if (count($gmlFeatureMembers) > 0) {
+ foreach ($gmlFeatureMembers as $gmlFeatureMember) {
+
+// $e = new mb_exception($gmlFeatureMember->asXML());
+ $featureMember_dom = dom_import_simplexml($gmlFeatureMember);
+
+ $feature = new Feature();
+ $this->parseFeature($featureMember_dom, $feature, $wfsConf);
+ if (isset($feature->geometry)) {
+ $gml->featureCollection->addFeature($feature);
+ }
+ }
+ }
+ return $gml;
+ }
+ catch (Exception $e) {
+ $e = new mb_exception($e);
+ return null;
+ }
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_line.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_line.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_line.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,86 +0,0 @@
-<?php
-# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
-# http://www.mapbender.org/index.php/class_gml2.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
-
-
-class GMLLine extends GmlGeometry {
-
- var $pointArray = array();
-
- public function __construct() {
-
- }
-
- public function addPoint ($x, $y) {
- array_push($this->pointArray, array("x" => $x, "y" => $y));
- }
-
- public function toGml2 () {
- $str = "<gml:MultiLineString srsName=\"$this->srs\">" .
- "<gml:lineStringMember><gml:LineString><gml:coordinates>";
-
- $ptArray = array();
- foreach ($this->pointArray as $point) {
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
-
- $str .= "</gml:coordinates></gml:LineString></gml:lineStringMember>";
- $str .= "</gml:MultiLineString>";
- return $str;
- }
-
- public function toGml3 () {
- $str = "<gml:MultiCurve srsName=\"$this->srs\">" .
- "<gml:curveMember><gml:LineString>";
-
- $ptArray = array();
- foreach ($this->pointArray as $point) {
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode("", $ptArray);
-
- $str .= "</gml:LineString></gml:curveMember>";
- $str .= "</gml:MultiCurve>";
- return $str;
- }
-
- public function toGeoJSON () {
- $numberOfPoints = count($this->pointArray);
- $str = "";
- if ($numberOfPoints > 0) {
- $str .= "{\"type\": \"LineString\", \"coordinates\":[";
- for ($i=0; $i < $numberOfPoints; $i++) {
- if ($i > 0) {
- $str .= ",";
- }
- $str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
- }
- $str .= "]}";
- }
- else {
- $e = new mb_exception("GMLLine: toGeoJSON: this point is null.");
- }
- return $str;
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_line.php (from rev 3891, trunk/mapbender/http/classes/class_gml_line.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_line.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_line.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,90 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+
+class GMLLine extends GmlGeometry {
+
+ var $pointArray = array();
+
+ public function __construct() {
+
+ }
+
+ public function addPoint ($x, $y) {
+ array_push($this->pointArray, array("x" => $x, "y" => $y));
+ }
+
+ public function toGml2 () {
+ $str = "<gml:MultiLineString srsName=\"$this->srs\">" .
+ "<gml:lineStringMember><gml:LineString><gml:coordinates>";
+
+ $ptArray = array();
+ foreach ($this->pointArray as $point) {
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+
+ $str .= "</gml:coordinates></gml:LineString></gml:lineStringMember>";
+ $str .= "</gml:MultiLineString>";
+ return $str;
+ }
+
+ public function toGml3 () {
+ $str = "<gml:MultiCurve srsName=\"$this->srs\">" .
+ "<gml:curveMember><gml:LineString>";
+
+ $ptArray = array();
+ foreach ($this->pointArray as $point) {
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode("", $ptArray);
+
+ $str .= "</gml:LineString></gml:curveMember>";
+ $str .= "</gml:MultiCurve>";
+ return $str;
+ }
+
+ public function isEmpty () {
+ return !(count($this->pointArray) > 0);
+ }
+
+ public function toGeoJSON () {
+ $numberOfPoints = count($this->pointArray);
+ $str = "";
+ if ($numberOfPoints > 0) {
+ $str .= "{\"type\": \"LineString\", \"coordinates\":[";
+ for ($i=0; $i < $numberOfPoints; $i++) {
+ if ($i > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+ }
+ $str .= "]}";
+ }
+ else {
+ $e = new mb_exception("GMLLine: toGeoJSON: this point is null.");
+ }
+ return $str;
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_multiline.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_multiline.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_multiline.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,97 +0,0 @@
-<?php
-# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
-# http://www.mapbender.org/index.php/class_gml2.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
-
-
-class GMLMultiLine extends GmlGeometry {
-
- var $lineArray = array();
-
- public function __construct() {
-
- }
-
- public function addPoint ($x, $y, $i) {
- array_push($this->lineArray[$i], array("x" => $x, "y" => $y));
- }
-
- public function toGml2 () {
- $str = "<gml:MultiLineString srsName='$srsName'>";
- foreach ($this->lineArray as $line) {
- $str .= "<gml:lineStringMember><gml:LineString><gml:coordinates>";
- $ptArray = array();
- foreach ($line as $point) {
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
- $str .= "</gml:coordinates></gml:LineString>";
- }
- $str .= "<gml:lineStringMember><gml:MultiLineString>";
- return $str;
- }
-
- public function toGml3 () {
- $str = "<gml:MultiCurve srsName='$srsName'>";
- foreach ($this->lineArray as $line) {
- $str .= "<gml:curveMember><gml:LineString>";
- $ptArray = array();
- foreach ($line as $point) {
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode("", $ptArray);
- $str .= "</gml:LineString><gml:curveMember>";
- }
- $str .= "<gml:MultiCurve>";
- return $str;
-
- }
-
- public function toGeoJSON () {
- $numberlineArray = count($this->lineArray);
- $str = "";
- if ($numberlineArray > 0) {
- $str .= "{\"type\": \"MultiLineString\", \"coordinates\":[";
-
- for ($cnt =0; $cnt < $numberlineArray; $cnt++){
- if ($cnt > 0) {
- $str .= ",";
- }
- $str .="[";
-
- for ($i=0; $i < count($this->lineArray[$cnt]); $i++) {
- if ($i > 0) {
- $str .= ",";
- }
- $str .= "[".$this->lineArray[$cnt][$i]["x"].",".$this->lineArray[$cnt][$i]["y"]."]";
- }
- $str .="]";
- }
- $str .= "]}";
-
- }
- else {
- $e = new mb_exception("GMLMultiLine: toGeoJSON: this multiLine is null.");
- }
- return $str;
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_multiline.php (from rev 3891, trunk/mapbender/http/classes/class_gml_multiline.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_multiline.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_multiline.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,101 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+
+class GMLMultiLine extends GmlGeometry {
+
+ var $lineArray = array();
+
+ public function __construct() {
+
+ }
+
+ public function addPoint ($x, $y, $i) {
+ array_push($this->lineArray[$i], array("x" => $x, "y" => $y));
+ }
+
+ public function toGml2 () {
+ $str = "<gml:MultiLineString srsName='$srsName'>";
+ foreach ($this->lineArray as $line) {
+ $str .= "<gml:lineStringMember><gml:LineString><gml:coordinates>";
+ $ptArray = array();
+ foreach ($line as $point) {
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+ $str .= "</gml:coordinates></gml:LineString>";
+ }
+ $str .= "<gml:lineStringMember><gml:MultiLineString>";
+ return $str;
+ }
+
+ public function toGml3 () {
+ $str = "<gml:MultiCurve srsName='$srsName'>";
+ foreach ($this->lineArray as $line) {
+ $str .= "<gml:curveMember><gml:LineString>";
+ $ptArray = array();
+ foreach ($line as $point) {
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode("", $ptArray);
+ $str .= "</gml:LineString><gml:curveMember>";
+ }
+ $str .= "<gml:MultiCurve>";
+ return $str;
+
+ }
+
+ public function isEmpty () {
+ return !(count($this->lineArray) > 0);
+ }
+
+ public function toGeoJSON () {
+ $numberlineArray = count($this->lineArray);
+ $str = "";
+ if ($numberlineArray > 0) {
+ $str .= "{\"type\": \"MultiLineString\", \"coordinates\":[";
+
+ for ($cnt =0; $cnt < $numberlineArray; $cnt++){
+ if ($cnt > 0) {
+ $str .= ",";
+ }
+ $str .="[";
+
+ for ($i=0; $i < count($this->lineArray[$cnt]); $i++) {
+ if ($i > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->lineArray[$cnt][$i]["x"].",".$this->lineArray[$cnt][$i]["y"]."]";
+ }
+ $str .="]";
+ }
+ $str .= "]}";
+
+ }
+ else {
+ $e = new mb_exception("GMLMultiLine: toGeoJSON: this multiLine is null.");
+ }
+ return $str;
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_multipolygon.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_multipolygon.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_multipolygon.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,171 +0,0 @@
-<?php
-# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
-# http://www.mapbender.org/index.php/class_gml2.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
-
-class GMLMultiPolygon extends GmlGeometry {
-
- var $polygonArray = array();
- var $innerRingArray = array();
-
- public function __construct() {
-
- }
-
- public function addPointToRing ($i, $j, $x, $y) {
- while (count($this->innerRingArray) <= $i) {
- array_push($this->innerRingArray, array());
- }
- while (count($this->innerRingArray[$i]) <= $j) {
- array_push($this->innerRingArray[$i], array());
- }
- array_push($this->innerRingArray[$i][$j], array("x" => $x, "y" => $y));
- }
-
- public function addPoint ($x, $y, $i) {
- while (count($this->polygonArray) <= $i) {
- array_push($this->polygonArray, array());
- }
- array_push($this->polygonArray[$i], array("x" => $x, "y" => $y));
- }
-
- public function toGml2 () {
- $str = "<gml:MultiPolygon srsName='$this->srs'>";
- for ($i = 0; $i < count($this->polygonArray); $i++) {
- $str .= "<gml:polygonMember><gml:Polygon>" .
- "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
-
- $currentExteriorRing = $this->polygonArray[$i];
-
- $ptArray = array();
- for ($j = 0; $j < count($currentExteriorRing); $j++) {
- $point = $currentExteriorRing[$j];
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
- $str .= "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
-
- // interior rings exist
- if (count($this->innerRingArray) > $i && count($this->innerRingArray[$i]) > 0) {
-
- for ($j = 0; $j < count($this->innerRingArray[$i]); $j++) {
- $currentInteriorRing = $this->innerRingArray[$i][$j];
- $str .= "<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>";
- $ptArray = array();
- for ($k = 0; $k < count($currentInteriorRing); $k++) {
- $point = $currentInteriorRing[$k];
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
- $str .= "</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>";
- }
-
- }
- $str .= "</gml:Polygon></gml:polygonMember>";
- }
- $str .= "</gml:MultiPolygon>";
-
- return $str;
- }
-
- public function toGml3 () {
- $str = "<gml:MultiSurface srsName='$this->srs'>";
- for ($i = 0; $i < count($this->polygonArray); $i++) {
- $str .= "<gml:surfaceMember><gml:Polygon>" .
- "<gml:exterior><gml:LinearRing>";
-
- $currentExteriorRing = $this->polygonArray[$i];
-
- $ptArray = array();
- for ($j = 0; $j < count($currentExteriorRing); $j++) {
- $point = $currentExteriorRing[$j];
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode("", $ptArray);
- $str .= "</gml:LinearRing></gml:exterior>";
-
- // interior rings exist
- if (count($this->innerRingArray) > $i && count($this->innerRingArray[$i]) > 0) {
-
- for ($j = 0; $j < count($this->innerRingArray[$i]); $j++) {
- $currentInteriorRing = $this->innerRingArray[$i][$j];
- $str .= "<gml:interior><gml:LinearRing>";
- $ptArray = array();
- for ($k = 0; $k < count($currentInteriorRing); $k++) {
- $point = $currentInteriorRing[$k];
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode("", $ptArray);
- $str .= "</gml:LinearRing></gml:interior>";
- }
-
- }
- $str .= "</gml:Polygon></gml:surfaceMember>";
- }
- $str .= "</gml:MultiSurface>";
-
- return $str;
-
- }
-
- public function toGeoJSON () {
- $numberPolygonArray = count($this->polygonArray);
- $str = "";
- if ($numberPolygonArray > 0) {
- $str .= "{\"type\": \"MultiPolygon\", \"coordinates\":[";
-
- for ($cnt =0; $cnt < $numberPolygonArray; $cnt++){
- if ($cnt > 0) {
- $str .= ",";
- }
- $str .= "[";
-
- $str .= "[";
- for ($i=0; $i < count($this->polygonArray[$cnt]); $i++) {
- if ($i > 0) {
- $str .= ",";
- }
- $str .= "[".$this->polygonArray[$cnt][$i]["x"].",".$this->polygonArray[$cnt][$i]["y"]."]";
- }
- $str .= "]";
-
- for ($i=0; $i < count($this->innerRingArray[$cnt]); $i++) {
- $str .= ",[";
- for ($j=0; $j < count($this->innerRingArray[$cnt][$i]); $j++) {
- if ($j > 0) {
- $str .= ",";
- }
- $str .= "[".$this->innerRingArray[$cnt][$i][$j]["x"].",".$this->innerRingArray[$cnt][$i][$j]["y"]."]";
- }
- $str .= "]";
- }
- $str .= "]";
- }
- $str .= "]}";
-
- }
- else {
- $e = new mb_exception("GMLMultiPolygon: toGeoJSON: this multiLine is null.");
- }
- return $str;
- }
-}
-?>
Copied: branches/google_dev/trunk/http/classes/class_gml_multipolygon.php (from rev 3891, trunk/mapbender/http/classes/class_gml_multipolygon.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_multipolygon.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_multipolygon.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,175 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+class GMLMultiPolygon extends GmlGeometry {
+
+ var $polygonArray = array();
+ var $innerRingArray = array();
+
+ public function __construct() {
+
+ }
+
+ public function addPointToRing ($i, $j, $x, $y) {
+ while (count($this->innerRingArray) <= $i) {
+ array_push($this->innerRingArray, array());
+ }
+ while (count($this->innerRingArray[$i]) <= $j) {
+ array_push($this->innerRingArray[$i], array());
+ }
+ array_push($this->innerRingArray[$i][$j], array("x" => $x, "y" => $y));
+ }
+
+ public function addPoint ($x, $y, $i) {
+ while (count($this->polygonArray) <= $i) {
+ array_push($this->polygonArray, array());
+ }
+ array_push($this->polygonArray[$i], array("x" => $x, "y" => $y));
+ }
+
+ public function toGml2 () {
+ $str = "<gml:MultiPolygon srsName='$this->srs'>";
+ for ($i = 0; $i < count($this->polygonArray); $i++) {
+ $str .= "<gml:polygonMember><gml:Polygon>" .
+ "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+
+ $currentExteriorRing = $this->polygonArray[$i];
+
+ $ptArray = array();
+ for ($j = 0; $j < count($currentExteriorRing); $j++) {
+ $point = $currentExteriorRing[$j];
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+ $str .= "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+
+ // interior rings exist
+ if (count($this->innerRingArray) > $i && count($this->innerRingArray[$i]) > 0) {
+
+ for ($j = 0; $j < count($this->innerRingArray[$i]); $j++) {
+ $currentInteriorRing = $this->innerRingArray[$i][$j];
+ $str .= "<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ $ptArray = array();
+ for ($k = 0; $k < count($currentInteriorRing); $k++) {
+ $point = $currentInteriorRing[$k];
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+ $str .= "</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>";
+ }
+
+ }
+ $str .= "</gml:Polygon></gml:polygonMember>";
+ }
+ $str .= "</gml:MultiPolygon>";
+
+ return $str;
+ }
+
+ public function toGml3 () {
+ $str = "<gml:MultiSurface srsName='$this->srs'>";
+ for ($i = 0; $i < count($this->polygonArray); $i++) {
+ $str .= "<gml:surfaceMember><gml:Polygon>" .
+ "<gml:exterior><gml:LinearRing>";
+
+ $currentExteriorRing = $this->polygonArray[$i];
+
+ $ptArray = array();
+ for ($j = 0; $j < count($currentExteriorRing); $j++) {
+ $point = $currentExteriorRing[$j];
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode("", $ptArray);
+ $str .= "</gml:LinearRing></gml:exterior>";
+
+ // interior rings exist
+ if (count($this->innerRingArray) > $i && count($this->innerRingArray[$i]) > 0) {
+
+ for ($j = 0; $j < count($this->innerRingArray[$i]); $j++) {
+ $currentInteriorRing = $this->innerRingArray[$i][$j];
+ $str .= "<gml:interior><gml:LinearRing>";
+ $ptArray = array();
+ for ($k = 0; $k < count($currentInteriorRing); $k++) {
+ $point = $currentInteriorRing[$k];
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode("", $ptArray);
+ $str .= "</gml:LinearRing></gml:interior>";
+ }
+
+ }
+ $str .= "</gml:Polygon></gml:surfaceMember>";
+ }
+ $str .= "</gml:MultiSurface>";
+
+ return $str;
+
+ }
+
+ public function isEmpty () {
+ return !(count($this->polygonArray) > 0);
+ }
+
+ public function toGeoJSON () {
+ $numberPolygonArray = count($this->polygonArray);
+ $str = "";
+ if ($numberPolygonArray > 0) {
+ $str .= "{\"type\": \"MultiPolygon\", \"coordinates\":[";
+
+ for ($cnt =0; $cnt < $numberPolygonArray; $cnt++){
+ if ($cnt > 0) {
+ $str .= ",";
+ }
+ $str .= "[";
+
+ $str .= "[";
+ for ($i=0; $i < count($this->polygonArray[$cnt]); $i++) {
+ if ($i > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->polygonArray[$cnt][$i]["x"].",".$this->polygonArray[$cnt][$i]["y"]."]";
+ }
+ $str .= "]";
+
+ for ($i=0; $i < count($this->innerRingArray[$cnt]); $i++) {
+ $str .= ",[";
+ for ($j=0; $j < count($this->innerRingArray[$cnt][$i]); $j++) {
+ if ($j > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->innerRingArray[$cnt][$i][$j]["x"].",".$this->innerRingArray[$cnt][$i][$j]["y"]."]";
+ }
+ $str .= "]";
+ }
+ $str .= "]";
+ }
+ $str .= "]}";
+
+ }
+ else {
+ $e = new mb_exception("GMLMultiPolygon: toGeoJSON: this multiLine is null.");
+ }
+ return $str;
+ }
+}
+?>
Deleted: branches/google_dev/trunk/http/classes/class_gml_point.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_point.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_point.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,64 +0,0 @@
-<?php
-# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
-# http://www.mapbender.org/index.php/class_gml2.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
-
-class GMLPoint extends GmlGeometry {
-
- var $point;
-
- public function __construct() {
-
- }
-
- public function setPoint ($x, $y) {
-# echo "x: " . $x . " y: " . $y . "\n";
- $this->point = array("x" => $x, "y" => $y);
- }
-
- public function toGml2 () {
- $str = "<gml:Point srsName='$this->srs'><gml:coordinates>";
- $str .= $this->point["x"] . "," . $this->point["y"];
- $str .= "</gml:coordinates></gml:Point>";
- return $str;
- }
-
- public function toGml3 () {
- $str = "<gml:Point srsName='$this->srs'><gml:pos>";
- $str .= $this->point["x"] . " " . $this->point["y"];
- $str .= "</gml:pos></gml:Point>";
- return $str;
- }
-
- public function toGeoJSON () {
- $str = "";
- if ($this->point) {
- $str .= "{\"type\": \"Point\", \"coordinates\":";
- $str .= "[".$this->point["x"].",".$this->point["y"]."]";
- $str .= "}";
- }
- else {
- $e = new mb_exception("GMLPoint: toGeoJSON: this point is null.");
- }
- return $str;
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_point.php (from rev 3891, trunk/mapbender/http/classes/class_gml_point.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_point.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_point.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,68 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+class GMLPoint extends GmlGeometry {
+
+ var $point;
+
+ public function __construct() {
+
+ }
+
+ public function setPoint ($x, $y) {
+# echo "x: " . $x . " y: " . $y . "\n";
+ $this->point = array("x" => $x, "y" => $y);
+ }
+
+ public function toGml2 () {
+ $str = "<gml:Point srsName='$this->srs'><gml:coordinates>";
+ $str .= $this->point["x"] . "," . $this->point["y"];
+ $str .= "</gml:coordinates></gml:Point>";
+ return $str;
+ }
+
+ public function toGml3 () {
+ $str = "<gml:Point srsName='$this->srs'><gml:pos>";
+ $str .= $this->point["x"] . " " . $this->point["y"];
+ $str .= "</gml:pos></gml:Point>";
+ return $str;
+ }
+
+ public function isEmpty () {
+ return ($this->point ? false : true);
+ }
+
+ public function toGeoJSON () {
+ $str = "";
+ if ($this->point) {
+ $str .= "{\"type\": \"Point\", \"coordinates\":";
+ $str .= "[".$this->point["x"].",".$this->point["y"]."]";
+ $str .= "}";
+ }
+ else {
+ $e = new mb_exception("GMLPoint: toGeoJSON: this point is null.");
+ }
+ return $str;
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/classes/class_gml_polygon.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_polygon.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_gml_polygon.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,133 +0,0 @@
-<?php
-# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
-# http://www.mapbender.org/index.php/class_gml2.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
-
-
-class GMLPolygon extends GmlGeometry {
-
- var $pointArray = array();
- var $innerRingArray = array();
-
- public function __construct() {
-
- }
-
-
- public function addPoint ($x, $y) {
- array_push($this->pointArray, array("x" => $x, "y" => $y));
- }
-
- public function addPointToRing ($i, $x, $y) {
- if (count($this->innerRingArray) <= $i) {
- array_push($this->innerRingArray, array());
- }
- $index = count($this->innerRingIndex);
- $currentIndex = ($i < $index ? $i : $index);
- array_push($this->innerRingArray[$currentIndex], array("x" => $x, "y" => $y));
- }
-
- public function toGml2 () {
- $str = "<gml:MultiPolygon srsName=\"$this->srs\">" .
- "<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs>" .
- "<gml:LinearRing><gml:coordinates>";
-
- $ptArray = array();
- foreach ($this->pointArray as $point) {
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
-
- $str .= '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
-
- foreach ($this->innerRingArray as $ring) {
- $str .= "<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>";
- $ptArray = array();
- foreach ($ring as $point) {
- $ptArray[] = $point["x"] . "," . $point["y"];
- }
- $str .= implode(" ", $ptArray);
-
- $str .= "</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>";
- }
- $str .= "</gml:Polygon></gml:polygonMember></gml:MultiPolygon>";
- return $str;
- }
-
- public function toGml3 () {
- $str = "<gml:MultiSurface srsName=\"$this->srs\">" .
- "<gml:surfaceMember><gml:Polygon><gml:exterior>" .
- "<gml:LinearRing>";
-
- $ptArray = array();
- foreach ($this->pointArray as $point) {
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode(" ", $ptArray);
-
- $str .= '</gml:LinearRing></gml:exterior>';
-
- foreach ($this->innerRingArray as $ring) {
- $str .= "<gml:interior><gml:LinearRing>";
- $ptArray = array();
- foreach ($ring as $point) {
- $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
- }
- $str .= implode("", $ptArray);
-
- $str .= "</gml:LinearRing></gml:interior>";
- }
- $str .= "</gml:Polygon></gml:surfaceMember></gml:MultiSurface>";
- return $str;
- }
-
- public function toGeoJSON () {
- $numberOfPoints = count($this->pointArray);
- $str = "";
- if ($numberOfPoints > 0) {
- $str .= "{\"type\": \"Polygon\", \"coordinates\":[[";
- for ($i=0; $i < $numberOfPoints; $i++) {
- if ($i > 0) {
- $str .= ",";
- }
- $str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
- }
- $str .= "]";
-
- for ($i=0; $i < count($this->innerRingArray); $i++) {
- $str .= ",[";
- for ($j=0; $j < count($this->innerRingArray[$i]); $j++) {
- if ($j > 0) {
- $str .= ",";
- }
- $str .= "[".$this->innerRingArray[$i][$j]["x"].",".$this->innerRingArray[$i][$j]["y"]."]";
- }
- $str .= "]";
- }
- $str .= "]}";
- }
- else {
- $e = new mb_exception("GMLPolygon: toGeoJSON: this point is null.");
- }
- return $str;
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/classes/class_gml_polygon.php (from rev 3891, trunk/mapbender/http/classes/class_gml_polygon.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_gml_polygon.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_gml_polygon.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,137 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+
+class GMLPolygon extends GmlGeometry {
+
+ var $pointArray = array();
+ var $innerRingArray = array();
+
+ public function __construct() {
+
+ }
+
+
+ public function addPoint ($x, $y) {
+ array_push($this->pointArray, array("x" => $x, "y" => $y));
+ }
+
+ public function addPointToRing ($i, $x, $y) {
+ if (count($this->innerRingArray) <= $i) {
+ array_push($this->innerRingArray, array());
+ }
+ $index = count($this->innerRingIndex);
+ $currentIndex = ($i < $index ? $i : $index);
+ array_push($this->innerRingArray[$currentIndex], array("x" => $x, "y" => $y));
+ }
+
+ public function toGml2 () {
+ $str = "<gml:MultiPolygon srsName=\"$this->srs\">" .
+ "<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs>" .
+ "<gml:LinearRing><gml:coordinates>";
+
+ $ptArray = array();
+ foreach ($this->pointArray as $point) {
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+
+ $str .= '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
+
+ foreach ($this->innerRingArray as $ring) {
+ $str .= "<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ $ptArray = array();
+ foreach ($ring as $point) {
+ $ptArray[] = $point["x"] . "," . $point["y"];
+ }
+ $str .= implode(" ", $ptArray);
+
+ $str .= "</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>";
+ }
+ $str .= "</gml:Polygon></gml:polygonMember></gml:MultiPolygon>";
+ return $str;
+ }
+
+ public function toGml3 () {
+ $str = "<gml:MultiSurface srsName=\"$this->srs\">" .
+ "<gml:surfaceMember><gml:Polygon><gml:exterior>" .
+ "<gml:LinearRing>";
+
+ $ptArray = array();
+ foreach ($this->pointArray as $point) {
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode(" ", $ptArray);
+
+ $str .= '</gml:LinearRing></gml:exterior>';
+
+ foreach ($this->innerRingArray as $ring) {
+ $str .= "<gml:interior><gml:LinearRing>";
+ $ptArray = array();
+ foreach ($ring as $point) {
+ $ptArray[] = "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+ }
+ $str .= implode("", $ptArray);
+
+ $str .= "</gml:LinearRing></gml:interior>";
+ }
+ $str .= "</gml:Polygon></gml:surfaceMember></gml:MultiSurface>";
+ return $str;
+ }
+
+ public function isEmpty () {
+ return !(count($this->pointArray) > 0);
+ }
+
+ public function toGeoJSON () {
+ $numberOfPoints = count($this->pointArray);
+ $str = "";
+ if ($numberOfPoints > 0) {
+ $str .= "{\"type\": \"Polygon\", \"coordinates\":[[";
+ for ($i=0; $i < $numberOfPoints; $i++) {
+ if ($i > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+ }
+ $str .= "]";
+
+ for ($i=0; $i < count($this->innerRingArray); $i++) {
+ $str .= ",[";
+ for ($j=0; $j < count($this->innerRingArray[$i]); $j++) {
+ if ($j > 0) {
+ $str .= ",";
+ }
+ $str .= "[".$this->innerRingArray[$i][$j]["x"].",".$this->innerRingArray[$i][$j]["y"]."]";
+ }
+ $str .= "]";
+ }
+ $str .= "]}";
+ }
+ else {
+ $e = new mb_exception("GMLPolygon: toGeoJSON: this point is null.");
+ }
+ return $str;
+ }
+}
+?>
\ No newline at end of file
Modified: branches/google_dev/trunk/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_user.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -101,15 +101,27 @@
/** identifies the IDs of WFS confs where the user is owner
*
- * @param integer userid the user-ID of the current user
+ * @param Array appIdArray [optional] restrict to certain applications
* @return integer[] the IDs of the wfs_conf-table
*/
- public function getWfsConfByPermission(){
+ public function getWfsConfByPermission () {
$userid = $this->id;
$guisByPer = array();
// 1.
$adm = new administration();
$guisByPer = $adm->getGuisByPermission($userid, true);
+
+ if (func_num_args() === 1) {
+ $arg1 = func_get_arg(0);
+ if (is_array($arg1)) {
+ $appIdArray = $arg1;
+
+ $guisByPer = array_intersect($guisByPer, $appIdArray);
+ }
+ }
+
+ $e = new mb_exception(serialize($guisByPer));
+
// 2.
$ownWFSconfs = array();
if(count($guisByPer)>0){
Deleted: branches/google_dev/trunk/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php 2009-04-15 11:41:45 UTC (rev 3876)
+++ branches/google_dev/trunk/http/classes/class_wms.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,2238 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wms
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
-require_once(dirname(__FILE__)."/class_user.php");
-require_once(dirname(__FILE__)."/class_administration.php");
-
-class wms {
- var $lastURL;
- var $wms_id;
- var $wms_status;
- var $wms_version;
- var $wms_title;
- var $wms_abstract;
- var $wms_getcapabilities;
- var $wms_getcapabilities_doc;
- var $wms_getmap;
- var $wms_getfeatureinfo;
- var $wms_getlegendurl;
- var $wms_upload_url;
-
- var $fees;
- var $accessconstraints;
- var $contactperson;
- var $contactposition;
- var $contactorganization;
- var $address;
- var $city;
- var $stateorprovince;
- var $postcode;
- var $country;
- var $contactvoicetelephone;
- var $contactfacsimiletelephone;
- var $contactelectronicmailaddress;
-
- var $wms_keyword = array();
- var $data_type = array();
- var $data_format = array();
- var $objLayer = array();
-
- var $wms_supportsld;
- var $wms_userlayer;
- var $wms_userstyle;
- var $wms_remotewfs;
-
- var $gui_wms_mapformat;
- var $gui_wms_featureinfoformat;
- var $gui_wms_exceptionformat;
- var $gui_wms_epsg;
- var $gui_wms_sldurl;
-
- var $default_epsg = 0;
- var $overwrite = true;
-
- function wms() {
- }
-
- public static function getConjunctionCharacter ($url) {
- if (mb_strpos($url, "?") !== false) {
- if (mb_substr($url, mb_strlen($url)-1, 1) == "?") {
- return "";
- }
- else if (mb_substr($url, mb_strlen($url)-1, 1) == "&"){
- return "";
- }
- else {
- return "&";
- }
- }
- else {
- return "?";
- }
- return "";
- }
-
- function createOlObjFromWMS($base){
- if(!$this->wms_title || $this->wms_title == ""){
- echo "alert('Error: no valid capabilities-document !!');";
- die; exit;
- }
- // wms_title and abstract have previously been urlencoded
- // this solution may not yet be the ultimate one
-
- $add_wms_string = "var wms_".$this->wms_id." = new OpenLayers.Layer.WMS.Untiled(" .
- "'" . addslashes($this->wms_title) . "'," .
- "'" . $this->wms_getmap ."'," ."{layers:'";
- for($i=1;$i<count($this->objLayer);$i++){
- $add_wms_string .= addslashes($this->objLayer[$i]->layer_name);
- if($i!=count($this->objLayer)-1)
- $add_wms_string .= ",";
- }
- $add_wms_string .= "', transparent: 'true'";
- $add_wms_string .= ",format: '".$this->gui_wms_mapformat."'});";
- if($base)
- $add_wms_string .= "wms_".$this->wms_id.".isBaseLayer=true;";
- $add_wms_string .= "wms_".$this->wms_id.".setVisibility(".($this->gui_wms_visible=="1"?"true":"false").");";
- $add_wms_string .= "ol_map.addLayer(wms_".$this->wms_id.");";
- echo $add_wms_string;
- }
-
- /**
- * Compares this WMS to another WMS.
- *
- * @return boolean false, if
- * - the capabilities URLs don't match
- * - the layer count is different
- * - the layer names are different
- *
- * @param $anotherWms wms this is just another WMS object
- */
- public function equals ($anotherWms) {
- // If the getMap URLs are not equal, the WMS are not equal.
- if ($this->wms_getmap != $anotherWms->wms_getmap) {
-// $e = new mb_notice($this . " != " . $anotherWms . " (getMap URL)");
- return false;
- }
-
- // If the layer count is different, the WMS are not equal.
- if (count($this->objLayer) != count($anotherWms->objLayer)) {
-// $e = new mb_notice($this . " != " . $anotherWms . " (layer count: " . count($this->objLayer) . ":" . count($anotherWms->objLayer). ")");
- return false;
- }
-
- // If the layer names are different, the WMS are not equal.
- for ($i = 0; $i < count($this->objLayer); $i++) {
- $name1 = $this->objLayer[$i]->layer_name;
- $name2 = $anotherWms->objLayer[$i]->layer_name;
-
- if ($name1 != $name2) {
-// $e = new mb_notice($this . " != " . $anotherWms . " (layer names, " . $name1 . " vs. " . $name2 . ")");
- return false;
- }
- }
-// $e = new mb_notice($this . " == " . $anotherWms);
- return true;
- }
-
- /**
- * The other WMS must be the same as this WMS, but with different
- * application settings. These application settings are copied,
- * the local settings are overwritten.
- *
- * @return boolean true if the settings could be copied; false
- * when an error occured.
- * @param $anotherWms wms The same WMS with possibly other settings
- */
-/*
- public function copyConfiguration ($anotherWms) {
- if (!$this->equals($anotherWms)) {
- $e = new mb_exception("class_wms.php: copyConfiguration(): parameters cannot be copied, it's a different WMS.");
- return false;
- }
- for ($i = 0; $i < count($this->objLayer); $i++) {
- $myCurrentLayer = $this->objLayer[$i];
- $theirCurrentLayer = $anotherWms->objLayer[$i];
-
- $myCurrentLayer->gui_layer_selectable = $theirCurrentLayer->gui_layer_selectable;
- $myCurrentLayer->gui_layer_visible = $theirCurrentLayer->gui_layer_visible;
- $myCurrentLayer->gui_layer_queryable = $theirCurrentLayer->gui_layer_queryable;
- $myCurrentLayer->gui_layer_querylayer = $theirCurrentLayer->gui_layer_querylayer;
- $myCurrentLayer->gui_layer_style = $theirCurrentLayer->gui_layer_style;
- }
- }
-*/
-
- /**
- * Removes duplicate WMS from an array of WMS. To find duplicates,
- * two WMS are compared via equals().
- *
- * @return wms[]
- * @param $wmsArray wms[]
- */
- public static function merge ($wmsArray) {
- $e = new mb_notice("before: " . implode(", ", $wmsArray));
- if (!is_array($wmsArray)) {
- $e = new mb_exception("class_wms.php: merge(): parameter is NOT an array.");
- return array();
- }
- if (count($wmsArray) == 0) {
- $e = new mb_exception("class_wms.php: merge(): parameter is an EMPTY array.");
- return array();
- }
-
- $newWmsArray = array();
-
- while (count($wmsArray) > 0) {
- $currentWms = array_pop($wmsArray);
-
- $isNewWms = true;
-
- if (get_class($currentWms) != "wms") {
- $e = new mb_exception("class_wms.php: merge(): current WMS is not a WMS object, but a " . get_class($currentWms));
- }
- else {
- for ($i = 0; $i < count($newWmsArray) && $isNewWms; $i++) {
- if ($currentWms->equals($newWmsArray[$i])) {
- $isNewWms = false;
- }
- }
- if ($isNewWms) {
-// $e = new mb_notice("adding WMS " . $currentWms);
- array_push($newWmsArray, $currentWms);
- }
- }
- }
- // reversal of the array, because the elements were popped
- // from another array before.
-// $e = new mb_notice("after: " . implode(", ", array_reverse($newWmsArray)));
- return array_reverse($newWmsArray);
- }
-
- private function formatExists ($type, $format) {
- for ($i = 0; $i < count($this->data_type); $i++) {
- if ($type == $this->data_type[$i] && $format == $this->data_format[$i]) {
- $e = new mb_warning("WMS format already exists ($type, $format). Violation of WMS spec. Ignoring this WMS format.");
- return true;
- }
- }
- return false;
- }
-
- public function __toString () {
- return $this->wms_title;
- }
-
- function createObjFromXML($url){
-
- $x = new connector($url);
- $data = $x->file;
-
- if(!$data){
- $this->wms_status = false;
- return false;
- }
- else {
- $this->wms_status = true;
- }
-
- $values = null;
- $tags = null;
- $admin = new administration();
- $this->wms_getcapabilities_doc = $data;
- $this->wms_upload_url = $url;
-
- $this->wms_id = "";
- $parser = xml_parser_create("");
- xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
- xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
- xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
- xml_parse_into_struct($parser,$data,$values,$tags);
-
- $code = xml_get_error_code($parser);
- if ($code) {
- $line = xml_get_current_line_number($parser);
- $mb_exception = new mb_exception(xml_error_string($code) . " in line " . $line);
- }
-
- xml_parser_free($parser);
-
- $section = null;
- $format = null;
- $cnt_format = 0;
- $parent = array();
- $myParent = array();
- $cnt_layer = -1;
- $request = null;
- $layer_style = array();
- $cnt_styles = -1;
-
- foreach ($values as $element) {
- if(mb_strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
- $this->wms_version = $element[attributes][version];
- }
- if(mb_strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
- $this->wms_title = $this->stripEndlineAndCarriageReturn($element[value]);
- }
- if(mb_strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
- $this->wms_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
- }
- if(mb_strtolower($element[tag]) == "fees"){
- $this->fees = $element[value];
- }
- if(mb_strtolower($element[tag]) == "accessconstraints"){
- $this->accessconstraints = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactperson"){
- $this->contactperson = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactposition"){
- $this->contactposition = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactorganization"){
- $this->contactorganization = $element[value];
- }
- if(mb_strtolower($element[tag]) == "address"){
- $this->address = $element[value];
- }
- if(mb_strtolower($element[tag]) == "city"){
- $this->city = $element[value];
- }
- if(mb_strtolower($element[tag]) == "stateorprovince"){
- $this->stateorprovince = $element[value];
- }
- if(mb_strtolower($element[tag]) == "postcode"){
- $this->postcode = $element[value];
- }
- if(mb_strtolower($element[tag]) == "country"){
- $this->country = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactvoicetelephone"){
- $this->contactvoicetelephone = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactfacsimiletelephone"){
- $this->contactfacsimiletelephone = $element[value];
- }
- if(mb_strtolower($element[tag]) == "contactelectronicmailaddress"){
- $this->contactelectronicmailaddress = $element[value];
- }
- if(mb_strtolower($element[tag]) == "keyword" && $section != 'layer'){
- $this->wms_keyword[count($this->wms_keyword)] = $element[value];
- }
-
- /*map section*/
- if($this->wms_version == "1.0.0"){
- if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
- $section = "map";
- }
- if($section == "map" && mb_strtoupper($element[tag]) == "GET"){
- $this->wms_getmap = $element[attributes][onlineResource];
- }
- if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
- $format = "map";
- }
- if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
- if (!$this->formatExists("map", trim($element[tag]))) {
- $this->data_type[$cnt_format] = "map";
- $this->data_format[$cnt_format] = trim($element[tag]);
- $cnt_format++;
- }
- }
- if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
- $format = "";
- }
- if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
- $section = "";
- }
- }
- else{
- if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
- $section = "map";
- }
- if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
- $request = "get";
- }
- if($section == "map" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->wms_getmap = $element[attributes]["xlink:href"];
- }
- if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT"){
- if (!$this->formatExists("map", trim($element[value]))) {
- $this->data_type[$cnt_format] = "map";
- $this->data_format[$cnt_format] = trim($element[value]);
- $cnt_format++;
- }
- }
- if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
- $request = "";
- }
- if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
- $section = "";
- }
- }
- /*capabilities section*/
- if($this->wms_version == "1.0.0"){
- if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
- $section = "capabilities";
- }
- if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET"){
- $this->wms_getcapabilities = $element[attributes][onlineResource];
- }
- if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
- $section = "";
- }
- }
- else{
- if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
- $section = "capabilities";
- }
- if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
- $request = "get";
- }
- if($section == "capabilities" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->wms_getcapabilities = $element[attributes]["xlink:href"];
- }
- if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
- $request = "";
- }
- if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
- $section = "";
- }
- }
- /*featureInfo section*/
- if($this->wms_version == "1.0.0"){
- if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
- $section = "featureinfo";
- }
- if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET"){
- $this->wms_getfeatureinfo = $element[attributes][onlineResource];
- }
- if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
- $format = "featureinfo";
- }
- if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
- if (!$this->formatExists("featureinfo", trim($element[tag]))) {
- $this->data_type[$cnt_format] = "featureinfo";
- $this->data_format[$cnt_format] = trim($element[tag]);
- $cnt_format++;
- }
- }
- if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
- $format = "";
- }
- if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
- $section = "";
- }
- }
- else{
- if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
- $section = "featureinfo";
- }
- if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
- $request = "get";
- }
- if($section == "featureinfo" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->wms_getfeatureinfo = $element[attributes]["xlink:href"];
- }
- if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT"){
- if (!$this->formatExists("featureinfo", trim($element[value]))) {
- $this->data_type[$cnt_format] = "featureinfo";
- $this->data_format[$cnt_format] = trim($element[value]);
- $cnt_format++;
- }
- }
- if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
- $request = "";
- }
- if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
- $section = "";
- }
- }
- /*exception section*/
- if($this->wms_version == "1.0.0"){
- if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
- $section = "exception";
- }
- if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
- $format = "exception";
- }
- if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
- $this->data_type[$cnt_format] = "exception";
- $this->data_format[$cnt_format] = trim($element[tag]);
- $cnt_format++;
- }
- if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
- $format = "";
- }
- if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
- $section = "";
- }
- }
- else{
- if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
- $section = "exception";
- }
- if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT"){
- $this->data_type[$cnt_format] = "exception";
- $this->data_format[$cnt_format] = trim($element[value]);
- $cnt_format++;
- }
- if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
- $section = "";
- }
- }
- /*legend section*/
- if($this->wms_version == "1.0.0"){
-
- }
- else{
- if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
- $section = "legend";
- }
- if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
- $request = "get";
- }
- if($section == "legend" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->wms_getlegendurl = $element[attributes]["xlink:href"];
- }
- if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
- $request = "";
- }
- if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
- $section = "";
- }
- }
- /* sld section */
- if(mb_strtoupper($element[tag]) == "USERDEFINEDSYMBOLIZATION" && $element[type] == "complete"){
- $this->wms_supportsld = $element[attributes]["SupportSLD"];
- $this->wms_userlayer = $element[attributes]["UserLayer"];
- $this->wms_userstyle = $element[attributes]["UserStyle"];
- $this->wms_remotewfs = $element[attributes]["RemoteWFS"];
- }
-
- /*layer section*/
- if(mb_strtoupper($element[tag]) == "LAYER"){
- $section = "layer";
- if ($element[type] == "open") {
- $cnt_epsg = -1;
- $cnt_layer++;
- $parent[$element[level]+1] = $cnt_layer;
- $myParent[$cnt_layer]= $parent[$element[level]];
- $this->addLayer($cnt_layer,$myParent[$cnt_layer]);
- $this->objLayer[$cnt_layer]->layer_queryable = $element[attributes][queryable];
- }
- if ($element[type] == "close") {
-
- }
- }
- /* attribution */
- if(mb_strtoupper($element[tag]) == "ATTRIBUTION"){
- if ($element[type] == "open") {
- $section = "attribution";
- }
- if ($element[type] == "close") {
- $section = "layer";
- }
- }
- /* styles */
- if(mb_strtoupper($element[tag]) == "STYLE"){
- $section = "style";
- if($cnt_layer != $layer_style){
- $layer_style = $cnt_layer;
- $cnt_styles = -1;
- }
- if ($element[type] == "open") {
- $cnt_styles++;
- }
- if ($element[type] == "close") {
- $section = "layer";
- }
- }
- if($section == "style"){
- if(mb_strtoupper($element[tag]) == "NAME"){
- $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = ($element[value] ? $element[value] : 'default');
- }
- if(mb_strtoupper($element[tag]) == "TITLE"){
- $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["title"] = ($element[value] ? $element[value] : '');
- }
- if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
- $legendurl = true;
- }
- if($legendurl && mb_strtoupper($element[tag]) == "FORMAT"){
- $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurlformat"] = $element[value];
- }
- if($legendurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurl"] = $element[attributes]["xlink:href"];
- }
- if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
- $legendurl = false;
- }
- }
- /* end of styles */
- if($section == "layer"){
- if(mb_strtoupper($element[tag]) == "NAME"){
- $this->objLayer[$cnt_layer]->layer_name = $element[value];
- }
- if(mb_strtoupper($element[tag]) == "TITLE"){
- $this->objLayer[$cnt_layer]->layer_title = $this->stripEndlineAndCarriageReturn($element[value]);
- }
- if(mb_strtoupper($element[tag]) == "ABSTRACT"){
- $this->objLayer[$cnt_layer]->layer_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
- }
- if(mb_strtoupper($element[tag]) == "KEYWORD"){
- array_push($this->objLayer[$cnt_layer]->layer_keyword, trim($element[value]));
- }
- if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
- $dataurl = true;
- }
- if($dataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->objLayer[$cnt_layer]->layer_dataurl_href = $element[attributes]["xlink:href"];
- }
- if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
- $dataurl = false;
- }
-
- if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
- $metadataurl = true;
- }
- if($metadataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
- $this->objLayer[$cnt_layer]->layer_metadataurl = $element[attributes]["xlink:href"];
- }
- if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
- $metadataurl = false;
- }
-
- if(mb_strtoupper($element[tag]) == "SRS"){
- $this->objLayer[$cnt_layer]->wms_srs1 = $element[value];
- // unique srs only, see http://www.mapbender.org/index.php/Arrays_with_unique_entries
- $this->wms_srs = array_keys(array_flip(explode(" ", $this->objLayer[0]->wms_srs1)));
- }
- if(mb_strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
- $cnt_epsg++;
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = "EPSG:4326";
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["miny"] = $element[attributes][miny];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
- }
- if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
- $cnt_epsg++;
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][SRS];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["miny"] = $element[attributes][miny];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
- $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
- // a default epsg for mapbender
- if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][SRS]))>= 10){
- $this->default_epsg = $cnt_epsg;
- }
- }
- if(mb_strtoupper($element[tag]) == "SCALEHINT"){
- if($element[attributes][max]>1000) $max = 0; else $max = $element[attributes][max];
- if($element[attributes][min]>1000) $min = 0; else $min = $element[attributes][min];
- $this->objLayer[$cnt_layer]->layer_minscale = round(($min * 2004.3976484406788493955738891127));
- $this->objLayer[$cnt_layer]->layer_maxscale = round(($max * 2004.3976484406788493955738891127));
- }
- }
- else {
- continue;
- }
- }
- if(!$this->wms_title || $this->wms_title == "" || !$this->wms_getmap || $this->wms_getmap == ""){
- $this->wms_status = false;
- $this->optimizeWMS();
- $e = new mb_exception("class_wms: createObjFromXML: WMS " . $url . " could not be loaded.");
- return false;
- }
- else{
- $this->wms_status = true;
- $this->optimizeWMS();
- $e = new mb_notice("class_wms: createObjFromXML: WMS " . $url . " has been loaded successfully.");
- return true;
- }
- }
- /**
- * private function
- */
- function optimizeWMS() {
- /*define defaults for wms-version 1.0.0*/
- $map_default_ok = false;
- $featureinfo_default_ok = false;
- $exception_default_ok = false;
- if($this->wms_version == "1.0.0"){
- $map_default = "PNG";
- $featureinfo_default = "MIME";
- $exception_default = "INIMAGE";
- }
- /*define defaults for wms-version 1.1.0 and 1.1.1*/
- else{
- $map_default = "image/png";
- $featureinfo_default = "text/html";
- $exception_default = "application/vnd.ogc.se_inimage";
- }
- #some default
- $this->gui_wms_visible = 1;
- $this->gui_wms_opacity = 100;
- /*if the rootlayer has no epsg...*/
- if($this->objLayer[0]->layer_epsg[0]["epsg"] == ""){
- $this->objLayer[0]->layer_epsg = $this->objLayer[1]->layer_epsg;
- for($i=0;$i<count($this->objLayer[0]->layer_epsg);$i++){
- for($j=1; $j<count($this->objLayer); $j++){
- if($this->objLayer[0]->layer_epsg[$i]["epsg"] == $this->objLayer[$j]->layer_epsg[$i]["epsg"]){
- if($this->objLayer[$j]->layer_epsg[$i]["minx"]<$this->objLayer[0]->layer_epsg[$i]["minx"]){
- $this->objLayer[0]->layer_epsg[$i]["minx"] = $this->objLayer[$j]->layer_epsg[$i]["minx"];
- }
- if($this->objLayer[$j]->layer_epsg[$i]["miny"]<$this->objLayer[0]->layer_epsg[$i]["miny"]){
- $this->objLayer[0]->layer_epsg[$i]["miny"] = $this->objLayer[$j]->layer_epsg[$i]["miny"];
- }
- if($this->objLayer[$j]->layer_epsg[$i]["maxx"]>$this->objLayer[0]->layer_epsg[$i]["maxx"]){
- $this->objLayer[0]->layer_epsg[$i]["maxx"] = $this->objLayer[$j]->layer_epsg[$i]["maxx"];
- }
- if($this->objLayer[$j]->layer_epsg[$i]["maxy"]>$this->objLayer[0]->layer_epsg[$i]["maxy"]){
- $this->objLayer[0]->layer_epsg[$i]["maxy"] = $this->objLayer[$j]->layer_epsg[$i]["maxy"];
- }
- }
- }
- }
- }
- for($i=0;$i<count($this->objLayer);$i++){
- if(count($this->objLayer[$i]->layer_epsg) == 0 && count($this->objLayer[0]->layer_epsg) > 0){
- $this->objLayer[$i]->layer_epsg = $this->objLayer[0]->layer_epsg;
- }
- if(!is_int($this->objLayer[$i]->layer_parent)){
- $this->objLayer[$i]->layer_abstract = $this->wms_abstract;
- for ($r = 0; $r < count($this->wms_keyword); $r++) {
- array_push($this->objLayer[$i]->layer_keyword, trim($this->wms_keyword[$r]));
- }
- }
- if($this->objLayer[$i]->layer_name == ""){
- $this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
- }
- if($this->objLayer[$i]->layer_minscale == ""){
- $this->objLayer[$i]->layer_minscale = 0;
- }
- if($this->objLayer[$i]->layer_maxscale == ""){
- $this->objLayer[$i]->layer_maxscale = 0;
- }
- if($this->objLayer[$i]->layer_queryable == ""){
- $this->objLayer[$i]->layer_queryable = 0;
- }
- $this->objLayer[$i]->gui_layer_minscale = $this->objLayer[$i]->layer_minscale;
- $this->objLayer[$i]->gui_layer_maxscale = $this->objLayer[$i]->layer_maxscale;
- }
- for($i=0;$i<count($this->data_format);$i++){
- if(mb_strtolower($this->data_type[$i]) == 'map' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($map_default)){
- $this->gui_wms_mapformat = mb_strtolower($map_default);
- $map_default_ok = true;
- }
- if(mb_strtolower($this->data_type[$i]) == 'featureinfo' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($featureinfo_default)){
- $this->gui_wms_featureinfoformat = mb_strtolower($featureinfo_default);
- $featureinfo_default_ok = true;
- }
- if(mb_strtolower($this->data_type[$i]) == 'exception' && mb_strtolower($this->data_format[$i]) == mb_strtolower($exception_default)){
- $this->gui_wms_exceptionformat = mb_strtolower($exception_default);
- $exception_default_ok = true;
- }
- }
- if($map_default_ok == false){
- for($i=0;$i<count($this->data_format);$i++){
- if(mb_strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
- }
- }
- if($featureinfo_default_ok == false){
- for($i=0;$i<count($this->data_format);$i++){
- if(mb_strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
- }
- }
- if($exception_default_ok == false){
- for($i=0;$i<count($this->data_format);$i++){
- if(mb_strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
- }
- }
-
- if(count($this->objLayer[0]->layer_epsg)>1){
- $this->gui_wms_epsg = $this->objLayer[0]->layer_epsg[$this->default_epsg][epsg];
- }
- else{
- $this->gui_wms_epsg = $this->objLayer[0]->layer_epsg[0][epsg];
- }
- /*the queryable layers*/
- for($i=0; $i<count($this->objLayer); $i++){
- if($this->objLayer[$i]->layer_queryable == 1){
- $this->objLayer[$i]->gui_layer_queryable = 1;
- }
- else{
- $this->objLayer[$i]->gui_layer_queryable = 0;
- }
- }
- for($i=0; $i<count($this->objLayer); $i++){
- $this->objLayer[$i]->layer_pos=$i;
- }
-
- /* fill sld variables when empty */
- if($this->wms_supportsld == ""){
- $this->wms_supportsld = 0;
- }
- if($this->wms_userlayer == ""){
- $this->wms_userlayer = 0;
- }
- if($this->wms_userstyle == ""){
- $this->wms_userstyle = 0;
- }
- if($this->wms_remotewfs == ""){
- $this->wms_remotewfs = 0;
- }
- }
-
- function displayWMS(){
- echo "<br>id: " . $this->wms_id . " <br>";
- echo "version: " . $this->wms_version . " <br>";
- echo "title: " . $this->wms_title . " <br>";
- echo "abstract: " . $this->wms_abstract . " <br>";
- echo "maprequest: " . $this->wms_getmap . " <br>";
- echo "capabilitiesrequest: " . $this->wms_getcapabilities . " <br>";
- echo "featureinforequest: " . $this->wms_getfeatureinfo . " <br>";
- echo "gui_wms_mapformat: " . $this->gui_wms_mapformat . " <br>";
- echo "gui_wms_featureinfoformat: " . $this->gui_wms_featureinfoformat . " <br>";
- echo "gui_wms_exceptionformat: " . $this->gui_wms_exceptionformat . " <br>";
- echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
- echo "wms_srs: " . $this->objLayer[0]->wms_srs1 . " <br>";
- echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
- echo "gui_wms_opacity: " . $this->gui_wms_opacity . " <br>";
- echo "support_sld: " . $this->wms_supportsld . " <br>";
-
- for($i=0; $i<count($this->data_type);$i++){
- echo $this->data_type[$i]. " -> ".$this->data_format[$i]. "<br>";
- }
- for($i=0; $i<count($this->objLayer); $i++){
- echo "<hr>";
- echo "id: <b>".$this->objLayer[$i]->layer_id ."</b> parent: <b>".$this->objLayer[$i]->layer_parent."</b> name: <b>".$this->objLayer[$i]->layer_name;
- echo "</b> title: <b>".$this->objLayer[$i]->layer_title. "</b> queryable: <b>".$this->objLayer[$i]->layer_queryable."</b> minScale: <b>". $this->objLayer[$i]->layer_minscale."</b> maxScale: <b>".$this->objLayer[$i]->layer_maxscale."</b>";
- echo "<br>dataurl: <b>".$this->objLayer[$i]->layer_dataurl_href. "</b>";
- echo "<br>metadataurl: <b>".$this->objLayer[$i]->layer_metadataurl. "</b>";
- echo "<table border='1'>";
- for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
- echo "<tr><td>".$this->objLayer[$i]->layer_epsg[$j][epsg]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][minx]."</td>";
- echo "<td>".$this->objLayer[$i]->layer_epsg[$j][miny]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][maxx]."</td>";
- echo "<td>".$this->objLayer[$i]->layer_epsg[$j][maxy]."</td></tr>";
- }
- echo "</table>";
- echo "layerstyle:";
- echo "<table border='1'>";
- echo "<tr><td>name</td><td>title</td><td>legendurl</td><td>legendurlformat</td></tr>";
- for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
- echo "<tr><td>".$this->objLayer[$i]->layer_style[$j][name]."</td><td>".$this->objLayer[$i]->layer_style[$j][title]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurl]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurlformat]."</td></tr>";
- }
- echo "</table>";
- echo "<hr>";
- echo "<hr>";
- }
- }
- function addLayer($id,$parent){
- $this->objLayer[count($this->objLayer)] = new layer($id,$parent);
- }
- /**
- * private function
- */
- function stripEndlineAndCarriageReturn($string) {
- return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
- }
- function createJsObjFromWMS($parent=0){
- echo $this->createJsObjFromWMS_($parent);
- }
-
-
- function newLayer ($currentLayer, $currentExtent) {
- $pos = $currentLayer["extension"]["LAYER_POS"];
- $parent = $currentLayer["extension"]["LAYER_PARENT"];
- $this->addLayer($pos, $parent);
-
- // set layer data
- $layerIndex = count($this->objLayer) - 1;
- $newLayer = $this->objLayer[$layerIndex];
- $newLayer->layer_uid = $currentLayer["extension"]["LAYER_ID"];
- $newLayer->layer_name = $currentLayer["name"];
- $newLayer->layer_title = $currentLayer["title"];
- $newLayer->layer_dataurl_href = $currentLayer["dataurl"];
- $newLayer->layer_pos = $currentLayer["extension"]["LAYER_POS"];
- $newLayer->layer_queryable = $currentLayer["queryable"];
- $newLayer->layer_minscale = $currentLayer["extension"]["MINSCALE"];
- $newLayer->layer_maxscale = $currentLayer["extension"]["MAXSCALE"];
- $newLayer->layer_metadataurl = $currentLayer["metadataurl"];
- $newLayer->gui_layer_wms_id = $currentLayer["extension"]["WMS_ID"];
- $newLayer->gui_layer_status = $currentLayer["extension"]["GUI_STATUS"];
- $newLayer->gui_layer_style = ""; // TODO: Add correct data
- $newLayer->gui_layer_selectable = $currentLayer["extension"]["GUI_SELECTABLE"];
- if (isset($currentLayer["extension"]["OVERVIEWHIDDEN"])) {
- $newLayer->gui_layer_visible = ($currentLayer["extension"]["OVERVIEWHIDDEN"] === "1") ? false : true;
- }
- else {
- $newLayer->gui_layer_visible = $currentLayer["visible"];
- }
- $newLayer->gui_layer_queryable = $currentLayer["extension"]["GUI_QUERYABLE"];
- $newLayer->gui_layer_querylayer = $currentLayer["extension"]["QUERYLAYER"];
- $newLayer->gui_layer_minscale = $currentLayer["extension"]["GUI_MINSCALE"];
- $newLayer->gui_layer_maxscale = $currentLayer["extension"]["GUI_MAXSCALE"];
- if (isset($currentLayer["extension"]["WFSFEATURETYPE"])) {
- $newLayer->gui_layer_wfs_featuretype = $currentLayer["extension"]["WFSFEATURETYPE"];
- }
- $newLayer->layer_abstract = $currentLayer["abstract"];
-
- //
- // set layer epsg
- //
- $newLayer->layer_epsg = array();
- if ($currentLayer["extension"]["EPSG"]) {
- $layerEpsgArray = array();
- $layerMinXArray = array();
- $layerMinYArray = array();
- $layerMaxXArray = array();
- $layerMaxYArray = array();
- if (!is_array($currentLayer["extension"]["EPSG"])) {
- $layerEpsgArray[0] = $currentLayer["extension"]["EPSG"];
- $layerMinXArray[0] = $currentLayer["extension"]["MINX"];
- $layerMinYArray[0] = $currentLayer["extension"]["MINY"];
- $layerMaxXArray[0] = $currentLayer["extension"]["MAXX"];
- $layerMaxYArray[0] = $currentLayer["extension"]["MAXY"];
- }
- else {
- $layerEpsgArray = $currentLayer["extension"]["EPSG"];
- $layerMinXArray = $currentLayer["extension"]["MINX"];
- $layerMinYArray = $currentLayer["extension"]["MINY"];
- $layerMaxXArray = $currentLayer["extension"]["MAXX"];
- $layerMaxYArray = $currentLayer["extension"]["MAXY"];
- }
-
- for ($i=0; $i < count($layerEpsgArray); $i++) {
- $currentLayerEpsg = array();
- $currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
- $currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
- $currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]);
- $currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
- $currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
- array_push($newLayer->layer_epsg, $currentLayerEpsg);
- }
- }
-
-
- //
- // set layer style
- //
- for ($i = 0; $i < count($currentLayer["style"]); $i++) {
- $layerStyleIndex = count($newLayer->gui_layer_style) - 1;
- $newLayer->layer_style[$layerStyleIndex] = array();
- $newLayer->layer_style[$layerStyleIndex]["name"] = $currentLayer["style"][$i]["name"];
- $newLayer->layer_style[$layerStyleIndex]["title"] = $currentLayer["style"][$i]["title"];
- $newLayer->layer_style[$layerStyleIndex]["legendurl"] = $currentLayer["style"][$i]["legendurl"];
- $newLayer->layer_style[$layerStyleIndex]["legendurl_format"] = $currentLayer["style"][$i]["legendurl_type"];
- }
- }
-
- function createJsObjFromWMS_($parent=0){
- $str = "";
- if(!$this->wms_title || $this->wms_title == ""){
- $str .= "alert('Error: no valid capabilities-document !!');";
- die; exit;
- }
- if($parent){
- $str .= "parent.";
- }
- // wms_title and abstract have previously been urlencoded
- // this solution may not yet be the ultimate one
-
- $add_wms_string = "add_wms(" .
- "'" . $this->wms_id ."'," .
- "'" . $this->wms_version ."'," .
- "'" . addslashes($this->wms_title) . "'," .
- "'" . addslashes($this->wms_abstract) ."'," .
- "'" . $this->wms_getmap ."'," .
- "'" . $this->wms_getfeatureinfo ."'," .
- "'" . $this->wms_getlegendurl ."'," .
- "'" . $this->wms_filter ."'," .
- "'" . $this->gui_wms_mapformat . "'," .
- "'" . $this->gui_wms_featureinfoformat . "'," .
- "'" . $this->gui_wms_exceptionformat . "'," .
- "'" . $this->gui_wms_epsg ."'," .
- "'" . $this->gui_wms_visible ."'," .
- "'" . $this->gui_wms_opacity ."'," .
- "'" . $this->gui_wms_sldurl ."" .
- "');";
- $str .= $add_wms_string;
-
- for($i=0;$i<count($this->data_format);$i++){
- if($parent){
- $str .= "parent.";
- }
- $str .= "wms_add_data_type_format('". $this->data_type[$i] ."','". $this->data_format[$i] ."');";
- }
- for($i=0; $i<count($this->objLayer); $i++){
- if($parent){
- $str .= "parent.";
- }
- $str .= "wms_add_layer('".
- $this->objLayer[$i]->layer_parent ."','".
- $this->objLayer[$i]->layer_uid ."','".
- addslashes($this->objLayer[$i]->layer_name) . "','".
- addslashes($this->objLayer[$i]->layer_title) ."','".
- $this->objLayer[$i]->layer_dataurl_href ."','".
- $this->objLayer[$i]->layer_pos ."','".
- $this->objLayer[$i]->layer_queryable ."','".
- $this->objLayer[$i]->layer_minscale . "','".
- $this->objLayer[$i]->layer_maxscale ."','".
- $this->objLayer[$i]->layer_metadataurl ."','".
- $this->objLayer[$i]->gui_layer_wms_id ."','".
- $this->objLayer[$i]->gui_layer_status ."','".
- $this->objLayer[$i]->gui_layer_style ."','".
- $this->objLayer[$i]->gui_layer_selectable ."','".
- $this->objLayer[$i]->gui_layer_visible ."','".
- $this->objLayer[$i]->gui_layer_queryable ."','".
- $this->objLayer[$i]->gui_layer_querylayer ."','".
- $this->objLayer[$i]->gui_layer_minscale ."','".
- $this->objLayer[$i]->gui_layer_maxscale ."','".
- $this->objLayer[$i]->gui_layer_wfs_featuretype ."');";
-
- for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
- if($i==0){
- if($parent){
- $str .= "parent.";
- }
- $str .= "wms_addSRS('".
- $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');";
- }
- if($parent){
- $str .= "parent.";
- }
- $str .= "layer_addEpsg('".
- $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');";
- }
- for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
- if($parent){
- $str .= "parent.";
- }
- $str .= "wms_addLayerStyle('".$this->objLayer[$i]->layer_style[$j]["name"].
- "', '".$this->objLayer[$i]->layer_style[$j]["title"].
- "', ".$j.
- ",".$i.
- ",'".$this->objLayer[$i]->layer_style[$j]["legendurl"].
- "', '".$this->objLayer[$i]->layer_style[$j]["legendformat"]."');";
- }
- }
- return $str;
- }
-
- function createJsLayerObjFromWMS($parent=0, $layer_name){
- if(!$this->wms_title || $this->wms_title == ""){
- echo " alert('Error: no valid capabilities-document !!');";
- die; exit;
- }
- if($parent){
- echo "parent.";
- }
- // wms_title and abstract have previously been urlencoded
- // this solution may not yet be the ultimate one
- print("add_wms('".
- $this->wms_id ."','".
- $this->wms_version ."','".
- preg_replace("/'/", "", $this->wms_title) ."','".
- preg_replace("/'/", "", $this->wms_abstract) ."','".
- $this->wms_getmap ."','" .
- $this->wms_getfeatureinfo ."','".
- $this->wms_getlegendurl ."','".
- $this->wms_filter ."','".
- $this->gui_wms_mapformat ."','".
- $this->gui_wms_featureinfoformat ."','".
- $this->gui_wms_exceptionformat . "','".
- $this->gui_wms_epsg ."','".
- $this->gui_wms_visible ."','".
- $this->gui_wms_opacity ."','".
- $this->gui_wms_sldurl ."');");
-
- for($i=0;$i<count($this->data_format);$i++){
- if($parent){
- echo "parent.";
- }
- echo "wms_add_data_type_format('". $this->data_type[$i] ."','". $this->data_format[$i] ."');";
- }
- for($i=0; $i<count($this->objLayer); $i++){
- if($this->objLayer[$i]->layer_name == $layer_name|| $this->objLayer[$i]->layer_pos == 0){
-
- if($parent){
- echo "parent.";
- }
- print ("wms_add_layer('".
- $this->objLayer[$i]->layer_parent ."','".
- $this->objLayer[$i]->layer_uid ."','".
- $this->objLayer[$i]->layer_name . "','".
- addslashes($this->objLayer[$i]->layer_title) ."','".
- $this->objLayer[$i]->layer_dataurl_href ."','".
- $this->objLayer[$i]->layer_pos ."','".
- $this->objLayer[$i]->layer_queryable ."','".
- $this->objLayer[$i]->layer_minscale . "','".
- $this->objLayer[$i]->layer_maxscale ."','".
- $this->objLayer[$i]->layer_metadataurl ."','".
- $this->objLayer[$i]->gui_layer_wms_id ."','".
- $this->objLayer[$i]->gui_layer_status ."','".
- $this->objLayer[$i]->gui_layer_style ."','".
- $this->objLayer[$i]->gui_layer_selectable ."','".
- $this->objLayer[$i]->gui_layer_visible ."','".
- $this->objLayer[$i]->gui_layer_queryable ."','".
- $this->objLayer[$i]->gui_layer_querylayer ."','".
- $this->objLayer[$i]->gui_layer_minscale ."','".
- $this->objLayer[$i]->gui_layer_maxscale ."','".
- $this->objLayer[$i]->gui_layer_wfs_featuretype ."');");
- for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
- if($i==0){
- if($parent){
- echo "parent.";
- }
- print("wms_addSRS('".
- $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');");
- }
- if($parent){
- echo "parent.";
- }
- print("layer_addEpsg('".
- $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
- $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');");
- }
- for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
- if($parent){
- echo "parent.";
- }
- print("wms_addLayerStyle('".$this->objLayer[$i]->layer_style[$j]["name"]."', '".$this->objLayer[$i]->layer_style[$j]["title"]."', ".$j.",".$i.",'".$this->objLayer[$i]->layer_style[$j]["legendurl"]."', '".$this->objLayer[$i]->layer_style[$j]["legendformat"]."');");
- }
- }
- }
- }
-
-
- /**
- * writeObjInDB
- *
- * this function exports the information from the xml to the mapbender database
- */
- function writeObjInDB($gui_id){
- global $con;
- $admin = new administration();
-
- $this->checkObj();
- db_begin();
-
- # TABLE wms
- $sql = "INSERT INTO wms (wms_version, wms_title, wms_abstract, wms_getcapabilities, wms_getmap, ";
- $sql.= "wms_getfeatureinfo, wms_getlegendurl, wms_getcapabilities_doc, wms_upload_url, fees, ";
- $sql .= "accessconstraints, contactperson, contactposition, contactorganization, address, city, ";
- $sql .= "stateorprovince, postcode, country, contactvoicetelephone, contactfacsimiletelephone, contactelectronicmailaddress, ";
- $sql .= "wms_owner,wms_timestamp, ";
- $sql .= "wms_supportsld, wms_userlayer, wms_userstyle, wms_remotewfs) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28)";
- $v = array($this->wms_version,$this->wms_title,$this->wms_abstract,$this->wms_getcapabilities,
- $this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,$admin->char_encode($this->wms_getcapabilities_doc),
- $this->wms_upload_url,$this->fees,$this->accessconstraints,$this->contactperson,$this->contactposition,
- $this->contactorganization,$this->address,$this->city,$this->stateorprovince,$this->postcode,$this->country,
- $this->contactvoicetelephone,$this->contactfacsimiletelephone,$this->contactelectronicmailaddress,
- $_SESSION['mb_user_id'],strtotime("now"),
- $this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs );
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i','s','s','s','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
-
- $myWMS = db_insert_id($con,'wms', 'wms_id');
-
- # TABLE layer and gui_layer
-
- for($i=0; $i<count($this->objLayer); $i++){
- $this->insertLayer($i,$myWMS,$gui_id);
- $this->insertGuiLayer($i,$myWMS,$gui_id);
- }
-
-
- #TABLE wms_srs
- $this->insertSRS($myWMS);
-
- # TABLE wms_format
- $this->insertFormat($myWMS);
-
- # TABLE gui_wms
-
- $sql ="SELECT MAX(gui_wms_position) AS pos FROM gui_wms WHERE fkey_gui_id = $1";
- $v = array($gui_id);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
- if(db_result($res, 0,"pos") > -1){
- $position = db_result($res, 0,"pos") + 1;
- } else{ $position = 0; }
-
- $sql ="INSERT INTO gui_wms (fkey_gui_id, fkey_wms_id, gui_wms_position, gui_wms_mapformat, ";
- $sql .= "gui_wms_featureinfoformat, gui_wms_exceptionformat, gui_wms_epsg)";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7)";
- $v = array($gui_id,$myWMS,$position,$this->gui_wms_mapformat,$this->gui_wms_featureinfoformat,
- $this->gui_wms_exceptionformat,$this->gui_wms_epsg
- );
- $t = array('s','i','i','s','s','s','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- db_commit();
-
- #Changes JW
- $this->wms_id = $myWMS;
- }
- function insertLayer($i,$myWMS){
- global $con;
- $sql = "INSERT INTO layer(fkey_wms_id, layer_pos, layer_parent, layer_name, layer_title, ";
- $sql .= " layer_queryable, layer_minscale, layer_maxscale,layer_dataurl,layer_metadataurl,layer_abstract) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)";
- if($this->objLayer[$i]->layer_id != null){
- $tmpPos = $this->objLayer[$i]->layer_id;
- }
- else {
- $tmpPos .= 0;
- }
- if($this->objLayer[$i]->layer_parent == '' && $this->objLayer[$i]->layer_parent != '0'){
- $this->objLayer[$i]->layer_parent = '';
- }
- $v = array($myWMS,$tmpPos,$this->objLayer[$i]->layer_parent,$this->objLayer[$i]->layer_name,
- $this->objLayer[$i]->layer_title,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,
- $this->objLayer[$i]->layer_maxscale,$this->objLayer[$i]->layer_dataurl_href,
- $this->objLayer[$i]->layer_metadataurl,$this->objLayer[$i]->layer_abstract);
- $t = array('i','i','s','s','s','i','i','i','s','s','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- else {
- # save the id of each layer: set param2 true
- $this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
- $this->insertLayerEPSG($i);
-
- # TABLE layer_style for each layer
- $this->insertLayerStyle($i);
-
- # insert Keywords
- $this->insertLayerKeyword($i);
-
- }
- }
- function updateLayer($i,$myWMS){
- $sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
- $v = array($myWMS,$this->objLayer[$i]->layer_name);
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
- if($row = db_fetch_array($res)){
- $l_id = $row['layer_id'];
- }
- else{
- db_rollback();
- $e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name);
- return;
- }
-
- $sql = "UPDATE layer SET ";
- $sql .= "layer_pos = $1, ";
- $sql .= "layer_parent = $2, ";
- $sql .= "layer_title = $3, ";
- $sql .= "layer_queryable = $4, ";
- $sql .= "layer_minscale = $5, ";
- $sql .= "layer_maxscale = $6, ";
- $sql .= "layer_dataurl = $7, ";
- $sql .= "layer_metadataurl = $8, ";
- $sql .= "layer_abstract = $9 ";
- $sql .= "WHERE layer_id = $10";
-
- if($this->objLayer[$i]->layer_id != null){
- $tmpPos = $this->objLayer[$i]->layer_id;
- }
- else {
- $tmpPos .= 0;
- }
- if($this->objLayer[$i]->layer_parent == '' && $this->objLayer[$i]->layer_parent != '0'){
- $this->objLayer[$i]->layer_parent = '';
- }
- $v = array($tmpPos,$this->objLayer[$i]->layer_parent,
- $this->objLayer[$i]->layer_title,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,
- $this->objLayer[$i]->layer_maxscale,$this->objLayer[$i]->layer_dataurl_href,
- $this->objLayer[$i]->layer_metadataurl,$this->objLayer[$i]->layer_abstract, $l_id
- );
- $t = array('i','s','s','i','i','i','s','s','s','i');
- $res = db_prep_query($sql,$v,$t);
- if($this->overwrite == true){
- $sql = "UPDATE layer SET ";
- $sql .= "layer_title = $1, ";
- $sql .= "layer_abstract = $2 ";
- $sql .= "WHERE layer_id = $3";
-
- $v = array($this->objLayer[$i]->layer_title,$this->objLayer[$i]->layer_abstract, $l_id);
- $t = array('s','s','i');
- $res = db_prep_query($sql,$v,$t);
- }
- if(!$res){
- db_rollback();
- }
- else {
-
- # save the id of each layer: set param2 true
- $this->objLayer[$i]->db_id = $l_id;
- $this->insertLayerEPSG($i);
-
- # TABLE layer_style for each layer
- $this->insertLayerStyle($i);
- if($this->overwrite == true){
- $this->insertLayerKeyword($i);
- }
- }
- }
- function insertGuiLayer($i,$myWMS,$gui_id){
- # table gui_layer
-
- $sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
- $sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
- $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
- if(count($this->objLayer[$i]->layer_style)>0){
- $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
- }
- else{
- $layer_style_name = NULL;
- }
- $v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,1,1,1,$this->objLayer[$i]->layer_queryable,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
- $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
- $res = db_prep_query($sql,$v,$t);
- #$e = new mb_exception("name des insert styles und fkey_layer_id: ".$layer_style_name." --- ".$this->objLayer[$i]->db_id);
- if(!$res){
- db_rollback();
- }
- }
- function appendGuiLayer($i,$myWMS,$gui_id){
- # table gui_layer
-
- $sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
- $sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
- $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
- if(count($this->objLayer[$i]->layer_style)>0){
- $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
- }
- else{
- $layer_style_name = NULL;
- }
- $v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,0,0,0,$this->objLayer[$i]->layer_queryable,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
- $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
- function insertSRS($myWMS){
- for($i=0; $i<count($this->wms_srs);$i++){
- $sql ="INSERT INTO wms_srs (fkey_wms_id, wms_srs) values($1,$2)";
- $v = array($myWMS,mb_strtoupper($this->wms_srs[$i]));
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
- }
- function insertFormat($myWMS){
- for($i=0; $i<count($this->data_type);$i++){
- $sql ="INSERT INTO wms_format (fkey_wms_id, data_type, data_format) ";
- $sql .= " VALUES($1,$2,$3)";
- $v = array($myWMS,$this->data_type[$i],$this->data_format[$i]);
- $t = array('i','s','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
- }
- function insertLayerEPSG($i){
- $sql = "DELETE FROM layer_epsg WHERE fkey_layer_id = $1";
- $v = array($this->objLayer[$i]->db_id);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
- $sql = "INSERT INTO layer_epsg (fkey_layer_id, epsg, minx, miny, maxx, maxy) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6)";
- $v = array($this->objLayer[$i]->db_id,$this->objLayer[$i]->layer_epsg[$j][epsg],
- $this->objLayer[$i]->layer_epsg[$j][minx],$this->objLayer[$i]->layer_epsg[$j][miny],
- $this->objLayer[$i]->layer_epsg[$j][maxx],$this->objLayer[$i]->layer_epsg[$j][maxy]
- );
- $t = array('i','s','d','d','d','d');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
- }
- function insertLayerStyle($i){
- $sql = "DELETE FROM layer_style WHERE fkey_layer_id = $1";
- $v = array($this->objLayer[$i]->db_id);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
- $sql = "INSERT INTO layer_style (fkey_layer_id, name, title, legendurl, legendurlformat) ";
- $sql .= "VALUES($1,$2,$3,$4,$5)";
- $v = array($this->objLayer[$i]->db_id,$this->objLayer[$i]->layer_style[$j]["name"],
- $this->objLayer[$i]->layer_style[$j]["title"],$this->objLayer[$i]->layer_style[$j]["legendurl"],
- $this->objLayer[$i]->layer_style[$j]["legendurlformat"]
- );
- $t = array('i','s','s','s','s');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
- }
- function insertLayerKeyword($i){
- global $con;
- $sql = "DELETE FROM layer_keyword WHERE fkey_layer_id = $1";
- $v = array($this->objLayer[$i]->db_id);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
-
-// var_dump($this);
- $k = $this->objLayer[$i]->layer_keyword;
-// var_dump($k);
- for($j=0; $j<count($k); $j++){
- $keyword_id = "";
-
- while ($keyword_id == "") {
- $sql = "SELECT keyword_id FROM keyword WHERE UPPER(keyword) = UPPER($1)";
- $v = array($k[$j]);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
- $row = db_fetch_array($res);
- //print_r($row);
- if ($row) {
- $keyword_id = $row["keyword_id"];
- }
- else {
- $sql_insertKeyword = "INSERT INTO keyword (keyword)";
- $sql_insertKeyword .= "VALUES ($1)";
- $v1 = array($k[$j]);
- $t1 = array('s');
- $res_insertKeyword = db_prep_query($sql_insertKeyword,$v1,$t1);
- if(!$res_insertKeyword){
- db_rollback();
- }
- }
- }
-
- // check if layer/keyword combination already exists
- $sql_layerKeywordExists = "SELECT * FROM layer_keyword WHERE fkey_layer_id = $1 AND fkey_keyword_id = $2";
- $v = array($this->objLayer[$i]->db_id, $keyword_id);
- $t = array('i', 'i');
- $res_layerKeywordExists = db_prep_query($sql_layerKeywordExists, $v, $t);
- $row = db_fetch_array($res_layerKeywordExists);
- //print_r($row);
- if (!$row) {
- $sql1 = "INSERT INTO layer_keyword (fkey_keyword_id,fkey_layer_id)";
- $sql1 .= "VALUES ($1,$2)";
- $v1 = array($keyword_id,$this->objLayer[$i]->db_id);
- $t1 = array('i','i');
- $res1 = db_prep_query($sql1,$v1,$t1);
- if(!$res1){
- db_rollback();
- }
- }
- }
- }
- function updateObjInDB($myWMS){
- $admin = new administration();
- db_begin();
-
- $sql = "UPDATE wms SET ";
- $sql .= "wms_version = $1 ,";
- $sql .= "wms_getcapabilities = $2 ,";
- $sql .= "wms_getmap = $3 ,";
- $sql .= "wms_getfeatureinfo = $4 ,";
- $sql .= "wms_getlegendurl = $5 ,";
- $sql .= "wms_getcapabilities_doc = $6 ,";
- $sql .= "wms_upload_url = $7, ";
- $sql .= "wms_owner = $8, ";
- $sql .= "wms_timestamp = $9, ";
- $sql .= "wms_supportsld = $10, ";
- $sql .= "wms_userlayer = $11, ";
- $sql .= "wms_userstyle = $12, ";
- $sql .= "wms_remotewfs = $13 ";
- $sql .= " WHERE wms_id = $14";
-
- $v = array($this->wms_version,$this->wms_getcapabilities,
- $this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,
- $admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
- $this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$myWMS);
- $t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i');
-
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
-
- if($this->overwrite == true){
- $sql = "UPDATE wms SET ";
- $sql .= "wms_title = $1 ,";
- $sql .= "wms_abstract = $2 ,";
- $sql .= "fees = $3, ";
- $sql .= "accessconstraints = $4, ";
- $sql .= "contactperson = $5, ";
- $sql .= "contactposition = $6, ";
- $sql .= "contactorganization = $7, ";
- $sql .= "address = $8, ";
- $sql .= "city = $9, ";
- $sql .= "stateorprovince = $10, ";
- $sql .= "postcode = $11, ";
- $sql .= "country = $12, ";
- $sql .= "contactvoicetelephone = $13, ";
- $sql .= "contactfacsimiletelephone = $14, ";
- $sql .= "contactelectronicmailaddress = $15 ";
- $sql .= " WHERE wms_id = $16";
-
- $v = array($this->wms_title,$this->wms_abstract,$this->fees,$this->accessconstraints,
- $this->contactperson,$this->contactposition,$this->contactorganization,$this->address,
- $this->city,$this->stateorprovince,$this->postcode,$this->country,$this->contactvoicetelephone,
- $this->contactfacsimiletelephone,$this->contactelectronicmailaddress,$myWMS);
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- }
-
- # delete and refill srs and formats
- $sql = "DELETE FROM wms_srs WHERE fkey_wms_id = $1 ";
- $v = array($myWMS);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- $this->insertSRS($myWMS);
-
- $sql = "DELETE FROM wms_format WHERE fkey_wms_id = $1 ";
- $v = array($myWMS);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
- $this->insertFormat($myWMS);
-
- # update gui_wms
- $this->update_gui_wms($myWMS);
-
- # update TABLE layer
- # delete all layer which are outdated
- $v = array($myWMS);
- $t = array('i');
- $c = 2;
- $sql = "DELETE FROM layer WHERE fkey_wms_id = $1 AND NOT layer_name IN(";
- for($i=0; $i<count($this->objLayer); $i++){
- if($i>0){$sql .= ',';}
- $sql .= "$".$c;
- array_push($v,$this->objLayer[$i]->layer_name);
- array_push($t,'s');
- $c++;
- }
- $sql .= ")";
-
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- }
-
- # update or insert?
- $sql = "SELECT layer_name FROM layer WHERE fkey_wms_id = $1";
- $v = array($myWMS);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $exLayer = array();
- while($row = db_fetch_array($res)){
- array_push($exLayer,$row["layer_name"]);
- }
-
- $sql = "SELECT fkey_gui_id FROM gui_wms WHERE fkey_wms_id = $1";
- $v = array($myWMS);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $exGui = array();
- while($row = db_fetch_array($res)){
- array_push($exGui,$row["fkey_gui_id"]);
- }
-
- for($i=0; $i<count($this->objLayer); $i++){
- if(in_array($this->objLayer[$i]->layer_name,$exLayer)){
- //echo "<br>update: ".$this->objLayer[$i]->layer_name;
- $this->updateLayer($i,$myWMS);
- for($j=0; $j<count($exGui); $j++){
- $this->updateGuiLayer($i,$myWMS,$exGui[$j]);
- }
- }
- else{
- //echo "<br>append: ".$this->objLayer[$i]->layer_name;
- $this->insertLayer($i,$myWMS);
- for($j=0; $j<count($exGui); $j++){
- $this->appendGuiLayer($i,$myWMS,$exGui[$j]);
- }
- }
- }
- db_commit();
- return;
- }
- function updateGuiLayer($i,$myWMS,$gui_id){
- $sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
- $v = array($myWMS,$this->objLayer[$i]->layer_name);
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
- if($row = db_fetch_array($res)){
- $l_id = $row['layer_id'];
- }
- else{
- db_rollback();
- $e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name. " in gui: ".$gui_id);
- return;
- }
-
- $sql = "SELECT * FROM gui_layer WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
- $v = array($l_id,$gui_id);
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
- while($row = db_fetch_array($res)){
- if($this->objLayer[$i]->layer_queryable == 0){
- $sql1 = "UPDATE gui_layer set gui_layer_queryable = 0, gui_layer_querylayer = 0 ";
- $sql1 .= "WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
- $v = array($l_id,$gui_id);
- $t = array('i','s');
- $res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){
-
- db_rollback();
- }
- }
- if($this->objLayer[$i]->layer_queryable == 1){
- $sql1 = "UPDATE gui_layer set gui_layer_queryable = 1 ";
- $sql1 .= "WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
- $v = array($l_id,$gui_id);
- $t = array('i','s');
- $res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){
-
- db_rollback();
- }
- }
- if($row["gui_layer_minscale"] < $this->objLayer[$i]->layer_minscale){
- $sql1 = "UPDATE gui_layer set gui_layer_minscale = $1 ";
- $sql1 .= "WHERE fkey_layer_id = $2 and fkey_gui_id = $3";
- $v = array($this->objLayer[$i]->layer_minscale,$l_id,$gui_id);
- $t = array('i','i','s');
- $res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();
- }
- }
- if($row["gui_layer_maxscale"] > $this->objLayer[$i]->layer_maxscale){
- $sql1 = "UPDATE gui_layer set gui_layer_maxscale = $1 ";
- $sql1 .= "WHERE fkey_layer_id = $2 and fkey_gui_id = $3";
- $v = array($this->objLayer[$i]->layer_maxscale,$l_id,$gui_id);
- $t = array('i','i','s');
- $res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();
- }
- }
- }
- }
- function update_gui_wms($myWMS){
- $mySubmit = null;
- $sql = "SELECT * FROM gui_wms where fkey_wms_id = $1";
- $v = array($myWMS);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- unset($mySubmit);
- $myGUI[$cnt] = $row["fkey_gui_id"];
-
- $sql = "UPDATE gui_wms SET ";
- $v = array();
- $t = array();
- $paramCount = 0;
-
- for($i=0; $i<count($this->data_type); $i++){
- # gui_wms_mapformat
- if(mb_strtolower($this->data_type[$i]) == "map" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_mapformat"])){
- $myMapFormat = true;
- }
- # gui_wms_featureinfoformat
- if(mb_strtolower($this->data_type[$i]) == "featureinfo" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_featureinfoformat"])){
- $myFeatureInfoFormat = true;
- }
- # gui_wms_exceptionformat
- if(mb_strtolower($this->data_type[$i]) == "exception" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_exceptionformat"])){
- $myExceptionFormat = true;
- }
- }
- if(!$myMapFormat){
- $paramCount++;
- $sql .= "gui_wms_mapformat = $" . $paramCount . " ";
- $mySubmit = true;
- array_push($v, $this->gui_wms_mapformat);
- array_push($t, "s");
- }
- if(!$myFeatureInfoFormat){
- if($mySubmit){ $sql .= ",";}
- $paramCount++;
- $sql .= "gui_wms_featureinfoformat = $" . $paramCount . " ";
- array_push($v, $this->gui_wms_featureinfoformat);
- array_push($t, "s");
- $mySubmit = true;
- }
- if(!$myExceptionFormat){
- if($mySubmit){ $sql .= ",";}
- $paramCount++;
- $sql .= "gui_wms_exceptionformat = $" . $paramCount ." ";
- array_push($v, $this->gui_wms_exceptionformat);
- array_push($t, "s");
- $mySubmit = true;
- }
-
- # gui_wms_epsg
- for($j=0; $j<count($this->objLayer[0]->layer_epsg);$j++){
- if($this->objLayer[0]->layer_epsg[$j][epsg] == mb_strtoupper($row["gui_wms_epsg"])){
- $myGUI_EPSG = true;
- }
- }
- if(!$myGUI_EPSG){
- if($mySubmit){ $sql .= ",";}
- $paramCount++;
- $sql .= "gui_wms_epsg = $" . $paramCount . " ";
- array_push($v, $this->gui_wms_epsg);
- array_push($t, "s");
- $mySubmit = true;
- }
- $paramCount++;
- $sql .= " WHERE fkey_gui_id = $" . $paramCount . " ";
- array_push($v, $row["fkey_gui_id"]);
- array_push($t, "s");
-
- $paramCount++;
- $sql .= "AND fkey_wms_id = $" . $paramCount;
- array_push($v, $myWMS);
- array_push($t, "i");
- if($mySubmit){
- $res = db_prep_query($sql,$v,$t);
- if(!$res){
- db_rollback();
- echo "<pre>".$sql."</pre><br> <br><p>";
- echo db_error();
- echo "<br /> UPDATE ERROR -> KILL PROCESS AND ROLLBACK....................no update<br><br>";
- $e = new mb_exception("class_wms.php: transaction: Transaction aborted, rollback.");
- }
- }
- $cnt++;
- }
- }
- function getVersion() {
- return $this->wms_version;
- }
-
- function getCapabilities() {
- return $this->wms_getcapabilities;
- }
-
- function getCapabilitiesDoc() {
- return $this->wms_getcapabilities_doc;
- }
-
- /**
- * creatObjfromDB
- *
- */
- function createObjFromDB($gui_id,$wms_id){
-
- $sql = "Select * from gui_wms where fkey_wms_id = $1 AND fkey_gui_id = $2";
- $v = array($wms_id,$gui_id);
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
-
- $count=0;
- #$res_count=db_num_rows($res);
-
-
- while($row = db_fetch_array($res)){
- $this->gui_wms_mapformat=$row["gui_wms_mapformat"];
- $this->gui_wms_featureinfoformat=$row["gui_wms_featureinfoformat"];
- $this->gui_wms_exceptionformat=$row["gui_wms_exceptionformat"];
- $this->gui_wms_epsg=$row["gui_wms_epsg"];
- $this->gui_wms_visible = $row["gui_wms_visible"];
- $this->gui_wms_opacity = $row["gui_wms_opacity"];
- $this->gui_wms_sldurl = $row["gui_wms_sldurl"];
-
- $sql = "Select * from wms where wms_id = $1 ";
- $v = array($wms_id);
- $t = array('i');
- $res_wms = db_prep_query($sql,$v,$t);
- $count_wms=0;
- while($row2 = db_fetch_array($res_wms)){
- $this->wms_id = $row2["wms_id"];
- $this->wms_version = $row2["wms_version"];
- $this->wms_title = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_title"]));
- $this->wms_abstract = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_abstract"]));
- $wmsowsproxy = $row2["wms_owsproxy"];
- #$wmsowsproxy = "test";
- if($wmsowsproxy != ""){
- $owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
- $this->wms_getmap = $owsproxyurl;
- $this->wms_getcapabilities = $owsproxyurl;
- $this->wms_getfeatureinfo = $owsproxyurl;
- $this->wms_getlegendurl = $owsproxyurl;
- }
- else{
- $this->wms_getmap = $row2["wms_getmap"];
- $this->wms_getcapabilities = $row2["wms_getcapabilities"];
- $this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
- $this->wms_getlegendurl = $row2["wms_getlegendurl"];
- }
- // TO DO: Capabilities document needs to
- // be encoded to the original encoding
- // if different from the database encoding
- $this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
- $this->wms_filter = $row2["wms_filter"];
- $this->wms_supportsld = $row2["wms_supportsld"];
- $this->wms_userlayer = $row2["wms_userlayer"];
- $this->wms_userstyle = $row2["wms_userstyle"];
- $this->wms_remotewfs = $row2["wms_remotewfs"];
-
- $count_wms++;
- }
-
- ### formats
- $sql = "SELECT * FROM wms_format WHERE fkey_wms_id = $1 ";
- $v = array($wms_id);
- $t = array('i');
- $res_wms = db_prep_query($sql,$v,$t);
- $count_format=0;
- while($row3 = db_fetch_array($res_wms)){
- $this->data_type[$count_format] = $row3["data_type"];
- $this->data_format[$count_format] = $row3["data_format"];
- $count_format++;
- }
- $count++;
- }
-
- #layer
- $sql = "Select * from gui_layer where gui_layer_wms_id = $1 AND fkey_gui_id = $2 ";
- $sql .= " AND gui_layer_status = 1 ORDER BY gui_layer_priority;";
- $v = array($wms_id,$gui_id);
- $t = array('i','s');
- $res = db_prep_query($sql,$v,$t);
- $count=0;
-
- while($row = db_fetch_array($res)){
- $layer_id = $row["fkey_layer_id"];
- $sql = "Select * from layer where layer_id = $1";
- $v = array($layer_id);
- $t = array('i');
- $res_layer = db_prep_query($sql,$v,$t);
- $count_layer=0;
- while($row2 = db_fetch_array($res_layer)){
- $this->addLayer($row2["layer_pos"],$row2["layer_parent"]);
- $layer_cnt=count($this->objLayer)-1;
- $this->objLayer[$layer_cnt]->layer_uid = $layer_id;
- $this->objLayer[$layer_cnt]->layer_name = administration::convertIncomingString($row2["layer_name"]);
- $this->objLayer[$layer_cnt]->layer_title = administration::convertIncomingString($row2["layer_title"]);
- $this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
- $this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
- $this->objLayer[$layer_cnt]->layer_pos =$row2["layer_pos"];
- $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_pos"];
- $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_queryable"];
- $this->objLayer[$layer_cnt]->layer_minscale =$row2["layer_minscale"];
- $this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
- $count_layer++;
- }
- $this->objLayer[$layer_cnt]->layer_uid = $layer_id;
- $this->objLayer[$layer_cnt]->gui_layer_wms_id = $row["gui_layer_wms_id"];
- $this->objLayer[$layer_cnt]->gui_layer_selectable = $row["gui_layer_selectable"];
- $this->objLayer[$layer_cnt]->gui_layer_visible = $row["gui_layer_visible"];
- $this->objLayer[$layer_cnt]->gui_layer_queryable = $row["gui_layer_queryable"];
- $this->objLayer[$layer_cnt]->gui_layer_querylayer = $row["gui_layer_querylayer"];
- $this->objLayer[$layer_cnt]->gui_layer_minscale = $row["gui_layer_minscale"];
- $this->objLayer[$layer_cnt]->gui_layer_maxscale = $row["gui_layer_maxscale"];
- $this->objLayer[$layer_cnt]->gui_layer_style = $row["gui_layer_style"];
- $this->objLayer[$layer_cnt]->gui_layer_wfs_featuretype = $row["gui_layer_wfs_featuretype"];
-
- $sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
- $v = array($layer_id);
- $t = array('i');
- $res_layer_epsg = db_prep_query($sql,$v,$t);
-
- $count_layer_epsg=0;
- while($row2 = db_fetch_array($res_layer_epsg)){
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"]=$row2["epsg"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"]=$row2["minx"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"]=$row2["miny"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"]=$row2["maxx"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
- $count_layer_epsg++;
- }
-
- ### handle styles
- $sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
- $v = array($layer_id);
- $t = array('i');
- $res_style = db_prep_query($sql,$v,$t);
- $count_layer_style = 0;
- while($row2 = db_fetch_array($res_style)){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"] = $row2["name"] ? $row2["name"] : "default";
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
- if($wmsowsproxy != ""){
- if($row2["legendurl"]!=''){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
- "REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
- "&STYLE=".$row2["name"];
- }
- }
- else{
- if($row2["legendurl"]!=''){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
- #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
- }
- }
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
- $count_layer_style++;
- }
- $count++;
- }
- }
- /** end createObjfromDB **/
-
- /**
- * creatObjfromDBNoGui
- *
- */
- function createObjFromDBNoGui($wms_id){
-
- $sql = "Select * from wms where wms_id = $1 ";
- $v = array($wms_id);
- $t = array('i');
- $res_wms = db_prep_query($sql,$v,$t);
- $count_wms=0;
- while($row2 = db_fetch_array($res_wms)){
- $this->wms_id = $row2["wms_id"];
- $this->wms_version = $row2["wms_version"];
- $this->wms_title = $this->stripEndlineAndCarriageReturn($row2["wms_title"]);
- $this->wms_abstract = $this->stripEndlineAndCarriageReturn($row2["wms_abstract"]);
- $wmsowsproxy = $row2["wms_owsproxy"];
- #$wmsowsproxy = "test";
- if($wmsowsproxy != ""){
- $owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
- $this->wms_getmap = $owsproxyurl;
- $this->wms_getcapabilities = $owsproxyurl;
- $this->wms_getfeatureinfo = $owsproxyurl;
- $this->wms_getlegendurl = $owsproxyurl;
- }
- else{
- $this->wms_getmap = $row2["wms_getmap"];
- $this->wms_getcapabilities = $row2["wms_getcapabilities"];
- $this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
- $this->wms_getlegendurl = $row2["wms_getlegendurl"];
- }
- // TO DO: Capabilities document needs to
- // be encoded to the original encoding
- // if different from the database encoding
- $this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
- $this->wms_filter = $row2["wms_filter"];
- $this->wms_supportsld = $row2["wms_supportsld"];
- $this->wms_userlayer = $row2["wms_userlayer"];
- $this->wms_userstyle = $row2["wms_userstyle"];
- $this->wms_remotewfs = $row2["wms_remotewfs"];
-
- #some default
- $this->gui_wms_visible = 1;
- $this->gui_wms_opacity = 100;
- $this->gui_wms_epsg=$row["gui_wms_epsg"];
- $this->gui_wms_sldurl = $row["gui_wms_sldurl"];
-
- if($this->wms_version == "1.0.0"){
- $this->gui_wms_mapformat = "PNG";
- $this->gui_wms_featureinfoformat = "MIME";
- $this->gui_wms_exceptionformat = "INIMAGE";
- }
- /*define defaults for wms-version 1.1.0 and 1.1.1*/
- else{
- $this->gui_wms_mapformat = "image/png";
- $this->gui_wms_featureinfoformat = "text/html";
- $this->gui_wms_exceptionformat = "application/vnd.ogc.se_inimage";
- }
-
- $count_wms++;
- }
-
- ### formats
- $sql = "SELECT * FROM wms_format WHERE fkey_wms_id = $1 ";
- $v = array($wms_id);
- $t = array('i');
- $res_wms = db_prep_query($sql,$v,$t);
- $count_format=0;
- while($row3 = db_fetch_array($res_wms)){
- $this->data_type[$count_format] = $row3["data_type"];
- $this->data_format[$count_format] = $row3["data_format"];
- $count_format++;
- }
-
-
- $sql = "Select * from layer where fkey_wms_id = $1";
- $v = array($wms_id);
- $t = array('i');
- $res_layer = db_prep_query($sql,$v,$t);
- $count_layer=0;
- while($row2 = db_fetch_array($res_layer)){
- $this->addLayer($row2["layer_pos"],$row2["layer_parent"]);
- $layer_cnt=count($this->objLayer)-1;
- $this->objLayer[$layer_cnt]->layer_uid = $row2["layer_id"];
- $this->objLayer[$layer_cnt]->layer_name =$row2["layer_name"];
- $this->objLayer[$layer_cnt]->layer_title =$row2["layer_title"];
- $this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
- $this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
- $this->objLayer[$layer_cnt]->layer_pos =$row2["layer_pos"];
- $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_pos"];
- $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_queryable"];
- $this->objLayer[$layer_cnt]->layer_minscale =$row2["layer_minscale"];
- $this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
-
- if($this->objLayer[$layer_cnt]->layer_minscale == ""){
- $this->objLayer[$layer_cnt]->layer_minscale = 0;
- }
- if($this->objLayer[$layer_cnt]->layer_maxscale == ""){
- $this->objLayer[$layer_cnt]->layer_maxscale = 0;
- }
- $this->objLayer[$layer_cnt]->gui_layer_minscale = $this->objLayer[$layer_cnt]->layer_minscale;
- $this->objLayer[$layer_cnt]->gui_layer_maxscale = $this->objLayer[$layer_cnt]->layer_maxscale;
-
- $sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
- $v = array($this->objLayer[$layer_cnt]->layer_uid);
- $t = array('i');
- $res_layer_epsg = db_prep_query($sql,$v,$t);
-
- $count_layer_epsg=0;
- while($row2 = db_fetch_array($res_layer_epsg)){
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"]=$row2["epsg"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"]=$row2["minx"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"]=$row2["miny"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"]=$row2["maxx"];
- $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
- $count_layer_epsg++;
- }
-
- ### handle styles
- $sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
- $v = array($this->objLayer[$layer_cnt]->layer_uid);
- $t = array('i');
- $res_style = db_prep_query($sql,$v,$t);
- $count_layer_style = 0;
- while($row2 = db_fetch_array($res_style)){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"]=$row2["name"];
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
- if($wmsowsproxy != ""){
- if($row2["legendurl"]!=''){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
- "REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
- "&STYLE=".$row2["name"];
- }
- }
- else{
- if($row2["legendurl"]!=''){
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
- #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
- }
- }
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
- $count_layer_style++;
- }
-
- $count_layer++;
- }
-
- }
- /** end createObjfromDBNoGui **/
-
- /**
- * function checkObjExistsInDB()
- *
- * this function checks wether the onlineresource already exists in the database.
- */
- function checkObjExistsInDB(){
-
- $sql = "Select * from wms where wms_getcapabilities = $1";
- $v = array($this->wms_getcapabilities);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
- $res_count= db_num_rows($res);
- $wms_id=0;
- if($res_count>0){
- $count=0;
- while($row = db_fetch_array($res)){
- $wms_id=$row["wms_id"];
- $count++;
- }
- }
- return $wms_id;
- }
-
- function displayDBInformation(){
- echo $this->wms_getcapabilities;
- $sql="Select * from wms where wms_getcapabilities = $1";
- $v = array($this->wms_getcapabilities);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
- $count=0;
- while($row = db_fetch_array($res)){
- echo "count: ".$count."<br>";
- $wms_id=$row["wms_id"];
- echo "version: " .$wms_id." <br>";
- echo "title: " .$row["wms_version"]. " <br>";
- echo "abstract: " . $row["wms_title"] . " <br>";
- echo "maprequest: " .$row["wms_abstract"] . " <br>";
- echo "capabilitiesrequest: " . $row["wms_getcapabilities"] . " <br>";
- echo "featureinforequest: " . $row["wms_getmap"]. " <br>";
- echo "gui_wms_mapformat: " . $row["wms_getfeatureinfo"] . " <br>---------<br>";
- $count++;
- }
- echo "----<br> wms_id: ".$wms_id."<br>";
-
- $sql = "Select * from gui_wms where fkey_wms_id = $1";
- $v = array($wms_id);
- $t = array('i');
- echo "sql: ".$sql." <br>---------<br>";
- $res = db_prep_query($sql,$v,$t);
- $res_count= db_num_rows($res);
- echo "result count: ".$res_count." <br>---------<br>";
-
- $count=0;
- while($row = db_fetch_array($res)){
- echo "gui_wms_featureinfoformat: " . $row["gui_wms_featureinfoformat"]." <br>";
- echo "gui_wms_exceptionformat: " . $row["gui_wms_exceptionformat"]. " <br>";
- echo "gui_wms_epsg: " . $row["gui_wms_epsg"]. " <br>";
- $count++;
- }
-
- #db_close($connect);
- }
-
- function checkObj(){
- if($this->wms_getcapabilities == '' || $this->wms_getmap == '' ){
- echo "<br>Missing parameters: <br>";
- $this->displayWMS();
- print_r($this);
- echo "<br> Data not committed<br>";
- die();
- }
- }
-
- /**
- * Selects all WMS of the current user from the database.
- * Then it creates the corresponding WMS object and returns
- * these objects as an array.
- *
- * @return wms[]
- * @param $appId String
- */
- public static function selectMyWmsByApplication ($appId) {
- // check if user is permitted to access the application
- $currentUser = new User($_SESSION["mb_user_id"]);
- $appArray = $currentUser->getApplicationsByPermission(false);
- if (!in_array($appId, $appArray)) {
- $e = new mb_warning("class_wms.php: selectMyWmsByApplication(): User '" . $currentUser . "' is not allowed to acces application '" . $appId . "'.");
- return array();
- }
-
- // get WMS of this application
- $sql = "SELECT fkey_wms_id FROM gui_wms WHERE " .
- "fkey_gui_id = $1 ORDER BY gui_wms_position";
- $v = array($appId);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
-
- // instantiate PHP objects and store in array
- $wmsArray = array();
- while ($row = db_fetch_array($res)) {
- $currentWms = new wms();
- $currentWms->createObjFromDB($appId, $row["fkey_wms_id"]);
- array_push($wmsArray, $currentWms);
- }
- return $wmsArray;
- }
-}
-class layer extends wms {
- var $layer_id;
- var $layer_parent;
- var $layer_name;
- var $layer_title;
- var $layer_abstract;
- var $layer_pos;
- var $layer_queryable;
- var $layer_minscale;
- var $layer_maxscale;
- var $layer_dataurl_href;
- var $layer_metadataurl;
- var $layer_keyword = array();
- var $layer_epsg = array();
- var $layer_style = array();
-
- var $gui_layer_wms_id;
- var $gui_layer_status = 1;
- var $gui_layer_selectable = 1;
- var $gui_layer_visible = 0;
- var $gui_layer_queryable = 0;
- var $gui_layer_querylayer = 0;
- var $gui_layer_style = NULL;
-
- function layer($id,$parent){
- $this->layer_id = $id;
- $this->layer_parent = $parent;
- //var_dump($this);
- }
-
- public function __toString () {
- $e = new mb_exception("TITLE: " . $this->layer_title);
- return $this->layer_title;
- }
-
-}
-?>
Copied: branches/google_dev/trunk/http/classes/class_wms.php (from rev 3915, trunk/mapbender/http/classes/class_wms.php)
===================================================================
--- branches/google_dev/trunk/http/classes/class_wms.php (rev 0)
+++ branches/google_dev/trunk/http/classes/class_wms.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,2241 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wms
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_user.php");
+require_once(dirname(__FILE__)."/class_administration.php");
+
+class wms {
+ var $lastURL;
+ var $wms_id;
+ var $wms_status;
+ var $wms_version;
+ var $wms_title;
+ var $wms_abstract;
+ var $wms_getcapabilities;
+ var $wms_getcapabilities_doc;
+ var $wms_getmap;
+ var $wms_getfeatureinfo;
+ var $wms_getlegendurl;
+ var $wms_upload_url;
+
+ var $fees;
+ var $accessconstraints;
+ var $contactperson;
+ var $contactposition;
+ var $contactorganization;
+ var $address;
+ var $city;
+ var $stateorprovince;
+ var $postcode;
+ var $country;
+ var $contactvoicetelephone;
+ var $contactfacsimiletelephone;
+ var $contactelectronicmailaddress;
+
+ var $wms_keyword = array();
+ var $data_type = array();
+ var $data_format = array();
+ var $objLayer = array();
+
+ var $wms_supportsld;
+ var $wms_userlayer;
+ var $wms_userstyle;
+ var $wms_remotewfs;
+
+ var $gui_wms_mapformat;
+ var $gui_wms_featureinfoformat;
+ var $gui_wms_exceptionformat;
+ var $gui_wms_epsg;
+ var $gui_wms_sldurl;
+
+ var $default_epsg = 0;
+ var $overwrite = true;
+
+ function wms() {
+ }
+
+ public static function getConjunctionCharacter ($url) {
+ if (mb_strpos($url, "?") !== false) {
+ if (mb_substr($url, mb_strlen($url)-1, 1) == "?") {
+ return "";
+ }
+ else if (mb_substr($url, mb_strlen($url)-1, 1) == "&"){
+ return "";
+ }
+ else {
+ return "&";
+ }
+ }
+ else {
+ return "?";
+ }
+ return "";
+ }
+
+ function createOlObjFromWMS($base){
+ if(!$this->wms_title || $this->wms_title == ""){
+ echo "alert('Error: no valid capabilities-document !!');";
+ die; exit;
+ }
+ // wms_title and abstract have previously been urlencoded
+ // this solution may not yet be the ultimate one
+
+ $add_wms_string = "var wms_".$this->wms_id." = new OpenLayers.Layer.WMS.Untiled(" .
+ "'" . addslashes($this->wms_title) . "'," .
+ "'" . $this->wms_getmap ."'," ."{layers:'";
+ for($i=1;$i<count($this->objLayer);$i++){
+ $add_wms_string .= addslashes($this->objLayer[$i]->layer_name);
+ if($i!=count($this->objLayer)-1)
+ $add_wms_string .= ",";
+ }
+ $add_wms_string .= "', transparent: 'true'";
+ $add_wms_string .= ",format: '".$this->gui_wms_mapformat."'});";
+ if($base)
+ $add_wms_string .= "wms_".$this->wms_id.".isBaseLayer=true;";
+ $add_wms_string .= "wms_".$this->wms_id.".setVisibility(".($this->gui_wms_visible=="1"?"true":"false").");";
+ $add_wms_string .= "ol_map.addLayer(wms_".$this->wms_id.");";
+ echo $add_wms_string;
+ }
+
+ /**
+ * Compares this WMS to another WMS.
+ *
+ * @return boolean false, if
+ * - the capabilities URLs don't match
+ * - the layer count is different
+ * - the layer names are different
+ *
+ * @param $anotherWms wms this is just another WMS object
+ */
+ public function equals ($anotherWms) {
+ // If the getMap URLs are not equal, the WMS are not equal.
+ if ($this->wms_getmap != $anotherWms->wms_getmap) {
+// $e = new mb_notice($this . " != " . $anotherWms . " (getMap URL)");
+ return false;
+ }
+
+ // If the layer count is different, the WMS are not equal.
+ if (count($this->objLayer) != count($anotherWms->objLayer)) {
+// $e = new mb_notice($this . " != " . $anotherWms . " (layer count: " . count($this->objLayer) . ":" . count($anotherWms->objLayer). ")");
+ return false;
+ }
+
+ // If the layer names are different, the WMS are not equal.
+ for ($i = 0; $i < count($this->objLayer); $i++) {
+ $name1 = $this->objLayer[$i]->layer_name;
+ $name2 = $anotherWms->objLayer[$i]->layer_name;
+
+ if ($name1 != $name2) {
+// $e = new mb_notice($this . " != " . $anotherWms . " (layer names, " . $name1 . " vs. " . $name2 . ")");
+ return false;
+ }
+ }
+// $e = new mb_notice($this . " == " . $anotherWms);
+ return true;
+ }
+
+ /**
+ * The other WMS must be the same as this WMS, but with different
+ * application settings. These application settings are copied,
+ * the local settings are overwritten.
+ *
+ * @return boolean true if the settings could be copied; false
+ * when an error occured.
+ * @param $anotherWms wms The same WMS with possibly other settings
+ */
+/*
+ public function copyConfiguration ($anotherWms) {
+ if (!$this->equals($anotherWms)) {
+ $e = new mb_exception("class_wms.php: copyConfiguration(): parameters cannot be copied, it's a different WMS.");
+ return false;
+ }
+ for ($i = 0; $i < count($this->objLayer); $i++) {
+ $myCurrentLayer = $this->objLayer[$i];
+ $theirCurrentLayer = $anotherWms->objLayer[$i];
+
+ $myCurrentLayer->gui_layer_selectable = $theirCurrentLayer->gui_layer_selectable;
+ $myCurrentLayer->gui_layer_visible = $theirCurrentLayer->gui_layer_visible;
+ $myCurrentLayer->gui_layer_queryable = $theirCurrentLayer->gui_layer_queryable;
+ $myCurrentLayer->gui_layer_querylayer = $theirCurrentLayer->gui_layer_querylayer;
+ $myCurrentLayer->gui_layer_style = $theirCurrentLayer->gui_layer_style;
+ }
+ }
+*/
+
+ /**
+ * Removes duplicate WMS from an array of WMS. To find duplicates,
+ * two WMS are compared via equals().
+ *
+ * @return wms[]
+ * @param $wmsArray wms[]
+ */
+ public static function merge ($wmsArray) {
+ $e = new mb_notice("before: " . implode(", ", $wmsArray));
+ if (!is_array($wmsArray)) {
+ $e = new mb_exception("class_wms.php: merge(): parameter is NOT an array.");
+ return array();
+ }
+ if (count($wmsArray) == 0) {
+ $e = new mb_exception("class_wms.php: merge(): parameter is an EMPTY array.");
+ return array();
+ }
+
+ $newWmsArray = array();
+
+ while (count($wmsArray) > 0) {
+ $currentWms = array_pop($wmsArray);
+
+ $isNewWms = true;
+
+ if (get_class($currentWms) != "wms") {
+ $e = new mb_exception("class_wms.php: merge(): current WMS is not a WMS object, but a " . get_class($currentWms));
+ }
+ else {
+ for ($i = 0; $i < count($newWmsArray) && $isNewWms; $i++) {
+ if ($currentWms->equals($newWmsArray[$i])) {
+ $isNewWms = false;
+ }
+ }
+ if ($isNewWms) {
+// $e = new mb_notice("adding WMS " . $currentWms);
+ array_push($newWmsArray, $currentWms);
+ }
+ }
+ }
+ // reversal of the array, because the elements were popped
+ // from another array before.
+// $e = new mb_notice("after: " . implode(", ", array_reverse($newWmsArray)));
+ return array_reverse($newWmsArray);
+ }
+
+ private function formatExists ($type, $format) {
+ for ($i = 0; $i < count($this->data_type); $i++) {
+ if ($type == $this->data_type[$i] && $format == $this->data_format[$i]) {
+ $e = new mb_warning("WMS format already exists ($type, $format). Violation of WMS spec. Ignoring this WMS format.");
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function __toString () {
+ return $this->wms_title;
+ }
+
+ function createObjFromXML($url){
+
+ $x = new connector($url);
+ $data = $x->file;
+
+ if(!$data){
+ $this->wms_status = false;
+ return false;
+ }
+ else {
+ $this->wms_status = true;
+ }
+
+ $values = null;
+ $tags = null;
+ $admin = new administration();
+ $this->wms_getcapabilities_doc = $data;
+ $this->wms_upload_url = $url;
+
+ $this->wms_id = "";
+ $parser = xml_parser_create("");
+ xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
+ xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+ xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
+ xml_parse_into_struct($parser,$data,$values,$tags);
+
+ $code = xml_get_error_code($parser);
+ if ($code) {
+ $line = xml_get_current_line_number($parser);
+ $mb_exception = new mb_exception(xml_error_string($code) . " in line " . $line);
+ }
+
+ xml_parser_free($parser);
+
+ $section = null;
+ $format = null;
+ $cnt_format = 0;
+ $parent = array();
+ $myParent = array();
+ $cnt_layer = -1;
+ $request = null;
+ $layer_style = array();
+ $cnt_styles = -1;
+
+ $this->wms_getfeatureinfo = "";
+ $this->gui_wms_featureinfoformat = "";
+
+ foreach ($values as $element) {
+ if(mb_strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
+ $this->wms_version = $element[attributes][version];
+ }
+ if(mb_strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
+ $this->wms_title = $this->stripEndlineAndCarriageReturn($element[value]);
+ }
+ if(mb_strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
+ $this->wms_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
+ }
+ if(mb_strtolower($element[tag]) == "fees"){
+ $this->fees = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "accessconstraints"){
+ $this->accessconstraints = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactperson"){
+ $this->contactperson = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactposition"){
+ $this->contactposition = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactorganization"){
+ $this->contactorganization = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "address"){
+ $this->address = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "city"){
+ $this->city = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "stateorprovince"){
+ $this->stateorprovince = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "postcode"){
+ $this->postcode = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "country"){
+ $this->country = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactvoicetelephone"){
+ $this->contactvoicetelephone = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactfacsimiletelephone"){
+ $this->contactfacsimiletelephone = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "contactelectronicmailaddress"){
+ $this->contactelectronicmailaddress = $element[value];
+ }
+ if(mb_strtolower($element[tag]) == "keyword" && $section != 'layer'){
+ $this->wms_keyword[count($this->wms_keyword)] = $element[value];
+ }
+
+ /*map section*/
+ if($this->wms_version == "1.0.0"){
+ if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
+ $section = "map";
+ }
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET"){
+ $this->wms_getmap = $element[attributes][onlineResource];
+ }
+ if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ $format = "map";
+ }
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
+ if (!$this->formatExists("map", trim($element[tag]))) {
+ $this->data_type[$cnt_format] = "map";
+ $this->data_format[$cnt_format] = trim($element[tag]);
+ $cnt_format++;
+ }
+ }
+ if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ $format = "";
+ }
+ if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ else{
+ if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
+ $section = "map";
+ }
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ $request = "get";
+ }
+ if($section == "map" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->wms_getmap = $element[attributes]["xlink:href"];
+ }
+ if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT"){
+ if (!$this->formatExists("map", trim($element[value]))) {
+ $this->data_type[$cnt_format] = "map";
+ $this->data_format[$cnt_format] = trim($element[value]);
+ $cnt_format++;
+ }
+ }
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ $request = "";
+ }
+ if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ /*capabilities section*/
+ if($this->wms_version == "1.0.0"){
+ if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
+ $section = "capabilities";
+ }
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET"){
+ $this->wms_getcapabilities = $element[attributes][onlineResource];
+ }
+ if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ else{
+ if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
+ $section = "capabilities";
+ }
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ $request = "get";
+ }
+ if($section == "capabilities" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->wms_getcapabilities = $element[attributes]["xlink:href"];
+ }
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ $request = "";
+ }
+ if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ /*featureInfo section*/
+ if($this->wms_version == "1.0.0"){
+ if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
+ $section = "featureinfo";
+ }
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET"){
+ $this->wms_getfeatureinfo = $element[attributes][onlineResource];
+ }
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ $format = "featureinfo";
+ }
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
+ if (!$this->formatExists("featureinfo", trim($element[tag]))) {
+ $this->data_type[$cnt_format] = "featureinfo";
+ $this->data_format[$cnt_format] = trim($element[tag]);
+ $cnt_format++;
+ }
+ }
+ if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ $format = "";
+ }
+ if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ else{
+ if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
+ $section = "featureinfo";
+ }
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ $request = "get";
+ }
+ if($section == "featureinfo" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->wms_getfeatureinfo = $element[attributes]["xlink:href"];
+ }
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT"){
+ if (!$this->formatExists("featureinfo", trim($element[value]))) {
+ $this->data_type[$cnt_format] = "featureinfo";
+ $this->data_format[$cnt_format] = trim($element[value]);
+ $cnt_format++;
+ }
+ }
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ $request = "";
+ }
+ if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ /*exception section*/
+ if($this->wms_version == "1.0.0"){
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+ $section = "exception";
+ }
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ $format = "exception";
+ }
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
+ $this->data_type[$cnt_format] = "exception";
+ $this->data_format[$cnt_format] = trim($element[tag]);
+ $cnt_format++;
+ }
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ $format = "";
+ }
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ else{
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+ $section = "exception";
+ }
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT"){
+ $this->data_type[$cnt_format] = "exception";
+ $this->data_format[$cnt_format] = trim($element[value]);
+ $cnt_format++;
+ }
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ /*legend section*/
+ if($this->wms_version == "1.0.0"){
+
+ }
+ else{
+ if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
+ $section = "legend";
+ }
+ if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ $request = "get";
+ }
+ if($section == "legend" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->wms_getlegendurl = $element[attributes]["xlink:href"];
+ }
+ if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ $request = "";
+ }
+ if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
+ $section = "";
+ }
+ }
+ /* sld section */
+ if(mb_strtoupper($element[tag]) == "USERDEFINEDSYMBOLIZATION" && $element[type] == "complete"){
+ $this->wms_supportsld = $element[attributes]["SupportSLD"];
+ $this->wms_userlayer = $element[attributes]["UserLayer"];
+ $this->wms_userstyle = $element[attributes]["UserStyle"];
+ $this->wms_remotewfs = $element[attributes]["RemoteWFS"];
+ }
+
+ /*layer section*/
+ if(mb_strtoupper($element[tag]) == "LAYER"){
+ $section = "layer";
+ if ($element[type] == "open") {
+ $cnt_epsg = -1;
+ $cnt_layer++;
+ $parent[$element[level]+1] = $cnt_layer;
+ $myParent[$cnt_layer]= $parent[$element[level]];
+ $this->addLayer($cnt_layer,$myParent[$cnt_layer]);
+ $this->objLayer[$cnt_layer]->layer_queryable = $element[attributes][queryable];
+ }
+ if ($element[type] == "close") {
+
+ }
+ }
+ /* attribution */
+ if(mb_strtoupper($element[tag]) == "ATTRIBUTION"){
+ if ($element[type] == "open") {
+ $section = "attribution";
+ }
+ if ($element[type] == "close") {
+ $section = "layer";
+ }
+ }
+ /* styles */
+ if(mb_strtoupper($element[tag]) == "STYLE"){
+ $section = "style";
+ if($cnt_layer != $layer_style){
+ $layer_style = $cnt_layer;
+ $cnt_styles = -1;
+ }
+ if ($element[type] == "open") {
+ $cnt_styles++;
+ }
+ if ($element[type] == "close") {
+ $section = "layer";
+ }
+ }
+ if($section == "style"){
+ if(mb_strtoupper($element[tag]) == "NAME"){
+ $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = ($element[value] ? $element[value] : 'default');
+ }
+ if(mb_strtoupper($element[tag]) == "TITLE"){
+ $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["title"] = ($element[value] ? $element[value] : '');
+ }
+ if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
+ $legendurl = true;
+ }
+ if($legendurl && mb_strtoupper($element[tag]) == "FORMAT"){
+ $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurlformat"] = $element[value];
+ }
+ if($legendurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurl"] = $element[attributes]["xlink:href"];
+ }
+ if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
+ $legendurl = false;
+ }
+ }
+ /* end of styles */
+ if($section == "layer"){
+ if(mb_strtoupper($element[tag]) == "NAME"){
+ $this->objLayer[$cnt_layer]->layer_name = $element[value];
+ }
+ if(mb_strtoupper($element[tag]) == "TITLE"){
+ $this->objLayer[$cnt_layer]->layer_title = $this->stripEndlineAndCarriageReturn($element[value]);
+ }
+ if(mb_strtoupper($element[tag]) == "ABSTRACT"){
+ $this->objLayer[$cnt_layer]->layer_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
+ }
+ if(mb_strtoupper($element[tag]) == "KEYWORD"){
+ array_push($this->objLayer[$cnt_layer]->layer_keyword, trim($element[value]));
+ }
+ if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
+ $dataurl = true;
+ }
+ if($dataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->objLayer[$cnt_layer]->layer_dataurl_href = $element[attributes]["xlink:href"];
+ }
+ if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
+ $dataurl = false;
+ }
+
+ if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
+ $metadataurl = true;
+ }
+ if($metadataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
+ $this->objLayer[$cnt_layer]->layer_metadataurl = $element[attributes]["xlink:href"];
+ }
+ if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
+ $metadataurl = false;
+ }
+
+ if(mb_strtoupper($element[tag]) == "SRS"){
+ $this->objLayer[$cnt_layer]->wms_srs1 = $element[value];
+ // unique srs only, see http://www.mapbender.org/index.php/Arrays_with_unique_entries
+ $this->wms_srs = array_keys(array_flip(explode(" ", $this->objLayer[0]->wms_srs1)));
+ }
+ if(mb_strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
+ $cnt_epsg++;
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = "EPSG:4326";
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["miny"] = $element[attributes][miny];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
+ }
+ if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
+ $cnt_epsg++;
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][SRS];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["miny"] = $element[attributes][miny];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
+ $this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
+ // a default epsg for mapbender
+ if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][SRS]))>= 10){
+ $this->default_epsg = $cnt_epsg;
+ }
+ }
+ if(mb_strtoupper($element[tag]) == "SCALEHINT"){
+ if($element[attributes][max]>1000) $max = 0; else $max = $element[attributes][max];
+ if($element[attributes][min]>1000) $min = 0; else $min = $element[attributes][min];
+ $this->objLayer[$cnt_layer]->layer_minscale = round(($min * 2004.3976484406788493955738891127));
+ $this->objLayer[$cnt_layer]->layer_maxscale = round(($max * 2004.3976484406788493955738891127));
+ }
+ }
+ else {
+ continue;
+ }
+ }
+ if(!$this->wms_title || $this->wms_title == "" || !$this->wms_getmap || $this->wms_getmap == ""){
+ $this->wms_status = false;
+ $this->optimizeWMS();
+ $e = new mb_exception("class_wms: createObjFromXML: WMS " . $url . " could not be loaded.");
+ return false;
+ }
+ else{
+ $this->wms_status = true;
+ $this->optimizeWMS();
+ $e = new mb_notice("class_wms: createObjFromXML: WMS " . $url . " has been loaded successfully.");
+ return true;
+ }
+ }
+ /**
+ * private function
+ */
+ function optimizeWMS() {
+ /*define defaults for wms-version 1.0.0*/
+ $map_default_ok = false;
+ $featureinfo_default_ok = false;
+ $exception_default_ok = false;
+ if($this->wms_version == "1.0.0"){
+ $map_default = "PNG";
+ $featureinfo_default = "MIME";
+ $exception_default = "INIMAGE";
+ }
+ /*define defaults for wms-version 1.1.0 and 1.1.1*/
+ else{
+ $map_default = "image/png";
+ $featureinfo_default = "text/html";
+ $exception_default = "application/vnd.ogc.se_inimage";
+ }
+ #some default
+ $this->gui_wms_visible = 1;
+ $this->gui_wms_opacity = 100;
+ /*if the rootlayer has no epsg...*/
+ if($this->objLayer[0]->layer_epsg[0]["epsg"] == ""){
+ $this->objLayer[0]->layer_epsg = $this->objLayer[1]->layer_epsg;
+ for($i=0;$i<count($this->objLayer[0]->layer_epsg);$i++){
+ for($j=1; $j<count($this->objLayer); $j++){
+ if($this->objLayer[0]->layer_epsg[$i]["epsg"] == $this->objLayer[$j]->layer_epsg[$i]["epsg"]){
+ if($this->objLayer[$j]->layer_epsg[$i]["minx"]<$this->objLayer[0]->layer_epsg[$i]["minx"]){
+ $this->objLayer[0]->layer_epsg[$i]["minx"] = $this->objLayer[$j]->layer_epsg[$i]["minx"];
+ }
+ if($this->objLayer[$j]->layer_epsg[$i]["miny"]<$this->objLayer[0]->layer_epsg[$i]["miny"]){
+ $this->objLayer[0]->layer_epsg[$i]["miny"] = $this->objLayer[$j]->layer_epsg[$i]["miny"];
+ }
+ if($this->objLayer[$j]->layer_epsg[$i]["maxx"]>$this->objLayer[0]->layer_epsg[$i]["maxx"]){
+ $this->objLayer[0]->layer_epsg[$i]["maxx"] = $this->objLayer[$j]->layer_epsg[$i]["maxx"];
+ }
+ if($this->objLayer[$j]->layer_epsg[$i]["maxy"]>$this->objLayer[0]->layer_epsg[$i]["maxy"]){
+ $this->objLayer[0]->layer_epsg[$i]["maxy"] = $this->objLayer[$j]->layer_epsg[$i]["maxy"];
+ }
+ }
+ }
+ }
+ }
+ for($i=0;$i<count($this->objLayer);$i++){
+ if(count($this->objLayer[$i]->layer_epsg) == 0 && count($this->objLayer[0]->layer_epsg) > 0){
+ $this->objLayer[$i]->layer_epsg = $this->objLayer[0]->layer_epsg;
+ }
+ if(!is_int($this->objLayer[$i]->layer_parent)){
+ $this->objLayer[$i]->layer_abstract = $this->wms_abstract;
+ for ($r = 0; $r < count($this->wms_keyword); $r++) {
+ array_push($this->objLayer[$i]->layer_keyword, trim($this->wms_keyword[$r]));
+ }
+ }
+ if($this->objLayer[$i]->layer_name == ""){
+ $this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
+ }
+ if($this->objLayer[$i]->layer_minscale == ""){
+ $this->objLayer[$i]->layer_minscale = 0;
+ }
+ if($this->objLayer[$i]->layer_maxscale == ""){
+ $this->objLayer[$i]->layer_maxscale = 0;
+ }
+ if($this->objLayer[$i]->layer_queryable == ""){
+ $this->objLayer[$i]->layer_queryable = 0;
+ }
+ $this->objLayer[$i]->gui_layer_minscale = $this->objLayer[$i]->layer_minscale;
+ $this->objLayer[$i]->gui_layer_maxscale = $this->objLayer[$i]->layer_maxscale;
+ }
+ for($i=0;$i<count($this->data_format);$i++){
+ if(mb_strtolower($this->data_type[$i]) == 'map' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($map_default)){
+ $this->gui_wms_mapformat = mb_strtolower($map_default);
+ $map_default_ok = true;
+ }
+ if(mb_strtolower($this->data_type[$i]) == 'featureinfo' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($featureinfo_default)){
+ $this->gui_wms_featureinfoformat = mb_strtolower($featureinfo_default);
+ $featureinfo_default_ok = true;
+ }
+ if(mb_strtolower($this->data_type[$i]) == 'exception' && mb_strtolower($this->data_format[$i]) == mb_strtolower($exception_default)){
+ $this->gui_wms_exceptionformat = mb_strtolower($exception_default);
+ $exception_default_ok = true;
+ }
+ }
+ if($map_default_ok == false){
+ for($i=0;$i<count($this->data_format);$i++){
+ if(mb_strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
+ }
+ }
+ if($featureinfo_default_ok == false){
+ for($i=0;$i<count($this->data_format);$i++){
+ if(mb_strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
+ }
+ }
+ if($exception_default_ok == false){
+ for($i=0;$i<count($this->data_format);$i++){
+ if(mb_strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
+ }
+ }
+
+ if(count($this->objLayer[0]->layer_epsg)>1){
+ $this->gui_wms_epsg = $this->objLayer[0]->layer_epsg[$this->default_epsg][epsg];
+ }
+ else{
+ $this->gui_wms_epsg = $this->objLayer[0]->layer_epsg[0][epsg];
+ }
+ /*the queryable layers*/
+ for($i=0; $i<count($this->objLayer); $i++){
+ if($this->objLayer[$i]->layer_queryable == 1){
+ $this->objLayer[$i]->gui_layer_queryable = 1;
+ }
+ else{
+ $this->objLayer[$i]->gui_layer_queryable = 0;
+ }
+ }
+ for($i=0; $i<count($this->objLayer); $i++){
+ $this->objLayer[$i]->layer_pos=$i;
+ }
+
+ /* fill sld variables when empty */
+ if($this->wms_supportsld == ""){
+ $this->wms_supportsld = 0;
+ }
+ if($this->wms_userlayer == ""){
+ $this->wms_userlayer = 0;
+ }
+ if($this->wms_userstyle == ""){
+ $this->wms_userstyle = 0;
+ }
+ if($this->wms_remotewfs == ""){
+ $this->wms_remotewfs = 0;
+ }
+ }
+
+ function displayWMS(){
+ echo "<br>id: " . $this->wms_id . " <br>";
+ echo "version: " . $this->wms_version . " <br>";
+ echo "title: " . $this->wms_title . " <br>";
+ echo "abstract: " . $this->wms_abstract . " <br>";
+ echo "maprequest: " . $this->wms_getmap . " <br>";
+ echo "capabilitiesrequest: " . $this->wms_getcapabilities . " <br>";
+ echo "featureinforequest: " . $this->wms_getfeatureinfo . " <br>";
+ echo "gui_wms_mapformat: " . $this->gui_wms_mapformat . " <br>";
+ echo "gui_wms_featureinfoformat: " . $this->gui_wms_featureinfoformat . " <br>";
+ echo "gui_wms_exceptionformat: " . $this->gui_wms_exceptionformat . " <br>";
+ echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
+ echo "wms_srs: " . $this->objLayer[0]->wms_srs1 . " <br>";
+ echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
+ echo "gui_wms_opacity: " . $this->gui_wms_opacity . " <br>";
+ echo "support_sld: " . $this->wms_supportsld . " <br>";
+
+ for($i=0; $i<count($this->data_type);$i++){
+ echo $this->data_type[$i]. " -> ".$this->data_format[$i]. "<br>";
+ }
+ for($i=0; $i<count($this->objLayer); $i++){
+ echo "<hr>";
+ echo "id: <b>".$this->objLayer[$i]->layer_id ."</b> parent: <b>".$this->objLayer[$i]->layer_parent."</b> name: <b>".$this->objLayer[$i]->layer_name;
+ echo "</b> title: <b>".$this->objLayer[$i]->layer_title. "</b> queryable: <b>".$this->objLayer[$i]->layer_queryable."</b> minScale: <b>". $this->objLayer[$i]->layer_minscale."</b> maxScale: <b>".$this->objLayer[$i]->layer_maxscale."</b>";
+ echo "<br>dataurl: <b>".$this->objLayer[$i]->layer_dataurl_href. "</b>";
+ echo "<br>metadataurl: <b>".$this->objLayer[$i]->layer_metadataurl. "</b>";
+ echo "<table border='1'>";
+ for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
+ echo "<tr><td>".$this->objLayer[$i]->layer_epsg[$j][epsg]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][minx]."</td>";
+ echo "<td>".$this->objLayer[$i]->layer_epsg[$j][miny]."</td><td>".$this->objLayer[$i]->layer_epsg[$j][maxx]."</td>";
+ echo "<td>".$this->objLayer[$i]->layer_epsg[$j][maxy]."</td></tr>";
+ }
+ echo "</table>";
+ echo "layerstyle:";
+ echo "<table border='1'>";
+ echo "<tr><td>name</td><td>title</td><td>legendurl</td><td>legendurlformat</td></tr>";
+ for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
+ echo "<tr><td>".$this->objLayer[$i]->layer_style[$j][name]."</td><td>".$this->objLayer[$i]->layer_style[$j][title]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurl]."</td><td>".$this->objLayer[$i]->layer_style[$j][legendurlformat]."</td></tr>";
+ }
+ echo "</table>";
+ echo "<hr>";
+ echo "<hr>";
+ }
+ }
+ function addLayer($id,$parent){
+ $this->objLayer[count($this->objLayer)] = new layer($id,$parent);
+ }
+ /**
+ * private function
+ */
+ function stripEndlineAndCarriageReturn($string) {
+ return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
+ }
+ function createJsObjFromWMS($parent=0){
+ echo $this->createJsObjFromWMS_($parent);
+ }
+
+
+ function newLayer ($currentLayer, $currentExtent) {
+ $pos = $currentLayer["extension"]["LAYER_POS"];
+ $parent = $currentLayer["extension"]["LAYER_PARENT"];
+ $this->addLayer($pos, $parent);
+
+ // set layer data
+ $layerIndex = count($this->objLayer) - 1;
+ $newLayer = $this->objLayer[$layerIndex];
+ $newLayer->layer_uid = $currentLayer["extension"]["LAYER_ID"];
+ $newLayer->layer_name = $currentLayer["name"];
+ $newLayer->layer_title = $currentLayer["title"];
+ $newLayer->layer_dataurl_href = $currentLayer["dataurl"];
+ $newLayer->layer_pos = $currentLayer["extension"]["LAYER_POS"];
+ $newLayer->layer_queryable = $currentLayer["queryable"];
+ $newLayer->layer_minscale = $currentLayer["extension"]["MINSCALE"];
+ $newLayer->layer_maxscale = $currentLayer["extension"]["MAXSCALE"];
+ $newLayer->layer_metadataurl = $currentLayer["metadataurl"];
+ $newLayer->gui_layer_wms_id = $currentLayer["extension"]["WMS_ID"];
+ $newLayer->gui_layer_status = $currentLayer["extension"]["GUI_STATUS"];
+ $newLayer->gui_layer_style = ""; // TODO: Add correct data
+ $newLayer->gui_layer_selectable = $currentLayer["extension"]["GUI_SELECTABLE"];
+ if (isset($currentLayer["extension"]["OVERVIEWHIDDEN"])) {
+ $newLayer->gui_layer_visible = ($currentLayer["extension"]["OVERVIEWHIDDEN"] === "1") ? false : true;
+ }
+ else {
+ $newLayer->gui_layer_visible = $currentLayer["visible"];
+ }
+ $newLayer->gui_layer_queryable = $currentLayer["extension"]["GUI_QUERYABLE"];
+ $newLayer->gui_layer_querylayer = $currentLayer["extension"]["QUERYLAYER"];
+ $newLayer->gui_layer_minscale = $currentLayer["extension"]["GUI_MINSCALE"];
+ $newLayer->gui_layer_maxscale = $currentLayer["extension"]["GUI_MAXSCALE"];
+ if (isset($currentLayer["extension"]["WFSFEATURETYPE"])) {
+ $newLayer->gui_layer_wfs_featuretype = $currentLayer["extension"]["WFSFEATURETYPE"];
+ }
+ $newLayer->layer_abstract = $currentLayer["abstract"];
+
+ //
+ // set layer epsg
+ //
+ $newLayer->layer_epsg = array();
+ if ($currentLayer["extension"]["EPSG"]) {
+ $layerEpsgArray = array();
+ $layerMinXArray = array();
+ $layerMinYArray = array();
+ $layerMaxXArray = array();
+ $layerMaxYArray = array();
+ if (!is_array($currentLayer["extension"]["EPSG"])) {
+ $layerEpsgArray[0] = $currentLayer["extension"]["EPSG"];
+ $layerMinXArray[0] = $currentLayer["extension"]["MINX"];
+ $layerMinYArray[0] = $currentLayer["extension"]["MINY"];
+ $layerMaxXArray[0] = $currentLayer["extension"]["MAXX"];
+ $layerMaxYArray[0] = $currentLayer["extension"]["MAXY"];
+ }
+ else {
+ $layerEpsgArray = $currentLayer["extension"]["EPSG"];
+ $layerMinXArray = $currentLayer["extension"]["MINX"];
+ $layerMinYArray = $currentLayer["extension"]["MINY"];
+ $layerMaxXArray = $currentLayer["extension"]["MAXX"];
+ $layerMaxYArray = $currentLayer["extension"]["MAXY"];
+ }
+
+ for ($i=0; $i < count($layerEpsgArray); $i++) {
+ $currentLayerEpsg = array();
+ $currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
+ $currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
+ $currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]);
+ $currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
+ $currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+ array_push($newLayer->layer_epsg, $currentLayerEpsg);
+ }
+ }
+
+
+ //
+ // set layer style
+ //
+ for ($i = 0; $i < count($currentLayer["style"]); $i++) {
+ $layerStyleIndex = count($newLayer->gui_layer_style) - 1;
+ $newLayer->layer_style[$layerStyleIndex] = array();
+ $newLayer->layer_style[$layerStyleIndex]["name"] = $currentLayer["style"][$i]["name"];
+ $newLayer->layer_style[$layerStyleIndex]["title"] = $currentLayer["style"][$i]["title"];
+ $newLayer->layer_style[$layerStyleIndex]["legendurl"] = $currentLayer["style"][$i]["legendurl"];
+ $newLayer->layer_style[$layerStyleIndex]["legendurl_format"] = $currentLayer["style"][$i]["legendurl_type"];
+ }
+ }
+
+ function createJsObjFromWMS_($parent=0){
+ $str = "";
+ if(!$this->wms_title || $this->wms_title == ""){
+ $str .= "alert('Error: no valid capabilities-document !!');";
+ die; exit;
+ }
+ if($parent){
+ $str .= "parent.";
+ }
+ // wms_title and abstract have previously been urlencoded
+ // this solution may not yet be the ultimate one
+
+ $add_wms_string = "add_wms(" .
+ "'" . $this->wms_id ."'," .
+ "'" . $this->wms_version ."'," .
+ "'" . addslashes($this->wms_title) . "'," .
+ "'" . addslashes($this->wms_abstract) ."'," .
+ "'" . $this->wms_getmap ."'," .
+ "'" . $this->wms_getfeatureinfo ."'," .
+ "'" . $this->wms_getlegendurl ."'," .
+ "'" . $this->wms_filter ."'," .
+ "'" . $this->gui_wms_mapformat . "'," .
+ "'" . $this->gui_wms_featureinfoformat . "'," .
+ "'" . $this->gui_wms_exceptionformat . "'," .
+ "'" . $this->gui_wms_epsg ."'," .
+ "'" . $this->gui_wms_visible ."'," .
+ "'" . $this->gui_wms_opacity ."'," .
+ "'" . $this->gui_wms_sldurl ."" .
+ "');";
+ $str .= $add_wms_string;
+
+ for($i=0;$i<count($this->data_format);$i++){
+ if($parent){
+ $str .= "parent.";
+ }
+ $str .= "wms_add_data_type_format('". $this->data_type[$i] ."','". $this->data_format[$i] ."');";
+ }
+ for($i=0; $i<count($this->objLayer); $i++){
+ if($parent){
+ $str .= "parent.";
+ }
+ $str .= "wms_add_layer('".
+ $this->objLayer[$i]->layer_parent ."','".
+ $this->objLayer[$i]->layer_uid ."','".
+ addslashes($this->objLayer[$i]->layer_name) . "','".
+ addslashes($this->objLayer[$i]->layer_title) ."','".
+ $this->objLayer[$i]->layer_dataurl_href ."','".
+ $this->objLayer[$i]->layer_pos ."','".
+ $this->objLayer[$i]->layer_queryable ."','".
+ $this->objLayer[$i]->layer_minscale . "','".
+ $this->objLayer[$i]->layer_maxscale ."','".
+ $this->objLayer[$i]->layer_metadataurl ."','".
+ $this->objLayer[$i]->gui_layer_wms_id ."','".
+ $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_style ."','".
+ $this->objLayer[$i]->gui_layer_selectable ."','".
+ $this->objLayer[$i]->gui_layer_visible ."','".
+ $this->objLayer[$i]->gui_layer_queryable ."','".
+ $this->objLayer[$i]->gui_layer_querylayer ."','".
+ $this->objLayer[$i]->gui_layer_minscale ."','".
+ $this->objLayer[$i]->gui_layer_maxscale ."','".
+ $this->objLayer[$i]->gui_layer_wfs_featuretype ."');";
+
+ for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
+ if($i==0){
+ if($parent){
+ $str .= "parent.";
+ }
+ $str .= "wms_addSRS('".
+ $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');";
+ }
+ if($parent){
+ $str .= "parent.";
+ }
+ $str .= "layer_addEpsg('".
+ $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');";
+ }
+ for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
+ if($parent){
+ $str .= "parent.";
+ }
+ $str .= "wms_addLayerStyle('".$this->objLayer[$i]->layer_style[$j]["name"].
+ "', '".$this->objLayer[$i]->layer_style[$j]["title"].
+ "', ".$j.
+ ",".$i.
+ ",'".$this->objLayer[$i]->layer_style[$j]["legendurl"].
+ "', '".$this->objLayer[$i]->layer_style[$j]["legendformat"]."');";
+ }
+ }
+ return $str;
+ }
+
+ function createJsLayerObjFromWMS($parent=0, $layer_name){
+ if(!$this->wms_title || $this->wms_title == ""){
+ echo " alert('Error: no valid capabilities-document !!');";
+ die; exit;
+ }
+ if($parent){
+ echo "parent.";
+ }
+ // wms_title and abstract have previously been urlencoded
+ // this solution may not yet be the ultimate one
+ print("add_wms('".
+ $this->wms_id ."','".
+ $this->wms_version ."','".
+ preg_replace("/'/", "", $this->wms_title) ."','".
+ preg_replace("/'/", "", $this->wms_abstract) ."','".
+ $this->wms_getmap ."','" .
+ $this->wms_getfeatureinfo ."','".
+ $this->wms_getlegendurl ."','".
+ $this->wms_filter ."','".
+ $this->gui_wms_mapformat ."','".
+ $this->gui_wms_featureinfoformat ."','".
+ $this->gui_wms_exceptionformat . "','".
+ $this->gui_wms_epsg ."','".
+ $this->gui_wms_visible ."','".
+ $this->gui_wms_opacity ."','".
+ $this->gui_wms_sldurl ."');");
+
+ for($i=0;$i<count($this->data_format);$i++){
+ if($parent){
+ echo "parent.";
+ }
+ echo "wms_add_data_type_format('". $this->data_type[$i] ."','". $this->data_format[$i] ."');";
+ }
+ for($i=0; $i<count($this->objLayer); $i++){
+ if($this->objLayer[$i]->layer_name == $layer_name|| $this->objLayer[$i]->layer_pos == 0){
+
+ if($parent){
+ echo "parent.";
+ }
+ print ("wms_add_layer('".
+ $this->objLayer[$i]->layer_parent ."','".
+ $this->objLayer[$i]->layer_uid ."','".
+ $this->objLayer[$i]->layer_name . "','".
+ addslashes($this->objLayer[$i]->layer_title) ."','".
+ $this->objLayer[$i]->layer_dataurl_href ."','".
+ $this->objLayer[$i]->layer_pos ."','".
+ $this->objLayer[$i]->layer_queryable ."','".
+ $this->objLayer[$i]->layer_minscale . "','".
+ $this->objLayer[$i]->layer_maxscale ."','".
+ $this->objLayer[$i]->layer_metadataurl ."','".
+ $this->objLayer[$i]->gui_layer_wms_id ."','".
+ $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_style ."','".
+ $this->objLayer[$i]->gui_layer_selectable ."','".
+ $this->objLayer[$i]->gui_layer_visible ."','".
+ $this->objLayer[$i]->gui_layer_queryable ."','".
+ $this->objLayer[$i]->gui_layer_querylayer ."','".
+ $this->objLayer[$i]->gui_layer_minscale ."','".
+ $this->objLayer[$i]->gui_layer_maxscale ."','".
+ $this->objLayer[$i]->gui_layer_wfs_featuretype ."');");
+ for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
+ if($i==0){
+ if($parent){
+ echo "parent.";
+ }
+ print("wms_addSRS('".
+ $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');");
+ }
+ if($parent){
+ echo "parent.";
+ }
+ print("layer_addEpsg('".
+ $this->objLayer[$i]->layer_epsg[$j]["epsg"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["minx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["miny"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxx"] ."','".
+ $this->objLayer[$i]->layer_epsg[$j]["maxy"] ."');");
+ }
+ for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
+ if($parent){
+ echo "parent.";
+ }
+ print("wms_addLayerStyle('".$this->objLayer[$i]->layer_style[$j]["name"]."', '".$this->objLayer[$i]->layer_style[$j]["title"]."', ".$j.",".$i.",'".$this->objLayer[$i]->layer_style[$j]["legendurl"]."', '".$this->objLayer[$i]->layer_style[$j]["legendformat"]."');");
+ }
+ }
+ }
+ }
+
+
+ /**
+ * writeObjInDB
+ *
+ * this function exports the information from the xml to the mapbender database
+ */
+ function writeObjInDB($gui_id){
+ global $con;
+ $admin = new administration();
+
+ $this->checkObj();
+ db_begin();
+
+ # TABLE wms
+ $sql = "INSERT INTO wms (wms_version, wms_title, wms_abstract, wms_getcapabilities, wms_getmap, ";
+ $sql.= "wms_getfeatureinfo, wms_getlegendurl, wms_getcapabilities_doc, wms_upload_url, fees, ";
+ $sql .= "accessconstraints, contactperson, contactposition, contactorganization, address, city, ";
+ $sql .= "stateorprovince, postcode, country, contactvoicetelephone, contactfacsimiletelephone, contactelectronicmailaddress, ";
+ $sql .= "wms_owner,wms_timestamp, ";
+ $sql .= "wms_supportsld, wms_userlayer, wms_userstyle, wms_remotewfs) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28)";
+ $v = array($this->wms_version,$this->wms_title,$this->wms_abstract,$this->wms_getcapabilities,
+ $this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,$admin->char_encode($this->wms_getcapabilities_doc),
+ $this->wms_upload_url,$this->fees,$this->accessconstraints,$this->contactperson,$this->contactposition,
+ $this->contactorganization,$this->address,$this->city,$this->stateorprovince,$this->postcode,$this->country,
+ $this->contactvoicetelephone,$this->contactfacsimiletelephone,$this->contactelectronicmailaddress,
+ $_SESSION['mb_user_id'],strtotime("now"),
+ $this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs );
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i','s','s','s','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+
+ $myWMS = db_insert_id($con,'wms', 'wms_id');
+
+ # TABLE layer and gui_layer
+
+ for($i=0; $i<count($this->objLayer); $i++){
+ $this->insertLayer($i,$myWMS,$gui_id);
+ $this->insertGuiLayer($i,$myWMS,$gui_id);
+ }
+
+
+ #TABLE wms_srs
+ $this->insertSRS($myWMS);
+
+ # TABLE wms_format
+ $this->insertFormat($myWMS);
+
+ # TABLE gui_wms
+
+ $sql ="SELECT MAX(gui_wms_position) AS pos FROM gui_wms WHERE fkey_gui_id = $1";
+ $v = array($gui_id);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ if(db_result($res, 0,"pos") > -1){
+ $position = db_result($res, 0,"pos") + 1;
+ } else{ $position = 0; }
+
+ $sql ="INSERT INTO gui_wms (fkey_gui_id, fkey_wms_id, gui_wms_position, gui_wms_mapformat, ";
+ $sql .= "gui_wms_featureinfoformat, gui_wms_exceptionformat, gui_wms_epsg)";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7)";
+ $v = array($gui_id,$myWMS,$position,$this->gui_wms_mapformat,$this->gui_wms_featureinfoformat,
+ $this->gui_wms_exceptionformat,$this->gui_wms_epsg
+ );
+ $t = array('s','i','i','s','s','s','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ db_commit();
+
+ #Changes JW
+ $this->wms_id = $myWMS;
+ }
+ function insertLayer($i,$myWMS){
+ global $con;
+ $sql = "INSERT INTO layer(fkey_wms_id, layer_pos, layer_parent, layer_name, layer_title, ";
+ $sql .= " layer_queryable, layer_minscale, layer_maxscale,layer_dataurl,layer_metadataurl,layer_abstract) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)";
+ if($this->objLayer[$i]->layer_id != null){
+ $tmpPos = $this->objLayer[$i]->layer_id;
+ }
+ else {
+ $tmpPos .= 0;
+ }
+ if($this->objLayer[$i]->layer_parent == '' && $this->objLayer[$i]->layer_parent != '0'){
+ $this->objLayer[$i]->layer_parent = '';
+ }
+ $v = array($myWMS,$tmpPos,$this->objLayer[$i]->layer_parent,$this->objLayer[$i]->layer_name,
+ $this->objLayer[$i]->layer_title,
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,
+ $this->objLayer[$i]->layer_maxscale,$this->objLayer[$i]->layer_dataurl_href,
+ $this->objLayer[$i]->layer_metadataurl,$this->objLayer[$i]->layer_abstract);
+ $t = array('i','i','s','s','s','i','i','i','s','s','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ else {
+ # save the id of each layer: set param2 true
+ $this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
+ $this->insertLayerEPSG($i);
+
+ # TABLE layer_style for each layer
+ $this->insertLayerStyle($i);
+
+ # insert Keywords
+ $this->insertLayerKeyword($i);
+
+ }
+ }
+ function updateLayer($i,$myWMS){
+ $sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
+ $v = array($myWMS,$this->objLayer[$i]->layer_name);
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+ if($row = db_fetch_array($res)){
+ $l_id = $row['layer_id'];
+ }
+ else{
+ db_rollback();
+ $e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name);
+ return;
+ }
+
+ $sql = "UPDATE layer SET ";
+ $sql .= "layer_pos = $1, ";
+ $sql .= "layer_parent = $2, ";
+ $sql .= "layer_title = $3, ";
+ $sql .= "layer_queryable = $4, ";
+ $sql .= "layer_minscale = $5, ";
+ $sql .= "layer_maxscale = $6, ";
+ $sql .= "layer_dataurl = $7, ";
+ $sql .= "layer_metadataurl = $8, ";
+ $sql .= "layer_abstract = $9 ";
+ $sql .= "WHERE layer_id = $10";
+
+ if($this->objLayer[$i]->layer_id != null){
+ $tmpPos = $this->objLayer[$i]->layer_id;
+ }
+ else {
+ $tmpPos .= 0;
+ }
+ if($this->objLayer[$i]->layer_parent == '' && $this->objLayer[$i]->layer_parent != '0'){
+ $this->objLayer[$i]->layer_parent = '';
+ }
+ $v = array($tmpPos,$this->objLayer[$i]->layer_parent,
+ $this->objLayer[$i]->layer_title,
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,
+ $this->objLayer[$i]->layer_maxscale,$this->objLayer[$i]->layer_dataurl_href,
+ $this->objLayer[$i]->layer_metadataurl,$this->objLayer[$i]->layer_abstract, $l_id
+ );
+ $t = array('i','s','s','i','i','i','s','s','s','i');
+ $res = db_prep_query($sql,$v,$t);
+ if($this->overwrite == true){
+ $sql = "UPDATE layer SET ";
+ $sql .= "layer_title = $1, ";
+ $sql .= "layer_abstract = $2 ";
+ $sql .= "WHERE layer_id = $3";
+
+ $v = array($this->objLayer[$i]->layer_title,$this->objLayer[$i]->layer_abstract, $l_id);
+ $t = array('s','s','i');
+ $res = db_prep_query($sql,$v,$t);
+ }
+ if(!$res){
+ db_rollback();
+ }
+ else {
+
+ # save the id of each layer: set param2 true
+ $this->objLayer[$i]->db_id = $l_id;
+ $this->insertLayerEPSG($i);
+
+ # TABLE layer_style for each layer
+ $this->insertLayerStyle($i);
+ if($this->overwrite == true){
+ $this->insertLayerKeyword($i);
+ }
+ }
+ }
+ function insertGuiLayer($i,$myWMS,$gui_id){
+ # table gui_layer
+
+ $sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
+ $sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
+ $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
+ if(count($this->objLayer[$i]->layer_style)>0){
+ $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
+ }
+ else{
+ $layer_style_name = NULL;
+ }
+ $v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,1,1,1,$this->objLayer[$i]->layer_queryable,
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
+ $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
+ $res = db_prep_query($sql,$v,$t);
+ #$e = new mb_exception("name des insert styles und fkey_layer_id: ".$layer_style_name." --- ".$this->objLayer[$i]->db_id);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ function appendGuiLayer($i,$myWMS,$gui_id){
+ # table gui_layer
+
+ $sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
+ $sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
+ $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
+ if(count($this->objLayer[$i]->layer_style)>0){
+ $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
+ }
+ else{
+ $layer_style_name = NULL;
+ }
+ $v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,0,0,0,$this->objLayer[$i]->layer_queryable,
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
+ $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ function insertSRS($myWMS){
+ for($i=0; $i<count($this->wms_srs);$i++){
+ $sql ="INSERT INTO wms_srs (fkey_wms_id, wms_srs) values($1,$2)";
+ $v = array($myWMS,mb_strtoupper($this->wms_srs[$i]));
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ }
+ function insertFormat($myWMS){
+ for($i=0; $i<count($this->data_type);$i++){
+ $sql ="INSERT INTO wms_format (fkey_wms_id, data_type, data_format) ";
+ $sql .= " VALUES($1,$2,$3)";
+ $v = array($myWMS,$this->data_type[$i],$this->data_format[$i]);
+ $t = array('i','s','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ }
+ function insertLayerEPSG($i){
+ $sql = "DELETE FROM layer_epsg WHERE fkey_layer_id = $1";
+ $v = array($this->objLayer[$i]->db_id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
+ $sql = "INSERT INTO layer_epsg (fkey_layer_id, epsg, minx, miny, maxx, maxy) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6)";
+ $v = array($this->objLayer[$i]->db_id,$this->objLayer[$i]->layer_epsg[$j][epsg],
+ $this->objLayer[$i]->layer_epsg[$j][minx],$this->objLayer[$i]->layer_epsg[$j][miny],
+ $this->objLayer[$i]->layer_epsg[$j][maxx],$this->objLayer[$i]->layer_epsg[$j][maxy]
+ );
+ $t = array('i','s','d','d','d','d');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ }
+ function insertLayerStyle($i){
+ $sql = "DELETE FROM layer_style WHERE fkey_layer_id = $1";
+ $v = array($this->objLayer[$i]->db_id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ for($j=0; $j<count($this->objLayer[$i]->layer_style);$j++){
+ $sql = "INSERT INTO layer_style (fkey_layer_id, name, title, legendurl, legendurlformat) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5)";
+ $v = array($this->objLayer[$i]->db_id,$this->objLayer[$i]->layer_style[$j]["name"],
+ $this->objLayer[$i]->layer_style[$j]["title"],$this->objLayer[$i]->layer_style[$j]["legendurl"],
+ $this->objLayer[$i]->layer_style[$j]["legendurlformat"]
+ );
+ $t = array('i','s','s','s','s');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+ }
+ function insertLayerKeyword($i){
+ global $con;
+ $sql = "DELETE FROM layer_keyword WHERE fkey_layer_id = $1";
+ $v = array($this->objLayer[$i]->db_id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+
+// var_dump($this);
+ $k = $this->objLayer[$i]->layer_keyword;
+// var_dump($k);
+ for($j=0; $j<count($k); $j++){
+ $keyword_id = "";
+
+ while ($keyword_id == "") {
+ $sql = "SELECT keyword_id FROM keyword WHERE UPPER(keyword) = UPPER($1)";
+ $v = array($k[$j]);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ $row = db_fetch_array($res);
+ //print_r($row);
+ if ($row) {
+ $keyword_id = $row["keyword_id"];
+ }
+ else {
+ $sql_insertKeyword = "INSERT INTO keyword (keyword)";
+ $sql_insertKeyword .= "VALUES ($1)";
+ $v1 = array($k[$j]);
+ $t1 = array('s');
+ $res_insertKeyword = db_prep_query($sql_insertKeyword,$v1,$t1);
+ if(!$res_insertKeyword){
+ db_rollback();
+ }
+ }
+ }
+
+ // check if layer/keyword combination already exists
+ $sql_layerKeywordExists = "SELECT * FROM layer_keyword WHERE fkey_layer_id = $1 AND fkey_keyword_id = $2";
+ $v = array($this->objLayer[$i]->db_id, $keyword_id);
+ $t = array('i', 'i');
+ $res_layerKeywordExists = db_prep_query($sql_layerKeywordExists, $v, $t);
+ $row = db_fetch_array($res_layerKeywordExists);
+ //print_r($row);
+ if (!$row) {
+ $sql1 = "INSERT INTO layer_keyword (fkey_keyword_id,fkey_layer_id)";
+ $sql1 .= "VALUES ($1,$2)";
+ $v1 = array($keyword_id,$this->objLayer[$i]->db_id);
+ $t1 = array('i','i');
+ $res1 = db_prep_query($sql1,$v1,$t1);
+ if(!$res1){
+ db_rollback();
+ }
+ }
+ }
+ }
+ function updateObjInDB($myWMS){
+ $admin = new administration();
+ db_begin();
+
+ $sql = "UPDATE wms SET ";
+ $sql .= "wms_version = $1 ,";
+ $sql .= "wms_getcapabilities = $2 ,";
+ $sql .= "wms_getmap = $3 ,";
+ $sql .= "wms_getfeatureinfo = $4 ,";
+ $sql .= "wms_getlegendurl = $5 ,";
+ $sql .= "wms_getcapabilities_doc = $6 ,";
+ $sql .= "wms_upload_url = $7, ";
+ $sql .= "wms_owner = $8, ";
+ $sql .= "wms_timestamp = $9, ";
+ $sql .= "wms_supportsld = $10, ";
+ $sql .= "wms_userlayer = $11, ";
+ $sql .= "wms_userstyle = $12, ";
+ $sql .= "wms_remotewfs = $13 ";
+ $sql .= " WHERE wms_id = $14";
+
+ $v = array($this->wms_version,$this->wms_getcapabilities,
+ $this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,
+ $admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
+ $this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$myWMS);
+ $t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i');
+
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+
+ if($this->overwrite == true){
+ $sql = "UPDATE wms SET ";
+ $sql .= "wms_title = $1 ,";
+ $sql .= "wms_abstract = $2 ,";
+ $sql .= "fees = $3, ";
+ $sql .= "accessconstraints = $4, ";
+ $sql .= "contactperson = $5, ";
+ $sql .= "contactposition = $6, ";
+ $sql .= "contactorganization = $7, ";
+ $sql .= "address = $8, ";
+ $sql .= "city = $9, ";
+ $sql .= "stateorprovince = $10, ";
+ $sql .= "postcode = $11, ";
+ $sql .= "country = $12, ";
+ $sql .= "contactvoicetelephone = $13, ";
+ $sql .= "contactfacsimiletelephone = $14, ";
+ $sql .= "contactelectronicmailaddress = $15 ";
+ $sql .= " WHERE wms_id = $16";
+
+ $v = array($this->wms_title,$this->wms_abstract,$this->fees,$this->accessconstraints,
+ $this->contactperson,$this->contactposition,$this->contactorganization,$this->address,
+ $this->city,$this->stateorprovince,$this->postcode,$this->country,$this->contactvoicetelephone,
+ $this->contactfacsimiletelephone,$this->contactelectronicmailaddress,$myWMS);
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+
+ # delete and refill srs and formats
+ $sql = "DELETE FROM wms_srs WHERE fkey_wms_id = $1 ";
+ $v = array($myWMS);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ $this->insertSRS($myWMS);
+
+ $sql = "DELETE FROM wms_format WHERE fkey_wms_id = $1 ";
+ $v = array($myWMS);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ $this->insertFormat($myWMS);
+
+ # update gui_wms
+ $this->update_gui_wms($myWMS);
+
+ # update TABLE layer
+ # delete all layer which are outdated
+ $v = array($myWMS);
+ $t = array('i');
+ $c = 2;
+ $sql = "DELETE FROM layer WHERE fkey_wms_id = $1 AND NOT layer_name IN(";
+ for($i=0; $i<count($this->objLayer); $i++){
+ if($i>0){$sql .= ',';}
+ $sql .= "$".$c;
+ array_push($v,$this->objLayer[$i]->layer_name);
+ array_push($t,'s');
+ $c++;
+ }
+ $sql .= ")";
+
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+
+ # update or insert?
+ $sql = "SELECT layer_name FROM layer WHERE fkey_wms_id = $1";
+ $v = array($myWMS);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $exLayer = array();
+ while($row = db_fetch_array($res)){
+ array_push($exLayer,$row["layer_name"]);
+ }
+
+ $sql = "SELECT fkey_gui_id FROM gui_wms WHERE fkey_wms_id = $1";
+ $v = array($myWMS);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $exGui = array();
+ while($row = db_fetch_array($res)){
+ array_push($exGui,$row["fkey_gui_id"]);
+ }
+
+ for($i=0; $i<count($this->objLayer); $i++){
+ if(in_array($this->objLayer[$i]->layer_name,$exLayer)){
+ //echo "<br>update: ".$this->objLayer[$i]->layer_name;
+ $this->updateLayer($i,$myWMS);
+ for($j=0; $j<count($exGui); $j++){
+ $this->updateGuiLayer($i,$myWMS,$exGui[$j]);
+ }
+ }
+ else{
+ //echo "<br>append: ".$this->objLayer[$i]->layer_name;
+ $this->insertLayer($i,$myWMS);
+ for($j=0; $j<count($exGui); $j++){
+ $this->appendGuiLayer($i,$myWMS,$exGui[$j]);
+ }
+ }
+ }
+ db_commit();
+ return;
+ }
+ function updateGuiLayer($i,$myWMS,$gui_id){
+ $sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
+ $v = array($myWMS,$this->objLayer[$i]->layer_name);
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+ if($row = db_fetch_array($res)){
+ $l_id = $row['layer_id'];
+ }
+ else{
+ db_rollback();
+ $e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name. " in gui: ".$gui_id);
+ return;
+ }
+
+ $sql = "SELECT * FROM gui_layer WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
+ $v = array($l_id,$gui_id);
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ if($this->objLayer[$i]->layer_queryable == 0){
+ $sql1 = "UPDATE gui_layer set gui_layer_queryable = 0, gui_layer_querylayer = 0 ";
+ $sql1 .= "WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
+ $v = array($l_id,$gui_id);
+ $t = array('i','s');
+ $res1 = db_prep_query($sql1,$v,$t);
+ if(!$res1){
+
+ db_rollback();
+ }
+ }
+ if($this->objLayer[$i]->layer_queryable == 1){
+ $sql1 = "UPDATE gui_layer set gui_layer_queryable = 1 ";
+ $sql1 .= "WHERE fkey_layer_id = $1 and fkey_gui_id = $2";
+ $v = array($l_id,$gui_id);
+ $t = array('i','s');
+ $res1 = db_prep_query($sql1,$v,$t);
+ if(!$res1){
+
+ db_rollback();
+ }
+ }
+ if($row["gui_layer_minscale"] < $this->objLayer[$i]->layer_minscale){
+ $sql1 = "UPDATE gui_layer set gui_layer_minscale = $1 ";
+ $sql1 .= "WHERE fkey_layer_id = $2 and fkey_gui_id = $3";
+ $v = array($this->objLayer[$i]->layer_minscale,$l_id,$gui_id);
+ $t = array('i','i','s');
+ $res1 = db_prep_query($sql1,$v,$t);
+ if(!$res1){db_rollback();
+ }
+ }
+ if($row["gui_layer_maxscale"] > $this->objLayer[$i]->layer_maxscale){
+ $sql1 = "UPDATE gui_layer set gui_layer_maxscale = $1 ";
+ $sql1 .= "WHERE fkey_layer_id = $2 and fkey_gui_id = $3";
+ $v = array($this->objLayer[$i]->layer_maxscale,$l_id,$gui_id);
+ $t = array('i','i','s');
+ $res1 = db_prep_query($sql1,$v,$t);
+ if(!$res1){db_rollback();
+ }
+ }
+ }
+ }
+ function update_gui_wms($myWMS){
+ $mySubmit = null;
+ $sql = "SELECT * FROM gui_wms where fkey_wms_id = $1";
+ $v = array($myWMS);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $cnt = 0;
+ while($row = db_fetch_array($res)){
+ unset($mySubmit);
+ $myGUI[$cnt] = $row["fkey_gui_id"];
+
+ $sql = "UPDATE gui_wms SET ";
+ $v = array();
+ $t = array();
+ $paramCount = 0;
+
+ for($i=0; $i<count($this->data_type); $i++){
+ # gui_wms_mapformat
+ if(mb_strtolower($this->data_type[$i]) == "map" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_mapformat"])){
+ $myMapFormat = true;
+ }
+ # gui_wms_featureinfoformat
+ if(mb_strtolower($this->data_type[$i]) == "featureinfo" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_featureinfoformat"])){
+ $myFeatureInfoFormat = true;
+ }
+ # gui_wms_exceptionformat
+ if(mb_strtolower($this->data_type[$i]) == "exception" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_exceptionformat"])){
+ $myExceptionFormat = true;
+ }
+ }
+ if(!$myMapFormat){
+ $paramCount++;
+ $sql .= "gui_wms_mapformat = $" . $paramCount . " ";
+ $mySubmit = true;
+ array_push($v, $this->gui_wms_mapformat);
+ array_push($t, "s");
+ }
+ if(!$myFeatureInfoFormat){
+ if($mySubmit){ $sql .= ",";}
+ $paramCount++;
+ $sql .= "gui_wms_featureinfoformat = $" . $paramCount . " ";
+ array_push($v, $this->gui_wms_featureinfoformat);
+ array_push($t, "s");
+ $mySubmit = true;
+ }
+ if(!$myExceptionFormat){
+ if($mySubmit){ $sql .= ",";}
+ $paramCount++;
+ $sql .= "gui_wms_exceptionformat = $" . $paramCount ." ";
+ array_push($v, $this->gui_wms_exceptionformat);
+ array_push($t, "s");
+ $mySubmit = true;
+ }
+
+ # gui_wms_epsg
+ for($j=0; $j<count($this->objLayer[0]->layer_epsg);$j++){
+ if($this->objLayer[0]->layer_epsg[$j][epsg] == mb_strtoupper($row["gui_wms_epsg"])){
+ $myGUI_EPSG = true;
+ }
+ }
+ if(!$myGUI_EPSG){
+ if($mySubmit){ $sql .= ",";}
+ $paramCount++;
+ $sql .= "gui_wms_epsg = $" . $paramCount . " ";
+ array_push($v, $this->gui_wms_epsg);
+ array_push($t, "s");
+ $mySubmit = true;
+ }
+ $paramCount++;
+ $sql .= " WHERE fkey_gui_id = $" . $paramCount . " ";
+ array_push($v, $row["fkey_gui_id"]);
+ array_push($t, "s");
+
+ $paramCount++;
+ $sql .= "AND fkey_wms_id = $" . $paramCount;
+ array_push($v, $myWMS);
+ array_push($t, "i");
+ if($mySubmit){
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ echo "<pre>".$sql."</pre><br> <br><p>";
+ echo db_error();
+ echo "<br /> UPDATE ERROR -> KILL PROCESS AND ROLLBACK....................no update<br><br>";
+ $e = new mb_exception("class_wms.php: transaction: Transaction aborted, rollback.");
+ }
+ }
+ $cnt++;
+ }
+ }
+ function getVersion() {
+ return $this->wms_version;
+ }
+
+ function getCapabilities() {
+ return $this->wms_getcapabilities;
+ }
+
+ function getCapabilitiesDoc() {
+ return $this->wms_getcapabilities_doc;
+ }
+
+ /**
+ * creatObjfromDB
+ *
+ */
+ function createObjFromDB($gui_id,$wms_id){
+
+ $sql = "Select * from gui_wms where fkey_wms_id = $1 AND fkey_gui_id = $2";
+ $v = array($wms_id,$gui_id);
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+
+ $count=0;
+ #$res_count=db_num_rows($res);
+
+
+ while($row = db_fetch_array($res)){
+ $this->gui_wms_mapformat=$row["gui_wms_mapformat"];
+ $this->gui_wms_featureinfoformat=$row["gui_wms_featureinfoformat"];
+ $this->gui_wms_exceptionformat=$row["gui_wms_exceptionformat"];
+ $this->gui_wms_epsg=$row["gui_wms_epsg"];
+ $this->gui_wms_visible = $row["gui_wms_visible"];
+ $this->gui_wms_opacity = $row["gui_wms_opacity"];
+ $this->gui_wms_sldurl = $row["gui_wms_sldurl"];
+
+ $sql = "Select * from wms where wms_id = $1 ";
+ $v = array($wms_id);
+ $t = array('i');
+ $res_wms = db_prep_query($sql,$v,$t);
+ $count_wms=0;
+ while($row2 = db_fetch_array($res_wms)){
+ $this->wms_id = $row2["wms_id"];
+ $this->wms_version = $row2["wms_version"];
+ $this->wms_title = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_title"]));
+ $this->wms_abstract = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_abstract"]));
+ $wmsowsproxy = $row2["wms_owsproxy"];
+ #$wmsowsproxy = "test";
+ if($wmsowsproxy != ""){
+ $owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
+ $this->wms_getmap = $owsproxyurl;
+ $this->wms_getcapabilities = $owsproxyurl;
+ $this->wms_getfeatureinfo = $owsproxyurl;
+ $this->wms_getlegendurl = $owsproxyurl;
+ }
+ else{
+ $this->wms_getmap = $row2["wms_getmap"];
+ $this->wms_getcapabilities = $row2["wms_getcapabilities"];
+ $this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
+ $this->wms_getlegendurl = $row2["wms_getlegendurl"];
+ }
+ // TO DO: Capabilities document needs to
+ // be encoded to the original encoding
+ // if different from the database encoding
+ $this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
+ $this->wms_filter = $row2["wms_filter"];
+ $this->wms_supportsld = $row2["wms_supportsld"];
+ $this->wms_userlayer = $row2["wms_userlayer"];
+ $this->wms_userstyle = $row2["wms_userstyle"];
+ $this->wms_remotewfs = $row2["wms_remotewfs"];
+
+ $count_wms++;
+ }
+
+ ### formats
+ $sql = "SELECT * FROM wms_format WHERE fkey_wms_id = $1 ";
+ $v = array($wms_id);
+ $t = array('i');
+ $res_wms = db_prep_query($sql,$v,$t);
+ $count_format=0;
+ while($row3 = db_fetch_array($res_wms)){
+ $this->data_type[$count_format] = $row3["data_type"];
+ $this->data_format[$count_format] = $row3["data_format"];
+ $count_format++;
+ }
+ $count++;
+ }
+
+ #layer
+ $sql = "Select * from gui_layer where gui_layer_wms_id = $1 AND fkey_gui_id = $2 ";
+ $sql .= " AND gui_layer_status = 1 ORDER BY gui_layer_priority;";
+ $v = array($wms_id,$gui_id);
+ $t = array('i','s');
+ $res = db_prep_query($sql,$v,$t);
+ $count=0;
+
+ while($row = db_fetch_array($res)){
+ $layer_id = $row["fkey_layer_id"];
+ $sql = "Select * from layer where layer_id = $1";
+ $v = array($layer_id);
+ $t = array('i');
+ $res_layer = db_prep_query($sql,$v,$t);
+ $count_layer=0;
+ while($row2 = db_fetch_array($res_layer)){
+ $this->addLayer($row2["layer_pos"],$row2["layer_parent"]);
+ $layer_cnt=count($this->objLayer)-1;
+ $this->objLayer[$layer_cnt]->layer_uid = $layer_id;
+ $this->objLayer[$layer_cnt]->layer_name = administration::convertIncomingString($row2["layer_name"]);
+ $this->objLayer[$layer_cnt]->layer_title = administration::convertIncomingString($row2["layer_title"]);
+ $this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
+ $this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
+ $this->objLayer[$layer_cnt]->layer_pos =$row2["layer_pos"];
+ $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_pos"];
+ $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_queryable"];
+ $this->objLayer[$layer_cnt]->layer_minscale =$row2["layer_minscale"];
+ $this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
+ $count_layer++;
+ }
+ $this->objLayer[$layer_cnt]->layer_uid = $layer_id;
+ $this->objLayer[$layer_cnt]->gui_layer_wms_id = $row["gui_layer_wms_id"];
+ $this->objLayer[$layer_cnt]->gui_layer_selectable = $row["gui_layer_selectable"];
+ $this->objLayer[$layer_cnt]->gui_layer_visible = $row["gui_layer_visible"];
+ $this->objLayer[$layer_cnt]->gui_layer_queryable = $row["gui_layer_queryable"];
+ $this->objLayer[$layer_cnt]->gui_layer_querylayer = $row["gui_layer_querylayer"];
+ $this->objLayer[$layer_cnt]->gui_layer_minscale = $row["gui_layer_minscale"];
+ $this->objLayer[$layer_cnt]->gui_layer_maxscale = $row["gui_layer_maxscale"];
+ $this->objLayer[$layer_cnt]->gui_layer_style = $row["gui_layer_style"];
+ $this->objLayer[$layer_cnt]->gui_layer_wfs_featuretype = $row["gui_layer_wfs_featuretype"];
+
+ $sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
+ $v = array($layer_id);
+ $t = array('i');
+ $res_layer_epsg = db_prep_query($sql,$v,$t);
+
+ $count_layer_epsg=0;
+ while($row2 = db_fetch_array($res_layer_epsg)){
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"]=$row2["epsg"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"]=$row2["minx"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"]=$row2["miny"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"]=$row2["maxx"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
+ $count_layer_epsg++;
+ }
+
+ ### handle styles
+ $sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
+ $v = array($layer_id);
+ $t = array('i');
+ $res_style = db_prep_query($sql,$v,$t);
+ $count_layer_style = 0;
+ while($row2 = db_fetch_array($res_style)){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"] = $row2["name"] ? $row2["name"] : "default";
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
+ if($wmsowsproxy != ""){
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
+ "REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
+ "&STYLE=".$row2["name"];
+ }
+ }
+ else{
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
+ #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
+ }
+ }
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
+ $count_layer_style++;
+ }
+ $count++;
+ }
+ }
+ /** end createObjfromDB **/
+
+ /**
+ * creatObjfromDBNoGui
+ *
+ */
+ function createObjFromDBNoGui($wms_id){
+
+ $sql = "Select * from wms where wms_id = $1 ";
+ $v = array($wms_id);
+ $t = array('i');
+ $res_wms = db_prep_query($sql,$v,$t);
+ $count_wms=0;
+ while($row2 = db_fetch_array($res_wms)){
+ $this->wms_id = $row2["wms_id"];
+ $this->wms_version = $row2["wms_version"];
+ $this->wms_title = $this->stripEndlineAndCarriageReturn($row2["wms_title"]);
+ $this->wms_abstract = $this->stripEndlineAndCarriageReturn($row2["wms_abstract"]);
+ $wmsowsproxy = $row2["wms_owsproxy"];
+ #$wmsowsproxy = "test";
+ if($wmsowsproxy != ""){
+ $owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
+ $this->wms_getmap = $owsproxyurl;
+ $this->wms_getcapabilities = $owsproxyurl;
+ $this->wms_getfeatureinfo = $owsproxyurl;
+ $this->wms_getlegendurl = $owsproxyurl;
+ }
+ else{
+ $this->wms_getmap = $row2["wms_getmap"];
+ $this->wms_getcapabilities = $row2["wms_getcapabilities"];
+ $this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
+ $this->wms_getlegendurl = $row2["wms_getlegendurl"];
+ }
+ // TO DO: Capabilities document needs to
+ // be encoded to the original encoding
+ // if different from the database encoding
+ $this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
+ $this->wms_filter = $row2["wms_filter"];
+ $this->wms_supportsld = $row2["wms_supportsld"];
+ $this->wms_userlayer = $row2["wms_userlayer"];
+ $this->wms_userstyle = $row2["wms_userstyle"];
+ $this->wms_remotewfs = $row2["wms_remotewfs"];
+
+ #some default
+ $this->gui_wms_visible = 1;
+ $this->gui_wms_opacity = 100;
+ $this->gui_wms_epsg=$row["gui_wms_epsg"];
+ $this->gui_wms_sldurl = $row["gui_wms_sldurl"];
+
+ if($this->wms_version == "1.0.0"){
+ $this->gui_wms_mapformat = "PNG";
+ $this->gui_wms_featureinfoformat = "MIME";
+ $this->gui_wms_exceptionformat = "INIMAGE";
+ }
+ /*define defaults for wms-version 1.1.0 and 1.1.1*/
+ else{
+ $this->gui_wms_mapformat = "image/png";
+ $this->gui_wms_featureinfoformat = "text/html";
+ $this->gui_wms_exceptionformat = "application/vnd.ogc.se_inimage";
+ }
+
+ $count_wms++;
+ }
+
+ ### formats
+ $sql = "SELECT * FROM wms_format WHERE fkey_wms_id = $1 ";
+ $v = array($wms_id);
+ $t = array('i');
+ $res_wms = db_prep_query($sql,$v,$t);
+ $count_format=0;
+ while($row3 = db_fetch_array($res_wms)){
+ $this->data_type[$count_format] = $row3["data_type"];
+ $this->data_format[$count_format] = $row3["data_format"];
+ $count_format++;
+ }
+
+
+ $sql = "Select * from layer where fkey_wms_id = $1";
+ $v = array($wms_id);
+ $t = array('i');
+ $res_layer = db_prep_query($sql,$v,$t);
+ $count_layer=0;
+ while($row2 = db_fetch_array($res_layer)){
+ $this->addLayer($row2["layer_pos"],$row2["layer_parent"]);
+ $layer_cnt=count($this->objLayer)-1;
+ $this->objLayer[$layer_cnt]->layer_uid = $row2["layer_id"];
+ $this->objLayer[$layer_cnt]->layer_name =$row2["layer_name"];
+ $this->objLayer[$layer_cnt]->layer_title =$row2["layer_title"];
+ $this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
+ $this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
+ $this->objLayer[$layer_cnt]->layer_pos =$row2["layer_pos"];
+ $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_pos"];
+ $this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_queryable"];
+ $this->objLayer[$layer_cnt]->layer_minscale =$row2["layer_minscale"];
+ $this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
+
+ if($this->objLayer[$layer_cnt]->layer_minscale == ""){
+ $this->objLayer[$layer_cnt]->layer_minscale = 0;
+ }
+ if($this->objLayer[$layer_cnt]->layer_maxscale == ""){
+ $this->objLayer[$layer_cnt]->layer_maxscale = 0;
+ }
+ $this->objLayer[$layer_cnt]->gui_layer_minscale = $this->objLayer[$layer_cnt]->layer_minscale;
+ $this->objLayer[$layer_cnt]->gui_layer_maxscale = $this->objLayer[$layer_cnt]->layer_maxscale;
+
+ $sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
+ $v = array($this->objLayer[$layer_cnt]->layer_uid);
+ $t = array('i');
+ $res_layer_epsg = db_prep_query($sql,$v,$t);
+
+ $count_layer_epsg=0;
+ while($row2 = db_fetch_array($res_layer_epsg)){
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"]=$row2["epsg"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"]=$row2["minx"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"]=$row2["miny"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"]=$row2["maxx"];
+ $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
+ $count_layer_epsg++;
+ }
+
+ ### handle styles
+ $sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
+ $v = array($this->objLayer[$layer_cnt]->layer_uid);
+ $t = array('i');
+ $res_style = db_prep_query($sql,$v,$t);
+ $count_layer_style = 0;
+ while($row2 = db_fetch_array($res_style)){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"]=$row2["name"];
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
+ if($wmsowsproxy != ""){
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
+ "REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
+ "&STYLE=".$row2["name"];
+ }
+ }
+ else{
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
+ #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
+ }
+ }
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
+ $count_layer_style++;
+ }
+
+ $count_layer++;
+ }
+
+ }
+ /** end createObjfromDBNoGui **/
+
+ /**
+ * function checkObjExistsInDB()
+ *
+ * this function checks wether the onlineresource already exists in the database.
+ */
+ function checkObjExistsInDB(){
+
+ $sql = "Select * from wms where wms_getcapabilities = $1";
+ $v = array($this->wms_getcapabilities);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ $res_count= db_num_rows($res);
+ $wms_id=0;
+ if($res_count>0){
+ $count=0;
+ while($row = db_fetch_array($res)){
+ $wms_id=$row["wms_id"];
+ $count++;
+ }
+ }
+ return $wms_id;
+ }
+
+ function displayDBInformation(){
+ echo $this->wms_getcapabilities;
+ $sql="Select * from wms where wms_getcapabilities = $1";
+ $v = array($this->wms_getcapabilities);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ $count=0;
+ while($row = db_fetch_array($res)){
+ echo "count: ".$count."<br>";
+ $wms_id=$row["wms_id"];
+ echo "version: " .$wms_id." <br>";
+ echo "title: " .$row["wms_version"]. " <br>";
+ echo "abstract: " . $row["wms_title"] . " <br>";
+ echo "maprequest: " .$row["wms_abstract"] . " <br>";
+ echo "capabilitiesrequest: " . $row["wms_getcapabilities"] . " <br>";
+ echo "featureinforequest: " . $row["wms_getmap"]. " <br>";
+ echo "gui_wms_mapformat: " . $row["wms_getfeatureinfo"] . " <br>---------<br>";
+ $count++;
+ }
+ echo "----<br> wms_id: ".$wms_id."<br>";
+
+ $sql = "Select * from gui_wms where fkey_wms_id = $1";
+ $v = array($wms_id);
+ $t = array('i');
+ echo "sql: ".$sql." <br>---------<br>";
+ $res = db_prep_query($sql,$v,$t);
+ $res_count= db_num_rows($res);
+ echo "result count: ".$res_count." <br>---------<br>";
+
+ $count=0;
+ while($row = db_fetch_array($res)){
+ echo "gui_wms_featureinfoformat: " . $row["gui_wms_featureinfoformat"]." <br>";
+ echo "gui_wms_exceptionformat: " . $row["gui_wms_exceptionformat"]. " <br>";
+ echo "gui_wms_epsg: " . $row["gui_wms_epsg"]. " <br>";
+ $count++;
+ }
+
+ #db_close($connect);
+ }
+
+ function checkObj(){
+ if($this->wms_getcapabilities == '' || $this->wms_getmap == '' ){
+ echo "<br>Missing parameters: <br>";
+ $this->displayWMS();
+ print_r($this);
+ echo "<br> Data not committed<br>";
+ die();
+ }
+ }
+
+ /**
+ * Selects all WMS of the current user from the database.
+ * Then it creates the corresponding WMS object and returns
+ * these objects as an array.
+ *
+ * @return wms[]
+ * @param $appId String
+ */
+ public static function selectMyWmsByApplication ($appId) {
+ // check if user is permitted to access the application
+ $currentUser = new User($_SESSION["mb_user_id"]);
+ $appArray = $currentUser->getApplicationsByPermission(false);
+ if (!in_array($appId, $appArray)) {
+ $e = new mb_warning("class_wms.php: selectMyWmsByApplication(): User '" . $currentUser . "' is not allowed to acces application '" . $appId . "'.");
+ return array();
+ }
+
+ // get WMS of this application
+ $sql = "SELECT fkey_wms_id FROM gui_wms WHERE " .
+ "fkey_gui_id = $1 ORDER BY gui_wms_position";
+ $v = array($appId);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+
+ // instantiate PHP objects and store in array
+ $wmsArray = array();
+ while ($row = db_fetch_array($res)) {
+ $currentWms = new wms();
+ $currentWms->createObjFromDB($appId, $row["fkey_wms_id"]);
+ array_push($wmsArray, $currentWms);
+ }
+ return $wmsArray;
+ }
+}
+class layer extends wms {
+ var $layer_id;
+ var $layer_parent;
+ var $layer_name;
+ var $layer_title;
+ var $layer_abstract;
+ var $layer_pos;
+ var $layer_queryable;
+ var $layer_minscale;
+ var $layer_maxscale;
+ var $layer_dataurl_href;
+ var $layer_metadataurl;
+ var $layer_keyword = array();
+ var $layer_epsg = array();
+ var $layer_style = array();
+
+ var $gui_layer_wms_id;
+ var $gui_layer_status = 1;
+ var $gui_layer_selectable = 1;
+ var $gui_layer_visible = 0;
+ var $gui_layer_queryable = 0;
+ var $gui_layer_querylayer = 0;
+ var $gui_layer_style = NULL;
+
+ function layer($id,$parent){
+ $this->layer_id = $id;
+ $this->layer_parent = $parent;
+ //var_dump($this);
+ }
+
+ public function __toString () {
+ $e = new mb_exception("TITLE: " . $this->layer_title);
+ return $this->layer_title;
+ }
+
+}
+?>
Deleted: branches/google_dev/trunk/http/css/digitize.css
===================================================================
--- trunk/mapbender/http/css/digitize.css 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/css/digitize.css 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,27 +0,0 @@
-.bp{
- position:absolute;
- top: 0px;
- left: 0px;
- background-color: #8a2be2;
- width: 5px;
- height: 5px;
- font-size:1px;
- cursor:pointer;
-}
-
-.lp{
- position:absolute;
- top: 0px;
- left: 0px;
- background-color: #ff00ff;
- width: 4px;
- height: 4px;
- font-size:1px;
- cursor:pointer;
-}
-
-.t_img{
- position:absolute;
- left:0px;
- top:0px;
-}
\ No newline at end of file
Copied: branches/google_dev/trunk/http/css/digitize.css (from rev 3805, trunk/mapbender/http/css/digitize.css)
===================================================================
--- branches/google_dev/trunk/http/css/digitize.css (rev 0)
+++ branches/google_dev/trunk/http/css/digitize.css 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,22 @@
+.lp, .bp, .t_img {
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+
+.lp, .bp {
+ font-size: 1px;
+ cursor: pointer;
+}
+
+.lp {
+ width: 2px;
+ height: 2px;
+ background-color: #000;
+}
+
+.bp {
+ width: 5px;
+ height: 5px;
+ background-color: #F00;
+}
\ No newline at end of file
Copied: branches/google_dev/trunk/http/html (from rev 3725, trunk/mapbender/http/html)
Modified: branches/google_dev/trunk/http/html/mod_treefolder2.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolder2.php 2009-03-14 15:15:03 UTC (rev 3725)
+++ branches/google_dev/trunk/http/html/mod_treefolder2.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -417,7 +417,7 @@
for (var i=0;i<my.length;i++){
if(my[i]["epsg"]==parent.mb_mapObj[j].epsg){
parent.mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
- var arrayExt = parent.mb_mapObj[j].extent.split(",");
+ var arrayExt = parent.mb_mapObj[j].extent.toString().split(",");
parent.mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
break;
}
@@ -687,7 +687,7 @@
controls.push('disabled ');
controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
- }
+ }
if(wmsbuttons == 'true'&&metadatalink == 'true'){
controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');
}
Deleted: branches/google_dev/trunk/http/html/mod_treefolderPlain.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolderPlain.php 2009-03-14 15:15:03 UTC (rev 3725)
+++ branches/google_dev/trunk/http/html/mod_treefolderPlain.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,698 +0,0 @@
-<?php
-# $Id: mod_treefolder2.php 2975 2008-09-18 12:58:42Z nimix $
-# http://www.mapbender.org/index.php/Mod_treefolder2.php
-# Copyright (C) 2007 Melchior Moos
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include '../include/dyn_js.php';
-?>
-function openwindow(Adresse) {
-Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
-Fenster1.focus();
-}
-<?php
-
- echo "mod_treeGDE_map = '".$e_target[0]."';";
-session_write_close();
-?>
-var msgObj = {};
-msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
-msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
-msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
-msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
-msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
-msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
-msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
-msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
-
-var jst_container = "document.getElementById('treeContainer')";
-var jst_image_folder = imagedir;
-var jst_display_root = false;
-var defaultTarget = 'examplemain';
-var lock=false;
-var lock_update=false;
-var lock_check=false;
-var selectedMap=-1;
-var selectedWMS=-1;
-var selectedLayer=-1;
-var initialized=false;
-var errors = 0;
-var state=Array();
-var treeState = "";
-<?php
-//load structure
-$sql = "SELECT * FROM gui_treegde WHERE fkey_gui_id = $1 AND NOT lft = 1 ORDER BY lft;";
-$v = array($_SESSION["mb_user_gui"]);
-$t = array("s");
-$res = db_prep_query($sql, $v, $t);
-
-//init tree converting arrays
-$nr = array(); //array for nested sets numbers
-$str = array(); //array for js array elements
-$categories = array(); //array for wms folders
-$path = array(); //stack for actual path elements
-$rights = array(); //stack for rights of open elements
-
-//build javascript data array for jsTree
-while($row = db_fetch_array($res)){
- //push javascript array elements to a single array with lefts and rights
- $left = "['folder_".$row['id']."', ['".$row['my_layer_title']."', 'javascript:_foo()'],[";
- $right = "]],";
- array_push($nr, $row['lft']);
- array_push($str, $left);
- array_push($nr, $row['rgt']);
- array_push($str, $right);
-
- //finish all nodes that have no further childs
- while(count($rights) > 0 && $rights[count($rights)-1]<$row['lft']){
- array_pop($rights);
- array_pop($path);
- }
-
- //set path for each wms that is referenced in this folder
- array_push($rights, $row['rgt']);
- array_push($path, "folder_".$row['id']);
- if($row['wms_id']!=""){
- foreach(explode(",",$row['wms_id']) as $wms){
- array_push($categories, "'wms_".$wms."':\"root_id|".implode("|", $path)."\"");
- }
- }
-}
-//if we have a configured structure output it
-if(count($str)>0){
- //order js array elements
- array_multisort($nr, $str);
-
- //output javascript vars
- $arrNodesStr = "[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];";
- $arrNodesStr = str_replace(array("[]", ",]"),array("","]"),$arrNodesStr);
- echo "var arrNodesStr = \"".$arrNodesStr."\";\n";
- echo "var categories = {".implode(",", $categories)."};\n";
-}
-else{
-//if there is no structure take default
-?>
-var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()']]];";
-var categories = {};
-<?php
-}
-?>
-var arrNodes = eval(arrNodesStr);
-function _foo(){selectedMap=-1;selectedWMS=-1;selectedLayer=-1}
-
-// some defaults
-if (typeof(reverse) === 'undefined')reverse = 'false';
-if (typeof(switchwms) === 'undefined')switchwms = 'true';
-if (typeof(ficheckbox) === 'undefined')ficheckbox = 'false';
-if (typeof(metadatalink) === 'undefined')metadatalink = 'false';
-if (typeof(wmsbuttons) === 'undefined')wmsbuttons = 'false';
-if (typeof(showstatus) === 'undefined')showstatus = 'false';
-if (typeof(alerterror) === 'undefined')alerterror = 'false';
-if (typeof(openfolder) === 'undefined')openfolder = 'false';
-if (typeof(handlesublayer) === 'undefined')handlesublayer = 'false';
-if (typeof(menu) === 'undefined')menu = '';
-if (typeof(redirectToMetadataUrl) !== 'undefined' && redirectToMetadataUrl == "false") {
- redirectToMetadataUrl = false;
-}
-else {
- redirectToMetadataUrl = true;
-}
-
-var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
-if (redirectToMetadataUrl) {
- defaultMetadataUrl += 'redirectToMetadataUrl=1';
-}
-else {
- defaultMetadataUrl += 'redirectToMetadataUrl=0';
-}
-
-//menu elements
-var menu_move_up = ['menu_move_up', ['<?php echo _mb("Move up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
-var menu_move_down = ['menu_move_down', ['<?php echo _mb("Move down");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
-var menu_delete = ['menu_delete', ['<?php echo _mb("Remove");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
-var menu_opacity_up = ['menu_opacity_up', ['<?php echo _mb("Opacity up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
-var menu_opacity_down = ['menu_opacity_down', ['<?php echo _mb("Opacity down");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
-var menu_metalink = ['menu_metalink', ['<?php echo _mb("Information");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
-var menu_zoom = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
-var menu_hide = ['menu_hide', ['<?php echo _mb("Hide menu");?> ', 'javascript:hideMenu()',,'hide.png']];
-//var menu_wms_switch = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-//var menu_layer_switch = ['menu_zoom', ['Zjjj ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-//var menu_info_switch = ['menu_zoom', ['Zmn ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-
-//parent.eventMapRequestFailed.register(function(t){imgerror(t)});
-
-eventAfterLoadWMS.register(reloadTree);
-eventInit.register(loadTree);
-if(showstatus=='true'||alerterror=='true'){
- eventAfterMapRequest.register(init_mapcheck);
- init_mapcheck();
-}
-eventAfterMapRequest.register(updateScale);
-eventAfterMapRequest.register(updateCheckState);
-
-if(wmsbuttons != "true")
- jst_highlight = false;
-
-function select(i,ii,iii){
- //ignore if selected
- if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
- if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
- selectedMap=i;
- selectedWMS=ii;
- selectedLayer=iii;
- return;
- }
- //scalehints
- var scale = parseInt(mb_getScale(mod_treeGDE_map));
- if(scale < parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
- if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
- }
- else if(scale > parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
- if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
- }
- else{
- if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
- }
-
- selectedMap=i;
- selectedWMS=ii;
- selectedLayer=iii;
-}
-
-function updateScale(){
- if(!initialized)return;
- myMapObj = getMapObjByName(mod_treeGDE_map);
- if(myMapObj){
- var scale = parseInt( mb_getScale(mod_treeGDE_map));
- for(var ii=0; ii< myMapObj.wms.length; ii++){
- for(var iii=1; iii< myMapObj.wms[ii].objLayer.length; iii++){
- if(scale < parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) != 0){
- if(iii==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
- }
- else if(scale > parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
- if(iii==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
- }
- else{
- if(iii==0)
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '');
- else
- setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '');
- }
- }
- }
- }
- }
-
-function updateCheckState(){
- if(!initialized||lock_check)return;
- lock_check=true;
- for(var i=0; i< mb_mapObj.length; i++){
- var scale = parseInt( mb_getScale(mod_treeGDE_map));
- if( mb_mapObj[i].elementName == mod_treeGDE_map){
- for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
- for(var iii=1; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
- if(! mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
- path = arrNodes[0][0]+"|wms_"+ mb_mapObj[i].wms[ii].wms_id+"|"+ mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
- checkNode(path, 0, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
- if(ficheckbox == 'true')
- checkNode(path, 1, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);
- }
- }
- }
- }
- }
- lock_check=false;
-}
-
-function operaLoad(){
- initArray();
- renderTree();
- setTimeout('initWmsCheckboxen();updateScale();',100);
-}
-
-function loadTree(){
- if(wmsbuttons=='true'){
- var div = document.createElement("div");
- div.innerHTML = '<a href="javascript:move_up()"><img title="'+msgObj.tooltipMoveSelectionUp+'" src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a><a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a><a href="javascript:remove_wms()"><img title="'+msgObj.tooltipRemoveWms+'" src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>';
- document.getElementById("treeGDE").appendChild(div);
- }
- var div = document.createElement("div");
- div.id = "treeContainer"
- document.getElementById("treeGDE").appendChild(div);
-
- if(window.opera){
- setTimeout('operaLoad()',200);
- return;
- }
- initArray();
- renderTree();
- initWmsCheckboxen();
- updateScale();
-}
-
-function reloadTree(){
- if(!initialized) return;
- selectedMap=-1;
- selectedWMS=-1;
- selectedLayer=-1;
- initialized=false;
- arrNodes = eval(arrNodesStr)
- initArray();
- if(showstatus=='true'||alerterror=='true')
- init_mapcheck();
- renderTree();
- if(window.opera)
- setTimeout('initWmsCheckboxen();updateScale();',100);
- else{
- initWmsCheckboxen();
- updateScale();
- }
-}
-
-function imgerror(t){
- var map= getMapObjIndexByName(mod_treeGDE_map);
- var wms=Number(t.id.substr(4));
- t.onerror=null;
- t.onabort=null;
- if(state[wms]!=-1 && alerterror=='true'){
- state[wms]=-1;
- if(confirm('Failed to Load WMS "'+ mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+ mb_mapObj[map].wms[wms].wms_getmap.substr(0, mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
- window.open(t.src,"");
- }
- }
- state[wms]=-1;
- errors++;
- if(showstatus=='true')
- setNodeImage(arrNodes[0][0]+"|wms_"+ mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
-}
-
-function checkComplete(wms, map, img, first){
- var ind= getMapObjIndexByName(mod_treeGDE_map);
- if( mb_mapObj[ind].wms[wms].mapURL == false || mb_mapObj[ind].getDomElement().ownerDocument.getElementById(map).complete){
- if(state[wms]!=-1){
- for(var i=1;i< mb_mapObj[ind].wms[wms].objLayer.length;i++){
- if( mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
- state[wms]=1;
- if(showstatus=='true')
- setNodeImage(img);
- break;
- }
- }
- }
- }
- else{
- if(first){
- state[wms]=0;
-// frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
-// frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
-
- if(showstatus=='true')
- setNodeImage(img, "loading_folder.gif");
- }
-
- if(state[wms]!=-1)
- setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
- }
-}
-
-// mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
-
-function init_mapcheck(){
- if(!initialized)return;
- errors = 0;
- var ind = getMapObjIndexByName(mod_treeGDE_map);
- if(! mb_mapObj[ind]||!initialized){
- setTimeout("init_mapcheck();",100);
- return;
- }
- for(var wms=0;wms< mb_mapObj[ind].wms.length;wms++){
- var wmsimgid=mod_treeGDE_map+"_map_"+wms;
- if( mb_mapObj[ind].getDomElement().ownerDocument.getElementById(wmsimgid)){
- checkComplete(wms, wmsimgid, arrNodes[0][0]+'|wms_'+ mb_mapObj[ind].wms[wms].wms_id, true);
- }
- }
-}
-
-function handleSelectedLayer(mapObj,wms_id,layername,type,status){
- if(lock_update||lock_check)return;
- var ind = getMapObjIndexByName(mapObj);
- for(var i=0; i< mb_mapObj[ind].wms.length; i++){
- if( mb_mapObj[ind].wms[i].wms_id == wms_id){
- mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
- break;
- }
- }
-}
-
-function zoomToLayer(j,k,l){
- if(!j&&!k&&!l){
- j=selectedMap;
- k=selectedWMS;
- l=selectedLayer;
- }
- var my= mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
- for (var i=0;i<my.length;i++){
- if(my[i]["epsg"]== mb_mapObj[j].epsg){
- mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
- var arrayExt = mb_mapObj[j].extent.split(",");
- mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
- break;
- }
- }
-}
-
-
-//---begin------------- opacity --------------------
-
-var opacityIncrement = 20;
-
-function opacity_up(j, k, l) {
- handleOpacity(j, k, opacityIncrement);
-}
-
-function opacity_down(j, k, l) {
- handleOpacity(j, k, -opacityIncrement);
-}
-
-function handleOpacity(mapObj_id, wms_id, increment) {
- var opacity = mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity*100 + increment;
- mb_mapObj[mapObj_id].wms[wms_id].setOpacity(opacity);
- reloadTree();
-}
-
-//---end------------- opacity --------------------
-
-function move_up(j,k,l){
- if(isNaN(j)&&isNaN(k)&&isNaN(l)){
- j=selectedMap;
- k=selectedWMS;
- l=selectedLayer;
- }
- if(j==-1||k==-1||l==-1){
- alert("You have to select the WMS you want to move up!")
- return;
- }
- var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
- if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
- alert("Illegal move operation");
- return;
- }
- treeState = getState();
- zoom( mb_mapObj[j].frameName, true, 1.0);
- mb_execloadWmsSubFunctions();
- //find layer and select
- for(k=0;k< mb_mapObj[j].wms.length;k++){
- for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
- if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
- select(j,k,l);
- if(l!=0)
- selectNode(String(lid));
- else
- selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
- }
- }
- }
-}
-
-function move_down(j,k,l){
- if(isNaN(j)&&isNaN(k)&&isNaN(l)){
- j=selectedMap;
- k=selectedWMS;
- l=selectedLayer;
- }
- if(j==-1||k==-1||l==-1){
- alert("You have to select the WMS you want to move down!")
- return;
- }
- var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
- if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
- alert("Illegal move operation");
- return;
- }
- treeState = getState();
- zoom( mb_mapObj[j].frameName, true, 1.0);
- mb_execloadWmsSubFunctions();
- //find layer and select
- for(k=0;k< mb_mapObj[j].wms.length;k++){
- for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
- if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
- select(j,k,l);
- if(l!=0)
- selectNode(String(lid));
- else
- selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
- }
- }
- }
-}
-
-function remove_wms(j,k,l){
- if(isNaN(j)&&isNaN(k)&&isNaN(l)){
- j=selectedMap;
- k=selectedWMS;
- l=selectedLayer;
- }
- if(j==-1||k==-1||l==-1){
- alert("You have to select the WMS you want to delete!")
- return;
- }
- if(l!=0){
- alert("It is not possible to delete a single layer, please select a WMS!")
- return;
- }
- var visibleWMS=0;
- for(var i=0;i< mb_mapObj[j].wms.length;i++)
- if( mb_mapObj[j].wms[i].gui_wms_visible=='1'|| mb_mapObj[j].wms[i].gui_wms_visible==1)
- visibleWMS++;
- if(visibleWMS<=1){
- alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
- return;
- }
- if(confirm('Are you sure you want to remove "'+ mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
- mb_mapObjremoveWMS(j,k);
- zoom( mb_mapObj[j].frameName, true, 1.0);
- mb_execloadWmsSubFunctions();
- }
-}
-
-function updateParent(path){
- if(lock_check)return;
- var reset_lock=!lock_update;
- lock_update=true;
- var state=getChildrenCheckState(path, 0);
- //enableCheckbox(path, (state!=-1)); //3rd state
- checkNode(path, 0, (state==1));
- if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
- setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
- }
- if(reset_lock)
- lock_update=false;
-}
-
-function handleSelectedWMS(path){
- if(lock_update)return;
- var t = path.split("|");
- var wms_id = t[t.length-1].substr(4);
- var reset_lock=!lock_check;
- var ind = getMapObjIndexByName(mod_treeGDE_map);
- var wms = getWMSIndexById(mod_treeGDE_map,wms_id);
- var layername = mb_mapObj[ind].wms[wms].objLayer[0].layer_name;
- var bChk = IsChecked(path, 0);
- mb_mapObj[ind].wms[wms].handleLayer(layername,"visible",bChk?"1":"0");
- mb_mapObj[ind].wms[wms].handleLayer(layername,"querylayer",bChk?"1":"0");
- lock_check=true;
- checkChildren(path, 0, bChk);
- if(ficheckbox)checkChildren(path, 1, bChk);
- if(bChk==false && showstatus=='true')
- setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
- if(reset_lock)
- {
- mb_restateLayers(mod_treeGDE_map,wms_id);
- setSingleMapRequest(mod_treeGDE_map,wms_id);
- lock_check=false;
- }
-}
-
-function handleSelection(path, box){
- if(lock_update)return;
- var reset_lock=!lock_check;
- lock_check=true;
- var bChk = IsChecked(path, box);
-// enableCheckbox(path, 0, true);
- checkChildren(path, box, bChk);
- if(reset_lock){
- //find wms id from path
- var t = path.split("|");
- for(var i=1;t[i].indexOf("wms_")!=0;i++){}
- var wms_id = t[i].substr(4);
- //set maprequest
- mb_restateLayers(mod_treeGDE_map,wms_id);
- if(box==0)
- setSingleMapRequest(mod_treeGDE_map,wms_id);
- lock_check=false;
- }
-}
-
-function initArray(){
- var parentObj = "";
- var controls="";
- if( mb_mapObj.length > 0){
- for(var i=0; i< mb_mapObj.length; i++){
- if( mb_mapObj[i].elementName == mod_treeGDE_map){
- for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
- if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
- for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
- var temp = mb_mapObj[i].wms[ii].objLayer[iii];
- if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
- if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
- continue;
-
- parentNode = arrNodes[0][0];
- if(eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id) !== undefined)
- parentNode = eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id);
- else
- eval("categories['wms_"+ mb_mapObj[i].wms[ii].wms_id+"'] = parentNode");
-
- var c_menu="[";
- if(reverse=="true"){
- if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
- if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
- }
- else{
- if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
- if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
- }
- if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
-// if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
- if(menu.indexOf("opacity_up")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
- if(menu.indexOf("opacity_down")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
- if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
- c_menu+="]";
- controls=null;
- if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+parentNode+'|wms_'+ mb_mapObj[i].wms[ii].wms_id+'\');" />';
- if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
- addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
- parentObj = parentNode+"|wms_"+ mb_mapObj[i].wms[ii].wms_id;
- }
- if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"|| mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
- var parentLayer = "";
- var j = iii;
- while( mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
- //find parent
- for(var jj=0; jj < mb_mapObj[i].wms[ii].objLayer.length; jj++){
- if( mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt( mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
- j=jj;
- break;
- }
- }
- parentLayer = "|" + mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
- }
- if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
- var c_menu="[";
- if(reverse=="true"){
- if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
- if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
- }
- else{
- if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
- if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
- }
- if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
- if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
-// if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
-// if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
- if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
- c_menu+="]";
-
- controls = [];
- controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerVisible + '" ');
- if(temp.layer_name=="")
- controls.push('style="display:none;" ');
- if(temp.gui_layer_visible=='1')
- controls.push('checked ');
- if(temp.gui_layer_selectable!='1')
- controls.push('disabled ');
- controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);");
- if(ficheckbox == 'false')
- controls.push("handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
- controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);");
- controls.push("updateParent('"+parentObj+parentLayer+"');\" />");
- if(ficheckbox == 'true'){
- controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerQuerylayer + '" ');
- if(temp.gui_layer_querylayer=='1')
- controls.push('checked ');
- if(temp.gui_layer_queryable!='1')
- controls.push('disabled ');
- controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
- controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
- }
- if(wmsbuttons == 'true'&&metadatalink == 'true'){
- controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');
- }
- addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
- }
- }
- }
- }
- }
- }
- }
- }
- initialized=true;
-}
-
-function initWmsCheckboxen(){
- var hidden=0;
- if( mb_mapObj.length > 0){
- for(var i=0; i< mb_mapObj.length; i++){
- if( mb_mapObj[i].elementName == mod_treeGDE_map){
- for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
- if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
- for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
- var temp = mb_mapObj[i].wms[ii].objLayer[iii];
- if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
- updateParent(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ii].wms_id);
- }
- }
- }
- else if(ii<= parseInt(openfolder)+hidden)
- hidden++;
- }
- closeAll()
- if(treeState!='')
- setState(treeState);
- else if(openfolder!='false')
- setState(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ parseInt(openfolder)+hidden].wms_id);
- }
- }
- }
-}
Copied: branches/google_dev/trunk/http/html/mod_treefolderPlain.php (from rev 3874, trunk/mapbender/http/html/mod_treefolderPlain.php)
===================================================================
--- branches/google_dev/trunk/http/html/mod_treefolderPlain.php (rev 0)
+++ branches/google_dev/trunk/http/html/mod_treefolderPlain.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,697 @@
+<?php
+# $Id: mod_treefolder2.php 2975 2008-09-18 12:58:42Z nimix $
+# http://www.mapbender.org/index.php/Mod_treefolder2.php
+# Copyright (C) 2007 Melchior Moos
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+?>
+function openwindow (Adresse) {
+ Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+ Fenster1.focus();
+}
+<?php
+ echo "mod_treeGDE_map = '".$e_target[0]."';";
+ session_write_close();
+?>
+var msgObj = {};
+msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
+msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
+msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
+msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
+msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
+msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
+msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
+msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
+
+var jst_container = "document.getElementById('treeContainer')";
+var jst_image_folder = imagedir;
+var jst_display_root = false;
+var defaultTarget = 'examplemain';
+var lock=false;
+var lock_update=false;
+var lock_check=false;
+var selectedMap=-1;
+var selectedWMS=-1;
+var selectedLayer=-1;
+var initialized=false;
+var errors = 0;
+var state=Array();
+var treeState = "";
+<?php
+//load structure
+$sql = "SELECT * FROM gui_treegde WHERE fkey_gui_id = $1 AND NOT lft = 1 ORDER BY lft;";
+$v = array($_SESSION["mb_user_gui"]);
+$t = array("s");
+$res = db_prep_query($sql, $v, $t);
+
+//init tree converting arrays
+$nr = array(); //array for nested sets numbers
+$str = array(); //array for js array elements
+$categories = array(); //array for wms folders
+$path = array(); //stack for actual path elements
+$rights = array(); //stack for rights of open elements
+
+//build javascript data array for jsTree
+while($row = db_fetch_array($res)){
+ //push javascript array elements to a single array with lefts and rights
+ $left = "['folder_".$row['id']."', ['".$row['my_layer_title']."', 'javascript:_foo()'],[";
+ $right = "]],";
+ array_push($nr, $row['lft']);
+ array_push($str, $left);
+ array_push($nr, $row['rgt']);
+ array_push($str, $right);
+
+ //finish all nodes that have no further childs
+ while(count($rights) > 0 && $rights[count($rights)-1]<$row['lft']){
+ array_pop($rights);
+ array_pop($path);
+ }
+
+ //set path for each wms that is referenced in this folder
+ array_push($rights, $row['rgt']);
+ array_push($path, "folder_".$row['id']);
+ if($row['wms_id']!=""){
+ foreach(explode(",",$row['wms_id']) as $wms){
+ array_push($categories, "'wms_".$wms."':\"root_id|".implode("|", $path)."\"");
+ }
+ }
+}
+//if we have a configured structure output it
+if(count($str)>0){
+ //order js array elements
+ array_multisort($nr, $str);
+
+ //output javascript vars
+ $arrNodesStr = "[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];";
+ $arrNodesStr = str_replace(array("[]", ",]"),array("","]"),$arrNodesStr);
+ echo "var arrNodesStr = \"".$arrNodesStr."\";\n";
+ echo "var categories = {".implode(",", $categories)."};\n";
+}
+else{
+//if there is no structure take default
+?>
+var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()']]];";
+var categories = {};
+<?php
+}
+?>
+var arrNodes = eval(arrNodesStr);
+function _foo(){selectedMap=-1;selectedWMS=-1;selectedLayer=-1}
+
+// some defaults
+if (typeof(reverse) === 'undefined')reverse = 'false';
+if (typeof(switchwms) === 'undefined')switchwms = 'true';
+if (typeof(ficheckbox) === 'undefined')ficheckbox = 'false';
+if (typeof(metadatalink) === 'undefined')metadatalink = 'false';
+if (typeof(wmsbuttons) === 'undefined')wmsbuttons = 'false';
+if (typeof(showstatus) === 'undefined')showstatus = 'false';
+if (typeof(alerterror) === 'undefined')alerterror = 'false';
+if (typeof(openfolder) === 'undefined')openfolder = 'false';
+if (typeof(handlesublayer) === 'undefined')handlesublayer = 'false';
+if (typeof(menu) === 'undefined')menu = '';
+if (typeof(redirectToMetadataUrl) !== 'undefined' && redirectToMetadataUrl == "false") {
+ redirectToMetadataUrl = false;
+}
+else {
+ redirectToMetadataUrl = true;
+}
+
+var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
+if (redirectToMetadataUrl) {
+ defaultMetadataUrl += 'redirectToMetadataUrl=1';
+}
+else {
+ defaultMetadataUrl += 'redirectToMetadataUrl=0';
+}
+
+//menu elements
+var menu_move_up = ['menu_move_up', ['<?php echo _mb("Move up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_move_down = ['menu_move_down', ['<?php echo _mb("Move down");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_delete = ['menu_delete', ['<?php echo _mb("Remove");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
+var menu_opacity_up = ['menu_opacity_up', ['<?php echo _mb("Opacity up");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_opacity_down = ['menu_opacity_down', ['<?php echo _mb("Opacity down");?> ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_metalink = ['menu_metalink', ['<?php echo _mb("Information");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
+var menu_zoom = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
+var menu_hide = ['menu_hide', ['<?php echo _mb("Hide menu");?> ', 'javascript:hideMenu()',,'hide.png']];
+//var menu_wms_switch = ['menu_zoom', ['<?php echo _mb("Zoom");?> ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_layer_switch = ['menu_zoom', ['Zjjj ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_info_switch = ['menu_zoom', ['Zmn ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+
+//parent.eventMapRequestFailed.register(function(t){imgerror(t)});
+
+eventAfterLoadWMS.register(reloadTree);
+eventInit.register(loadTree);
+if(showstatus=='true'||alerterror=='true'){
+ eventAfterMapRequest.register(init_mapcheck);
+ init_mapcheck();
+}
+eventAfterMapRequest.register(updateScale);
+eventAfterMapRequest.register(updateCheckState);
+
+if(wmsbuttons != "true")
+ jst_highlight = false;
+
+function select(i,ii,iii){
+ //ignore if selected
+ if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
+ if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
+ selectedMap=i;
+ selectedWMS=ii;
+ selectedLayer=iii;
+ return;
+ }
+ //scalehints
+ var scale = parseInt(mb_getScale(mod_treeGDE_map));
+ if(scale < parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
+ if(selectedLayer==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+ }
+ else if(scale > parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
+ if(selectedLayer==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+ }
+ else{
+ if(selectedLayer==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
+ }
+
+ selectedMap=i;
+ selectedWMS=ii;
+ selectedLayer=iii;
+}
+
+function updateScale(){
+ if(!initialized)return;
+ myMapObj = getMapObjByName(mod_treeGDE_map);
+ if(myMapObj){
+ var scale = parseInt( mb_getScale(mod_treeGDE_map));
+ for(var ii=0; ii< myMapObj.wms.length; ii++){
+ for(var iii=1; iii< myMapObj.wms[ii].objLayer.length; iii++){
+ if(scale < parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) != 0){
+ if(iii==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
+ }
+ else if(scale > parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
+ if(iii==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
+ }
+ else{
+ if(iii==0)
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '');
+ else
+ setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '');
+ }
+ }
+ }
+ }
+ }
+
+function updateCheckState(){
+ if(!initialized||lock_check)return;
+ lock_check=true;
+ for(var i=0; i< mb_mapObj.length; i++){
+ var scale = parseInt( mb_getScale(mod_treeGDE_map));
+ if( mb_mapObj[i].elementName == mod_treeGDE_map){
+ for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+ for(var iii=1; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
+ if(! mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
+ path = arrNodes[0][0]+"|wms_"+ mb_mapObj[i].wms[ii].wms_id+"|"+ mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
+ checkNode(path, 0, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
+ if(ficheckbox == 'true')
+ checkNode(path, 1, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);
+ }
+ }
+ }
+ }
+ }
+ lock_check=false;
+}
+
+function operaLoad(){
+ initArray();
+ renderTree();
+ setTimeout('initWmsCheckboxen();updateScale();',100);
+}
+
+function loadTree(){
+ if(wmsbuttons=='true'){
+ var div = document.createElement("div");
+ div.innerHTML = '<a href="javascript:move_up()"><img title="'+msgObj.tooltipMoveSelectionUp+'" src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a><a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a><a href="javascript:remove_wms()"><img title="'+msgObj.tooltipRemoveWms+'" src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>';
+ document.getElementById("treeGDE").appendChild(div);
+ }
+ var div = document.createElement("div");
+ div.id = "treeContainer"
+ document.getElementById("treeGDE").appendChild(div);
+
+ if(window.opera){
+ setTimeout('operaLoad()',200);
+ return;
+ }
+ initArray();
+ renderTree();
+ initWmsCheckboxen();
+ updateScale();
+}
+
+function reloadTree(){
+ if(!initialized) return;
+ selectedMap=-1;
+ selectedWMS=-1;
+ selectedLayer=-1;
+ initialized=false;
+ arrNodes = eval(arrNodesStr)
+ initArray();
+ if(showstatus=='true'||alerterror=='true')
+ init_mapcheck();
+ renderTree();
+ if(window.opera)
+ setTimeout('initWmsCheckboxen();updateScale();',100);
+ else{
+ initWmsCheckboxen();
+ updateScale();
+ }
+}
+
+function imgerror(t){
+ var map= getMapObjIndexByName(mod_treeGDE_map);
+ var wms=Number(t.id.substr(4));
+ t.onerror=null;
+ t.onabort=null;
+ if(state[wms]!=-1 && alerterror=='true'){
+ state[wms]=-1;
+ if(confirm('Failed to Load WMS "'+ mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+ mb_mapObj[map].wms[wms].wms_getmap.substr(0, mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
+ window.open(t.src,"");
+ }
+ }
+ state[wms]=-1;
+ errors++;
+ if(showstatus=='true')
+ setNodeImage(arrNodes[0][0]+"|wms_"+ mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
+}
+
+function checkComplete(wms, map, img, first){
+ var ind= getMapObjIndexByName(mod_treeGDE_map);
+ if( mb_mapObj[ind].wms[wms].mapURL == false || mb_mapObj[ind].getDomElement().ownerDocument.getElementById(map).complete){
+ if(state[wms]!=-1){
+ for(var i=1;i< mb_mapObj[ind].wms[wms].objLayer.length;i++){
+ if( mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
+ state[wms]=1;
+ if(showstatus=='true')
+ setNodeImage(img);
+ break;
+ }
+ }
+ }
+ }
+ else{
+ if(first){
+ state[wms]=0;
+// frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
+// frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
+
+ if(showstatus=='true')
+ setNodeImage(img, "loading_folder.gif");
+ }
+
+ if(state[wms]!=-1)
+ setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
+ }
+}
+
+// mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
+
+function init_mapcheck(){
+ if(!initialized)return;
+ errors = 0;
+ var ind = getMapObjIndexByName(mod_treeGDE_map);
+ if(! mb_mapObj[ind]||!initialized){
+ setTimeout("init_mapcheck();",100);
+ return;
+ }
+ for(var wms=0;wms< mb_mapObj[ind].wms.length;wms++){
+ var wmsimgid=mod_treeGDE_map+"_map_"+wms;
+ if( mb_mapObj[ind].getDomElement().ownerDocument.getElementById(wmsimgid)){
+ checkComplete(wms, wmsimgid, arrNodes[0][0]+'|wms_'+ mb_mapObj[ind].wms[wms].wms_id, true);
+ }
+ }
+}
+
+function handleSelectedLayer(mapObj,wms_id,layername,type,status){
+ if(lock_update||lock_check)return;
+ var ind = getMapObjIndexByName(mapObj);
+ for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+ if( mb_mapObj[ind].wms[i].wms_id == wms_id){
+ mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
+ break;
+ }
+ }
+}
+
+function zoomToLayer(j,k,l){
+ if(!j&&!k&&!l){
+ j=selectedMap;
+ k=selectedWMS;
+ l=selectedLayer;
+ }
+ var my= mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
+ for (var i=0;i<my.length;i++){
+ if(my[i]["epsg"]== mb_mapObj[j].epsg){
+ mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
+ var arrayExt = mb_mapObj[j].extent.toString().split(",");
+ mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+ break;
+ }
+ }
+}
+
+
+//---begin------------- opacity --------------------
+
+var opacityIncrement = 20;
+
+function opacity_up(j, k, l) {
+ handleOpacity(j, k, opacityIncrement);
+}
+
+function opacity_down(j, k, l) {
+ handleOpacity(j, k, -opacityIncrement);
+}
+
+function handleOpacity(mapObj_id, wms_id, increment) {
+ var opacity = mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity*100 + increment;
+ mb_mapObj[mapObj_id].wms[wms_id].setOpacity(opacity);
+ reloadTree();
+}
+
+//---end------------- opacity --------------------
+
+function move_up(j,k,l){
+ if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+ j=selectedMap;
+ k=selectedWMS;
+ l=selectedLayer;
+ }
+ if(j==-1||k==-1||l==-1){
+ alert("<?php echo _mb('You have to select the WMS you want to move up!');?> ")
+ return;
+ }
+ var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
+ if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
+ alert("<?php echo _mb('Illegal move operation');?>");
+ return;
+ }
+ treeState = getState();
+ mb_mapObj[j].zoom(true, 1.0);
+ mb_execloadWmsSubFunctions();
+ //find layer and select
+ for(k=0;k< mb_mapObj[j].wms.length;k++){
+ for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
+ if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+ select(j,k,l);
+ if(l!=0)
+ selectNode(String(lid));
+ else
+ selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
+ }
+ }
+ }
+}
+
+function move_down(j,k,l){
+ if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+ j=selectedMap;
+ k=selectedWMS;
+ l=selectedLayer;
+ }
+ if(j==-1||k==-1||l==-1){
+ alert("<?php echo _mb('You have to select the WMS you want to move down!');?>")
+ return;
+ }
+ var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
+ if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
+ alert("<?php echo _mb('Illegal move operation');?>");
+ return;
+ }
+ treeState = getState();
+ mb_mapObj[j].zoom(true, 1.0);
+ mb_execloadWmsSubFunctions();
+ //find layer and select
+ for(k=0;k< mb_mapObj[j].wms.length;k++){
+ for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
+ if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+ select(j,k,l);
+ if(l!=0)
+ selectNode(String(lid));
+ else
+ selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
+ }
+ }
+ }
+}
+
+function remove_wms(j,k,l){
+ if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+ j=selectedMap;
+ k=selectedWMS;
+ l=selectedLayer;
+ }
+ if(j==-1||k==-1||l==-1){
+ alert("<?php echo _mb('You have to select the WMS you want to delete!');?>")
+ return;
+ }
+ if(l!=0){
+ alert("<?php echo _mb('It is not possible to delete a single layer, please select a WMS!');?>")
+ return;
+ }
+ var visibleWMS=0;
+ for(var i=0;i< mb_mapObj[j].wms.length;i++)
+ if( mb_mapObj[j].wms[i].gui_wms_visible=='1'|| mb_mapObj[j].wms[i].gui_wms_visible==1)
+ visibleWMS++;
+ if(visibleWMS<=1){
+ alert ("<?php echo _mb('Last WMS can not be removed.');?>");
+ return;
+ }
+ if(confirm('<?php echo _mb("Are you sure you want to remove");?>' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
+ mb_mapObjremoveWMS(j,k);
+ mb_mapObj[j].zoom(true, 1.0);
+ mb_execloadWmsSubFunctions();
+ }
+}
+
+function updateParent(path){
+ if(lock_check)return;
+ var reset_lock=!lock_update;
+ lock_update=true;
+ var state=getChildrenCheckState(path, 0);
+ //enableCheckbox(path, (state!=-1)); //3rd state
+ checkNode(path, 0, (state==1));
+ if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
+ setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+ }
+ if(reset_lock)
+ lock_update=false;
+}
+
+function handleSelectedWMS(path){
+ if(lock_update)return;
+ var t = path.split("|");
+ var wms_id = t[t.length-1].substr(4);
+ var reset_lock=!lock_check;
+ var ind = getMapObjIndexByName(mod_treeGDE_map);
+ var wms = getWMSIndexById(mod_treeGDE_map,wms_id);
+ var layername = mb_mapObj[ind].wms[wms].objLayer[0].layer_name;
+ var bChk = IsChecked(path, 0);
+ mb_mapObj[ind].wms[wms].handleLayer(layername,"visible",bChk?"1":"0");
+ mb_mapObj[ind].wms[wms].handleLayer(layername,"querylayer",bChk?"1":"0");
+ lock_check=true;
+ checkChildren(path, 0, bChk);
+ if(ficheckbox)checkChildren(path, 1, bChk);
+ if(bChk==false && showstatus=='true')
+ setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+ if(reset_lock)
+ {
+ mb_restateLayers(mod_treeGDE_map,wms_id);
+ setSingleMapRequest(mod_treeGDE_map,wms_id);
+ lock_check=false;
+ }
+}
+
+function handleSelection(path, box){
+ if(lock_update)return;
+ var reset_lock=!lock_check;
+ lock_check=true;
+ var bChk = IsChecked(path, box);
+// enableCheckbox(path, 0, true);
+ checkChildren(path, box, bChk);
+ if(reset_lock){
+ //find wms id from path
+ var t = path.split("|");
+ for(var i=1;t[i].indexOf("wms_")!=0;i++){}
+ var wms_id = t[i].substr(4);
+ //set maprequest
+ mb_restateLayers(mod_treeGDE_map,wms_id);
+ if(box==0)
+ setSingleMapRequest(mod_treeGDE_map,wms_id);
+ lock_check=false;
+ }
+}
+
+function initArray(){
+ var parentObj = "";
+ var controls="";
+ if( mb_mapObj.length > 0){
+ for(var i=0; i< mb_mapObj.length; i++){
+ if( mb_mapObj[i].elementName == mod_treeGDE_map){
+ for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+ if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+ for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
+ var temp = mb_mapObj[i].wms[ii].objLayer[iii];
+ if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
+ if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
+ continue;
+
+ parentNode = arrNodes[0][0];
+ if(eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id) !== undefined)
+ parentNode = eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id);
+ else
+ eval("categories['wms_"+ mb_mapObj[i].wms[ii].wms_id+"'] = parentNode");
+
+ var c_menu="[";
+ if(reverse=="true"){
+ if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
+ if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
+ }
+ else{
+ if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
+ if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
+ }
+ if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
+// if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
+ if(menu.indexOf("opacity_up")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
+ if(menu.indexOf("opacity_down")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
+ if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+ c_menu+="]";
+ controls=null;
+ if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+parentNode+'|wms_'+ mb_mapObj[i].wms[ii].wms_id+'\');" />';
+ if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
+ addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
+ parentObj = parentNode+"|wms_"+ mb_mapObj[i].wms[ii].wms_id;
+ }
+ if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"|| mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
+ var parentLayer = "";
+ var j = iii;
+ while( mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
+ //find parent
+ for(var jj=0; jj < mb_mapObj[i].wms[ii].objLayer.length; jj++){
+ if( mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt( mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
+ j=jj;
+ break;
+ }
+ }
+ parentLayer = "|" + mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
+ }
+ if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
+ var c_menu="[";
+ if(reverse=="true"){
+ if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
+ if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
+ }
+ else{
+ if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
+ if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
+ }
+ if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
+ if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
+// if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
+// if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
+ if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+ c_menu+="]";
+
+ controls = [];
+ controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerVisible + '" ');
+ if(temp.layer_name=="")
+ controls.push('style="display:none;" ');
+ if(temp.gui_layer_visible=='1')
+ controls.push('checked ');
+ if(temp.gui_layer_selectable!='1')
+ controls.push('disabled ');
+ controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);");
+ if(ficheckbox == 'false')
+ controls.push("handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+ controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);");
+ controls.push("updateParent('"+parentObj+parentLayer+"');\" />");
+ if(ficheckbox == 'true'){
+ controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerQuerylayer + '" ');
+ if(temp.gui_layer_querylayer=='1')
+ controls.push('checked ');
+ if(temp.gui_layer_queryable!='1')
+ controls.push('disabled ');
+ controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+ controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
+ }
+ if(wmsbuttons == 'true'&&metadatalink == 'true'){
+ controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');
+ }
+ addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ initialized=true;
+}
+
+function initWmsCheckboxen(){
+ var hidden=0;
+ if( mb_mapObj.length > 0){
+ for(var i=0; i< mb_mapObj.length; i++){
+ if( mb_mapObj[i].elementName == mod_treeGDE_map){
+ for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
+ if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+ for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
+ var temp = mb_mapObj[i].wms[ii].objLayer[iii];
+ if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
+ updateParent(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ii].wms_id);
+ }
+ }
+ }
+ else if(ii<= parseInt(openfolder)+hidden)
+ hidden++;
+ }
+ closeAll()
+ if(treeState!='')
+ setState(treeState);
+ else if(openfolder!='false')
+ setState(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ parseInt(openfolder)+hidden].wms_id);
+ }
+ }
+ }
+}
Copied: branches/google_dev/trunk/http/img (from rev 3847, trunk/mapbender/http/img)
Deleted: branches/google_dev/trunk/http/include/dyn_css.php
===================================================================
--- trunk/mapbender/http/include/dyn_css.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/include/dyn_css.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,129 +0,0 @@
-<?php
-# $Id$
-# $Header: /cvsroot/mapbender/mapbender/http/classes/class_wfs.php,v 1.15 2006/03/09 13:55:46 uli_rothstein Exp $
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__) . "/../../conf/mapbender.conf");
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
-
-if(!isset($gui_id) && isset($_REQUEST["guiID"])){
- $gui_id = $_REQUEST["guiID"];
-}
-if(!isset($_REQUEST["e_id_css"]) && isset($_REQUEST["elementID"])){
- $e_id_css = $_REQUEST["elementID"];
-}
-if(isset($_REQUEST["e_id_css"])){
- $e_id_css = $_REQUEST["e_id_css"];
-}
-if(isset($gui_id) && $gui_id != ""){
- #echo $gui_id. " - ".$_REQUEST["e_id_css"];
- if (isset($e_id_css) && $e_id_css != '') {
- #
- #
- # css file
- #
- #
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='file/css'";
- $v = array($e_id_css,$gui_id);
- $t = array('s','s');
- $res = db_prep_query($sql,$v,$t);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$row["var_value"]."\" />\n";
- }
-
-
-
- #
- #
- # css text
- #
- #
-
-
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='text/css'";
- $v = array($e_id_css,$gui_id);
- $t = array('s','s');
- $res = db_prep_query($sql,$v,$t);
- $cnt = 0;
- $style = "";
- while($row = db_fetch_array($res)){
- $style .= $row["var_value"]."\n";
- }
- if ($style) {
- echo "<style type=\"text/css\">\n";
- echo "<!--\n";
- echo $style;
- echo "-->\n";
- echo "</style>\n";
- }
- }
-
- #
- #
- # php variables
- #
- #
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='php_var'";
- $v = array($e_id_css,$gui_id);
- $t = array('s','s');
- $res = db_prep_query($sql,$v,$t);
-
- echo "\n";
- while($row = db_fetch_array($res))
- {
- $$row["var_name"] = stripslashes($row["var_value"]);
- echo "\n";
- }
-
-
-
- #
- #
- # JavaScript variables
- #
- #
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='var'";
- $v = array($e_id_css,$gui_id);
- $t = array('s','s');
- $res = db_prep_query($sql,$v,$t);
-
- echo "\n";
- echo "<script type=\"text/javascript\">\n";
- echo "<!--\n";
- $arrays = array();
- $i=-1;
- while($row = db_fetch_array($res))
- {
- if (mb_strpos($row["var_name"], "[")) {
- $arrayname = mb_substr($row["var_name"], 0, mb_strpos($row["var_name"], "["));
- if (!in_array($arrayname, $arrays)) {
- $i++;
- $arrays[$i] = $arrayname;
- echo "var " . $arrayname . " = new Array();\n";
- }
- }
- else {
- echo "var ";
- }
- echo $row["var_name"]." = '".stripslashes($row["var_value"])."';\n";
- }
- echo "// -->\n";
- echo "</script>\n";
-}
- ?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/include/dyn_css.php (from rev 3850, trunk/mapbender/http/include/dyn_css.php)
===================================================================
--- branches/google_dev/trunk/http/include/dyn_css.php (rev 0)
+++ branches/google_dev/trunk/http/include/dyn_css.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,137 @@
+<?php
+# $Id$
+# $Header: /cvsroot/mapbender/mapbender/http/classes/class_wfs.php,v 1.15 2006/03/09 13:55:46 uli_rothstein Exp $
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__) . "/../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+if(!isset($gui_id) && isset($_REQUEST["guiID"])){
+ $gui_id = $_REQUEST["guiID"];
+}
+if(!isset($_REQUEST["e_id_css"]) && isset($_REQUEST["elementID"])){
+ $e_id_css = $_REQUEST["elementID"];
+}
+if(isset($_REQUEST["e_id_css"])){
+ $e_id_css = $_REQUEST["e_id_css"];
+}
+if(isset($gui_id) && $gui_id != ""){
+ #echo $gui_id. " - ".$_REQUEST["e_id_css"];
+ if (isset($e_id_css) && $e_id_css != '') {
+ #
+ #
+ # css file
+ #
+ #
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='file/css'";
+ $v = array($e_id_css,$gui_id);
+ $t = array('s','s');
+ $res = db_prep_query($sql,$v,$t);
+ $cnt = 0;
+ while($row = db_fetch_array($res)){
+ echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$row["var_value"]."\" />\n";
+ }
+
+
+
+ #
+ #
+ # css text
+ #
+ #
+
+
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='text/css'";
+ $v = array($e_id_css,$gui_id);
+ $t = array('s','s');
+ $res = db_prep_query($sql,$v,$t);
+ $cnt = 0;
+ $style = "";
+ while($row = db_fetch_array($res)){
+ $style .= $row["var_value"]."\n";
+ }
+ if ($style) {
+ echo "<style type=\"text/css\">\n";
+ echo "<!--\n";
+ echo $style;
+ echo "-->\n";
+ echo "</style>\n";
+ }
+ }
+
+ #
+ #
+ # php variables
+ #
+ #
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='php_var'";
+ $v = array($e_id_css,$gui_id);
+ $t = array('s','s');
+ $res = db_prep_query($sql,$v,$t);
+
+ echo "\n";
+ while($row = db_fetch_array($res))
+ {
+ $$row["var_name"] = stripslashes($row["var_value"]);
+ echo "\n";
+ }
+
+
+
+ #
+ #
+ # JavaScript variables
+ #
+ #
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='var'";
+ $v = array($e_id_css,$gui_id);
+ $t = array('s','s');
+ $res = db_prep_query($sql,$v,$t);
+
+ echo "\n";
+ echo "<script type=\"text/javascript\">\n";
+ echo "<!--\n";
+ $arrays = array();
+ $i=-1;
+ while($row = db_fetch_array($res))
+ {
+ if (mb_strpos($row["var_name"], "[")) {
+ $arrayname = mb_substr($row["var_name"], 0, mb_strpos($row["var_name"], "["));
+ if (!in_array($arrayname, $arrays)) {
+ $i++;
+ $arrays[$i] = $arrayname;
+ echo "var " . $arrayname . " = new Array();\n";
+ }
+ }
+ else {
+ echo "var ";
+ }
+ if (is_numeric(stripslashes($row["var_value"]))) {
+ echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
+ }
+ elseif (strpos(stripslashes($row["var_value"]), "[") === 0 || strpos(stripslashes($row["var_value"]), "{") === 0) {
+ echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
+ }
+ else {
+ echo $row["var_name"]." = '".str_replace(array('"',"'", "\r", "\n", "\0"), array('\"','\\\'','\r', '\n', '\0'), stripslashes($row["var_value"]))."';\n";
+ }
+ }
+ echo "// -->\n";
+ echo "</script>\n";
+}
+ ?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/include/dyn_js.php
===================================================================
--- trunk/mapbender/http/include/dyn_js.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/include/dyn_js.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,55 +0,0 @@
-<?php
-# $Id$
-# $Header: /cvsroot/mapbender/mapbender/http/classes/class_wfs.php,v 1.15 2006/03/09 13:55:46 uli_rothstein Exp $
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
-
-if(isset($gui_id))
-{
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='var'";
- $v = array($e_id,$gui_id);
- $t = array('s','s');
- $res = db_prep_query($sql,$v,$t);
- $arrays = array();
- echo "\n";
- while($row = db_fetch_array($res))
- {
- if (mb_strpos($row["var_name"], "[")) {
- $arrayname = mb_substr($row["var_name"], 0, mb_strpos($row["var_name"], "["));
-
- if (!in_array($arrayname, $arrays)) {
- $i++;
- $arrays[$i] = $arrayname;
- echo "var " . $arrayname . " = new Array();\n";
- }
- }
- else {
- echo "var ";
- }
- if (is_numeric(stripslashes($row["var_value"]))) {
- echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
- }
- else {
- echo $row["var_name"]." = '".str_replace(array('"',"'", "\r", "\n", "\0"), array('\"','\\\'','\r', '\n', '\0'), stripslashes($row["var_value"]))."';\n";
- }
- }
-}
-else {
- $e = new mb_exception("Application ID not set while retrieving element vars of module " . $e_id);
-}
-?>
Copied: branches/google_dev/trunk/http/include/dyn_js.php (from rev 3850, trunk/mapbender/http/include/dyn_js.php)
===================================================================
--- branches/google_dev/trunk/http/include/dyn_js.php (rev 0)
+++ branches/google_dev/trunk/http/include/dyn_js.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,58 @@
+<?php
+# $Id$
+# $Header: /cvsroot/mapbender/mapbender/http/classes/class_wfs.php,v 1.15 2006/03/09 13:55:46 uli_rothstein Exp $
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+
+if(isset($gui_id))
+{
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = $1 AND fkey_gui_id = $2 and var_type='var'";
+ $v = array($e_id,$gui_id);
+ $t = array('s','s');
+ $res = db_prep_query($sql,$v,$t);
+ $arrays = array();
+ echo "\n";
+ while($row = db_fetch_array($res))
+ {
+ if (mb_strpos($row["var_name"], "[")) {
+ $arrayname = mb_substr($row["var_name"], 0, mb_strpos($row["var_name"], "["));
+
+ if (!in_array($arrayname, $arrays)) {
+ $i++;
+ $arrays[$i] = $arrayname;
+ echo "var " . $arrayname . " = new Array();\n";
+ }
+ }
+ else {
+ echo "var ";
+ }
+ if (is_numeric(stripslashes($row["var_value"]))) {
+ echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
+ }
+ elseif (strpos(stripslashes($row["var_value"]), "[") === 0 || strpos(stripslashes($row["var_value"]), "{") === 0) {
+ echo $row["var_name"]." = ".stripslashes($row["var_value"]).";\n";
+ }
+ else {
+ echo $row["var_name"]." = '".str_replace(array('"',"'", "\r", "\n", "\0"), array('\"','\\\'','\r', '\n', '\0'), stripslashes($row["var_value"]))."';\n";
+ }
+ }
+}
+else {
+ $e = new mb_exception("Application ID not set while retrieving element vars of module " . $e_id);
+}
+?>
Deleted: branches/google_dev/trunk/http/index.php
===================================================================
--- trunk/mapbender/http/index.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/index.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,152 +0,0 @@
-<?php
-# $Id$
-# maintained by http://www.mapbender.org/index.php/User:Astrid_Emde
-# http://www.mapbender.org/index.php/Mapbender_Portal
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-include_once(dirname(__FILE__)."/../core/system.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN">
-<html>
-<head>
-<!--
-Licensing: See the GNU General Public License for more details.
-http://www.gnu.org/copyleft/gpl.html
-or:
-mapbender/licence/
--->
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Welcome to the Mapbender Portal</title>
-<link rel="stylesheet" type="text/css" href="css/mapbender.css" />
-<script type="text/javascript">
-<!--
-function changeTarget()
-{
- if (window.frames[0].document.forms['loginForm'].target){
- window.frames['login'].document.forms['loginForm'].setAttribute("target","_blank");
- }
- else{
- window.frames[0].document.forms['loginForm'].setAttribute("target","_blank");
- }
-}
-// -->
-</script>
-<body onload='changeTarget()'>
-
-<table BGCOLOR="#ffffff" width="70%" height="70%" ALIGN="top" CELLSPACING="0" CELLPADDING="10" STYLE="-moz-border-radius:8px; border:2px #000000 solid;">
-<tr><td COLSPAN="2" VALIGN="center" STYLE="margin-bottom:0px; padding-bottom:0px;">
-<div class="mapbender_headline" >
- <font align="left" color="#000000"> Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font>
-</div>
-
-<hr STYLE="color:#629093; height:2px; margin:0px; padding:0px;" WIDTH="100%" NOSHADE COLOR="#808080">
-</td></tr>
-<tr><td WIDTH="210" VALIGN="TOP">
-<table width="92%" height="99%" cellspacing="1" cellpadding="3" STYLE="-moz-border-radius:8px; border:2px #808080 solid;">
-<tr>
- <td bgcolor="#F0F0F0" valign="top">
- <br>
- <a href="http://www.mapbender.org" target="_blank"><b>Homepage</b></a><br>
- <br>
- <a href="http://www.mapbender.org/index.php/Tutorials" target="_blank"><b>Documentation</b></a><br>
- <br>
- <a href="http://www.mapbender.org/Mapbender_Gallery" target="_blank"><b>Application Gallery</b></a><br>
- <br>
- <a href="http://wms.wheregroup.com/mapbender/frames/login.php?name=mb&password=mb&mb_user_myGui=mapbender_user" target="_blank"><b>Mapbender User Map</b></a><br>
- <br>
- <a href="http://mapbender.osgeo.org" target="_blank"><b>Mapbender on OSGeo</b></a><br>
- <br>
- <br>
- <br>
- <a href="http://www.mapbender.org/download/" target="_blank"><b>Download</b></a><br>
- <br>
- <a href="http://www.mapbender.org/index.php/SVN" target="_blank"><b>Source Code Repository</b></a><br>
- <br>
- <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_users" target="_blank"><b>User Mailing List</b></a><br>
- <br>
- <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank"><b>Devel Mailing List</b></a><br>
- <br>
- <a href="http://www.mapbender.org/index.php/Bugs" target="_blank"><b>Bug & Issue Tracker</b></a><br>
- <br>
- <br>
- <br>
- <a href="http://mapbender.telascience.org/" target="_blank"><b>Mapbender Development Server</b></a><br>
- <br>
- <br>
- <a href="http://www.osgeo.org" title="Open Source Geospatial Foundation" alt="Link to the OSGeo Portal" target="_blank">
- <br>
- <img title="OSGeo logo" src = "./img/OSGeo_150pix.png">
- </a>
- <br><br>
- Mapbender is an official OSGeo Project licensed under the <a href="http://www.gnu.org/licenses/licenses.html#GPL" title="GNU GPL license" alt="Link to the GNU license">GNU GPL</a>
- <br>
- </td>
-</tr>
-</table>
-<br>
-<br>
-</td>
-
-<td WIDTH="480" VALIGN="TOP" STYLE="line-height:133%">
-<div>
- <table width="93%" cellspacing="1" cellpadding="5" STYLE="-moz-border-radius:8px; border:2px #808080 solid;">
- <tr><td bgcolor="#F0F0F0">
-
- <div class="mapbender_welcome">Welcome to <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font></div>
-
- <font color="#ff0000">Mapbender Version <?php echo MB_VERSION_NUMBER." ".MB_VERSION_APPENDIX?> (<?php echo date("F jS, Y",MB_RELEASE_DATE);?>)</font>
- </td></tr>
- </table>
-<br>
-
-<table width="93%" cellspacing="1" cellpadding="5" STYLE="-moz-border-radius:8px; border:1px #808080 solid;">
-<tr><td bgcolor="#ffffff">
-<p>
- <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> is the geospatial portal site management software for OGC OWS architectures. Mapbender comes with a data model to manage interfaces for displaying, navigating and querying OGC compliant web map and feature services (WMS and transactional WFS). Authentication and authorization are used by the <a href="http://www.mapbender.org/index.php/Mapbender_Security_Proxy" title="Mapbender OWS Security Proxy">OWS Security Proxy</a> and management interfaces for multi client capable user, group and service administration. The embedded metadata component follows ISO 19119 specification.
-</p>
-</td></tr>
-</table>
-<br>
-<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
- <tr><td bgcolor="#ffffff">
- <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> Login
- <br>
- <iframe id='login' name='login' scrolling="no" frameborder='0' src ='frames/login.php' style ='width:400;height:100;' >
- </iframe>
- </td></tr>
-</table>
-<br>
-<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
-<tr><td bgcolor="#ffffff">
-
- Create new user (neuen Benutzer anlegen)
-
- <iframe id='createUser' name='createUser' scrolling="auto" frameborder='0' src ='php/mod_createUser.php' style ='width:400;height:242;' >
- </iframe>
-</table>
-<br>
-<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
-<tr><td bgcolor="#ffffff">
-Have a lot of fun with
-<font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> !
-</td></tr>
-</table>
-</body>
-</html>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/index.php (from rev 3795, trunk/mapbender/http/index.php)
===================================================================
--- branches/google_dev/trunk/http/index.php (rev 0)
+++ branches/google_dev/trunk/http/index.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,155 @@
+<?php
+# $Id$
+# maintained by http://www.mapbender.org/index.php/User:Astrid_Emde
+# http://www.mapbender.org/index.php/Mapbender_Portal
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+include_once(dirname(__FILE__)."/../core/system.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN">
+<html>
+<head>
+<!--
+Licensing: See the GNU General Public License for more details.
+http://www.gnu.org/copyleft/gpl.html
+or:
+mapbender/licence/
+-->
+<meta name="author" content="The Mapbender Development Team">
+<meta name="description" content="Initial start page for the geoportal software Mapbender">
+<meta name="keywords" content="Mapbender, Geoportal, GIS, SDI, GDI, OSGeo, Free Software, OGC, WMS, WFS, WFS Transactional, WMS Client, Digitizing">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Welcome to the Mapbender Portal</title>
+<link rel="stylesheet" type="text/css" href="css/mapbender.css" />
+<script type="text/javascript">
+<!--
+function changeTarget()
+{
+ if (window.frames[0].document.forms['loginForm'].target){
+ window.frames['login'].document.forms['loginForm'].setAttribute("target","_blank");
+ }
+ else{
+ window.frames[0].document.forms['loginForm'].setAttribute("target","_blank");
+ }
+}
+// -->
+</script>
+<body onload='changeTarget()'>
+
+<table BGCOLOR="#ffffff" width="70%" height="70%" ALIGN="top" CELLSPACING="0" CELLPADDING="10" STYLE="-moz-border-radius:8px; border:2px #000000 solid;">
+<tr><td COLSPAN="2" VALIGN="center" STYLE="margin-bottom:0px; padding-bottom:0px;">
+<div class="mapbender_headline" >
+ <font align="left" color="#000000"> Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font>
+</div>
+
+<hr STYLE="color:#629093; height:2px; margin:0px; padding:0px;" WIDTH="100%" NOSHADE COLOR="#808080">
+</td></tr>
+<tr><td WIDTH="210" VALIGN="TOP">
+<table width="92%" height="99%" cellspacing="1" cellpadding="3" STYLE="-moz-border-radius:8px; border:2px #808080 solid;">
+<tr>
+ <td bgcolor="#F0F0F0" valign="top">
+ <br>
+ <a href="http://www.mapbender.org" target="_blank"><b>Homepage</b></a><br>
+ <br>
+ <a href="http://www.mapbender.org/index.php/Tutorials" target="_blank"><b>Documentation</b></a><br>
+ <br>
+ <a href="http://www.mapbender.org/Mapbender_Gallery" target="_blank"><b>Application Gallery</b></a><br>
+ <br>
+ <a href="http://wms.wheregroup.com/mapbender/frames/login.php?name=mb&password=mb&mb_user_myGui=mapbender_user" target="_blank"><b>Mapbender User Map</b></a><br>
+ <br>
+ <a href="http://www.osgeo.org/mapbender" target="_blank"><b>OSGeo InfoSheet</b></a><br>
+ <br>
+ <br>
+ <br>
+ <a href="http://www.mapbender.org/download/" target="_blank"><b>Download</b></a><br>
+ <br>
+ <a href="http://www.mapbender.org/index.php/SVN" target="_blank"><b>Source Code Repository</b></a><br>
+ <br>
+ <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_users" target="_blank"><b>User Mailing List</b></a><br>
+ <br>
+ <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank"><b>Devel Mailing List</b></a><br>
+ <br>
+ <a href="http://www.mapbender.org/index.php/Bugs" target="_blank"><b>Bug & Issue Tracker</b></a><br>
+ <br>
+ <br>
+ <br>
+ <a href="http://mapbender.telascience.org/" target="_blank"><b>Mapbender Development Server</b></a><br>
+ <br>
+ <br>
+ <a href="http://www.osgeo.org" title="Open Source Geospatial Foundation" alt="Link to the OSGeo Portal" target="_blank">
+ <br>
+ <img title="OSGeo logo" src = "./img/OSGeo_logo.png">
+ </a>
+ <br><br>
+ Mapbender is an official OSGeo Project licensed under the <a href="http://www.gnu.org/licenses/licenses.html#GPL" title="GNU GPL license" alt="Link to the GNU license">GNU GPL</a>
+ <br>
+ </td>
+</tr>
+</table>
+<br>
+<br>
+</td>
+
+<td WIDTH="480" VALIGN="TOP" STYLE="line-height:133%">
+<div>
+ <table width="93%" cellspacing="1" cellpadding="5" STYLE="-moz-border-radius:8px; border:2px #808080 solid;">
+ <tr><td bgcolor="#F0F0F0">
+
+ <div class="mapbender_welcome">Welcome to <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font></div>
+
+ <font color="#ff0000">Mapbender Version <?php echo MB_VERSION_NUMBER." ".MB_VERSION_APPENDIX?> (<?php echo date("F jS, Y",MB_RELEASE_DATE);?>)</font>
+ </td></tr>
+ </table>
+<br>
+
+<table width="93%" cellspacing="1" cellpadding="5" STYLE="-moz-border-radius:8px; border:1px #808080 solid;">
+<tr><td bgcolor="#ffffff">
+<p>
+ <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> is the geospatial portal site management software for OGC OWS architectures. Mapbender has a data model to manage, display, navigate, query and catalog OGC compliant web map and feature services (WMS and transactional WFS). The basic authentication module can be connected with existing systems and allows multi client capable user manangement, authorization, group and service administration. <a href="http://www.mapbender.org/index.php/Mapbender_Security_Proxy" title="Mapbender OWS Security Proxy">OWS Security Proxy</a> acts as a facade for OGC services and controls access and logs operations on services and layers on user and group basis.
+</p>
+</td></tr>
+</table>
+<br>
+<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
+ <tr><td bgcolor="#ffffff">
+ <font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> Login
+ <br>
+ <iframe id='login' name='login' scrolling="no" frameborder='0' src ='frames/login.php' style ='width:400;height:100;' >
+ </iframe>
+ </td></tr>
+</table>
+<br>
+<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
+<tr><td bgcolor="#ffffff">
+
+ Create new user (neuen Benutzer anlegen)
+
+ <iframe id='createUser' name='createUser' scrolling="auto" frameborder='0' src ='php/mod_createUser.php' style ='width:400;height:242;' >
+ </iframe>
+</table>
+<br>
+<table width="93%" cellspacing="1" cellpadding="4" STYLE="-moz-border-radius:6px; border:1px #808080 solid;">
+<tr><td bgcolor="#ffffff">
+Have a lot of fun with
+<font align="left" color="#000000">Ma</font><font color="#0000CE">p</font><font color="#C00000">b</font><font color="#000000">ender</font> !
+</td></tr>
+</table>
+</body>
+</html>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/javascripts (from rev 3887, trunk/mapbender/http/javascripts)
Deleted: branches/google_dev/trunk/http/javascripts/geometry.js
===================================================================
--- trunk/mapbender/http/javascripts/geometry.js 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/geometry.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,2179 +0,0 @@
-/*
-* $Id$
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
-*/
-// http://www.mapbender.org/index.php/GeometryArray.js
-
-
-var nameGeometryArray = "GeometryArray";
-var nameMultiGeometry = "MultiGeometry";
-var nameGeometry = "Geometry";
-
-/**
- * @class A class representing geometry types "polygon", "line" and "point".
- *
- * @constructor
- */
-function GeomType(){
- /**
- * An identifier for polygons. If you want to check if a {@link MultiGeometry}
- * or {@link Geometry} is a polygon, write
- * if (someGeometry.geomType == geomType.polygon
- *
- * @type String
- */
- this.polygon = "polygon";
-
- /**
- * An identifier for polygons. If you want to check if a {@link MultiGeometry}
- * or {@link Geometry} is a line, write
- * if (someGeometry.geomType == geomType.line
- *
- * @type String
- */
- this.line = "line";
-
- /**
- * An identifier for polygons. If you want to check if a {@link MultiGeometry}
- * or {@link Geometry} is a point, write
- * if (someGeometry.geomType == geomType.point
- *
- * @type String
- */
- this.point = "point";
-}
-var geomType = new GeomType();
-
-
-/**
- * @class a {@link GeometryArray} is a {@link List} of {@link MultiGeometry} objects
- *
- * @ extends List
- * @ requires MultiGeometry
- * @ requires Geometry
- * @ requires Point
- * @ constructor
- */
-function GeometryArray(){
-
- /*
- * creates a new, empty Multigeometry and adds it to this GeometryArray
- *
- * @param {String} geomType a {@link GeomType}
- */
- this.addMember = function(geomType){
- this.add(new MultiGeometry(geomType));
- };
-
- /**
- * @ignore
- */
- this.name = nameGeometryArray;
-
- /**
- * A {@link List} of {@link MultiGeometry} objects.
- *
- * @type List
- */
- this.list = [];
-}
-
-GeometryArray.prototype = new List();
-
-/**
- * gets the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @type Geometry
- */
-GeometryArray.prototype.getGeometry = function(i,j){
- var tmp = this.get(i);
- return tmp.get(j);
-};
-
-/**
- * gets the k-th Point of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @param {Integer} k index of the Point
- * @type Point
- * @returns the Point object at the given indices
- */
-GeometryArray.prototype.getPoint = function(i, j, k, l){
- if (l == undefined) {
- return this.get(i).get(j).get(k);
- }
- return this.get(i).get(j).innerRings.get(k).get(l);
-};
-
-/**
- * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
- *
- * @type Integer[]
- * @param {MultiGeometry} geom
- * @returns an Array of indices
- */
-GeometryArray.prototype.findMultiGeometry = function(geom) {
- var a = [];
- for (var i=0; i < this.count(); i++) {
- if (this.get(i).equals(geom)) {a.push(i);}
- }
- return a;
-};
-
-/**
- * deletes the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- */
-GeometryArray.prototype.delGeometry = function(i,j){
- if (this.get(i).del(j) === false) {
- this.del(i);
- }
-};
-
-/**
- * deletes the k-th {@link Point} of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @param {Integer} k index of the Point
- */
-GeometryArray.prototype.delPoint = function (i, j, k, l) {
- var res = this.get(i).delPoint(j, k, l);
- if (res === false) {
- this.del(i);
- }
-};
-
-/**
- * closes the current {@link MultiGeometry}. Calls method close of the {@link Geometry} class.
- *
- */
-GeometryArray.prototype.close = function(){
- if (!this.get(-1).get(-1).close()) {
- this.delGeometry(-1, -1);
- }
- else {
- if (this.get(-1).get(-1).count() === 0) {
- this.get(-1).del(-1);
- }
- if (this.get(-1).count() === 0) {
- this.del(-1);
- }
- }
-
-};
-
-/**
- * deletes all {@link Point} objects of this {@link GeometryArray} that equal point
- *
- * @param {Point} point
- */
-GeometryArray.prototype.delAllPointsLike = function(point){
- var finished = false;
- while (finished === false){
- finished = true;
- for (var i = 0 ; finished === true && i < this.count() ; i++){
- for (var j = 0 ; finished === true && j < this.get(i).count() ; j++){
-
- var currentGeometry = this.get(i).get(j);
- if (currentGeometry.geomType == geomType.polygon && currentGeometry.innerRings) {
- for (var k = 0; finished === true && k < currentGeometry.innerRings.count(); k++) {
- for (var l = 0; finished === true && l < currentGeometry.innerRings.get(k).count(); l++) {
- if (this.getPoint(i, j, k, l).equals(point)) {
- this.delPoint(i, j, k, l);
- finished = false;
- }
- }
- }
- }
- if (!finished) {
- break;
- }
-
- for (var k = 0 ; finished === true && k < this.get(i).get(j).count() ; k++){
- if (this.getPoint(i,j,k).equals(point)){
- this.delPoint(i,j,k);
- finished = false;
- }
- }
- }
- }
- }
-};
-
-/**
- * updates all {@link Point} objects of this {@link GeometryArray} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-GeometryArray.prototype.updateAllPointsLike = function(oldP, newP){
- for (var i = 0; i < this.count(); i++){
- this.get(i).updateAllPointsLike(oldP, newP);
- }
-};
-
-GeometryArray.prototype.placemarkToString = function (placemarkId) {
- var str = "{\"type\": \"Feature\", \"geometry\": ";
-
- // get geometries with placemarkId
- var geometriesFromPlacemark = [];
- for (var i = 0, len = this.count(); i < len; i++) {
- if (this.get(i).isFromKml() && this.get(i).e.getElementValueByName("Mapbender:placemarkId") == placemarkId) {
- geometriesFromPlacemark.push(i);
- }
- }
-
- if (geometriesFromPlacemark.length > 1) {
- str += "{\"type\": \"GeometryCollection\", \"geometries\": [";
- for (var i = 0; i < geometriesFromPlacemark.length; i++) {
- if (i > 0) {
- str += ",";
- }
- str += this.get(geometriesFromPlacemark[i]).placemarkToString();
- }
- str += "]}";
-
- // metadata is the same for all indices...get from index 0
- var propString = this.get(geometriesFromPlacemark[0]).e.toString();
- if (propString) {
- str += "," + propString;
- }
- }
- else if (geometriesFromPlacemark.length === 1) {
- str += this.get(geometriesFromPlacemark[0]).placemarkToString();
- }
-
- str += "}";
- return str;
-};
-
-GeometryArray.prototype.getBBox = function(){
- var q = this.get(0).get(0).get(0);
- var min = cloneObject(q);
- var max = cloneObject(q);
- for(var i=0; i < this.count();i++){
- var pos = this.get(i).getBBox();
- if (pos[0].x < min.x) {min.x = pos[0].x;}
- if (pos[1].x > max.x) {max.x = pos[1].x;}
- if (pos[1].y > max.y) {max.y = pos[1].y;}
- if (pos[0].y < min.y) {min.y = pos[0].y;}
- }
- return [min, max];
-};
-
-GeometryArray.prototype.importGeometryFromText = function (text, srs) {
-
- var tmpArray = text.split("(");
- var geometryType = tmpArray[0];
-
- switch (geometryType) {
- case "MULTIPOLYGON":
- var text = text.replace(/\)/g, "");
- var sepArray = text.split("(((");
- var polyArray = sepArray[1].split(",((");
-
- this.addMember(geomType.polygon);
- for (var i = 0; i < polyArray.length; i++) {
- var ringArray = polyArray[i].split(",(");
- for (var j = 0; j < ringArray.length; j++) {
- var coordinatesArray = ringArray[j].split(",");
- if (j === 0) {
- // add outer ring
- this.get(-1).addGeometry();
- for (var m = 0; m < -1 + coordinatesArray.length; m++) {
- var currentPoint = coordinatesArray[m].split(" ");
- this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
- this.getGeometry(-1,-1).setEpsg(srs);
- }
- this.close();
- }
- else {
- // add inner ring
- var ring = new Geometry(geomType.polygon);
- for (var m = 0; m < -1 + coordinatesArray.length; m++) {
- var currentPoint = coordinatesArray[m].split(" ");
- ring.addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
- }
- ring.close();
- this.getGeometry(-1,-1).addInnerRing(ring);
- this.getGeometry(-1,-1).setEpsg(srs);
- }
- }
- }
- break;
- }
-};
-
-GeometryArray.prototype.importGeoJSON = function (geoJSON) {
- // you can pass either geoJSON or the evaluated geoJSON string
- // for backwards compatibility
- if (typeof(geoJSON) == 'string') {
- var geoJSON = eval('(' + geoJSON + ')');
- }
-
- //
- // FEATURE COLLECTION
- //
- var isFeatureCollection = (geoJSON.type == "FeatureCollection") ? true : false;
- if (isFeatureCollection) {
- //
- // FEATURE
- //
- var featureArray = geoJSON.features;
- for (var j = 0; j < featureArray.length; j++) {
- var currentFeature = featureArray[j];
- var isFeature = (currentFeature.type == "Feature") ? true : false;
-
- // add geometry ...
- if (currentFeature.geometry && isFeature) {
- var featureEpsg = "EPSG:4326";
- if (!currentFeature.crs || currentFeature.crs.type !== "name" || !currentFeature.crs.properties.name) {
- var e = new Mb_warning("SRS not set or unknown in GeoJSON. Using 'EPSG:4326'.");
- }
- else {
- featureEpsg = currentFeature.crs.properties.name;
- }
-
- //
- // GEOMETRY
- //
- var currentGeometry = currentFeature.geometry;
- var geometrytype = currentGeometry.type;
- var coordinates = currentGeometry.coordinates;
- switch (geometrytype) {
- case "Point":
- //
- // POINT
- //
- this.addMember(geomType.point);
-
- this.get(-1).addGeometry();
- this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
- this.getGeometry(-1,-1).setEpsg(featureEpsg);
- this.close();
- break;
-
- case "LineString":
- //
- // LINESTRING
- //
- this.addMember(geomType.line);
- this.get(-1).addGeometry();
- for (var m = 0; m < coordinates.length; m++) {
- var currentPoint = coordinates[m];
- this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
- }
- this.getGeometry(-1,-1).setEpsg(featureEpsg);
- this.close();
- break;
-
- case "MultiLineString":
- //
- // MULTILINESTRING
- //
- this.addMember(geomType.line);
- for (var m = 0; m < coordinates.length; m++) {
- this.get(-1).addGeometry();
- var currentLine = coordinates[m];
- for (var n = 0; n < currentLine.length; n++) {
- var currentPoint = currentLine[n];
- this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
- }
- this.getGeometry(-1,-1).setEpsg(featureEpsg);
- }
- this.close();
- break;
-
- case "Polygon":
- //
- // POLYGON
- //
- this.addMember(geomType.polygon);
- for (var m = 0; m < coordinates.length; m++) {
- this.get(-1).addGeometry();
- var currentPolygon = coordinates[m];
- for (var n = 0; n < currentPolygon.length; n++) {
- var currentPoint = currentPolygon[n];
- this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
- }
- this.getGeometry(-1,-1).setEpsg(featureEpsg);
- }
- this.close();
- break;
-
- case "MultiPolygon":
- //
- // MULTIPOLYGON
- //
- this.addMember(geomType.polygon);
- for (var m = 0; m < coordinates.length; m++) {
- this.get(-1).addGeometry();
- var currentPolygon = coordinates[m];
- for (var n = 0; n < currentPolygon.length; n++) {
- var currentRing = currentPolygon[n];
- if (n == 0) {
- for (var p = 0; p < currentRing.length; p++) {
- var currentPoint = currentRing[p];
- this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
- }
- }
- else {
- var ring = new Geometry(geomType.polygon);
- for (var p = 0; p < currentRing.length; p++) {
- var currentPoint = currentRing[p];
- ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
- }
- ring.close();
- this.getGeometry(-1,-1).addInnerRing(ring);
- }
- }
- this.getGeometry(-1,-1).setEpsg(featureEpsg);
- }
- this.close();
- break;
-
- case "GeometryCollection":
- var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
- break;
- }
- }
-
- if (currentFeature.properties) {
- var properties = currentFeature.properties;
- // GeometryCollections are NOT YET IMPLEMENTED
- if (geometrytype != "GeometryCollection") {
- for (var l in properties) {
- if (typeof(properties[l]) != "function") {
- this.get(-1).e.setElement(l, properties[l]);
- }
- }
- this.get(-1).e.setElement("fid", currentFeature.id);
- }
- }
- }
- }
- return true;
-}
-
-GeometryArray.prototype.featureToString = function (i) {
- var str = "{\"type\": \"FeatureCollection\", \"features\": [";
- str += this.get(i).toString();
- str += "]}";
- return str;
-};
-
-
-GeometryArray.prototype.toString = function () {
- var str = "{\"type\": \"FeatureCollection\", \"features\": [";
-
- // separate: geometries that are from a KML and those which are not
- var multiGeometriesFromKml = [];
- var multiGeometriesNotFromKml = [];
- for (var i = 0, len = this.count(); i < len; i++) {
- if (this.get(i).isFromKml()) {
- var placemarkId = this.get(i).e.getElementValueByName("Mapbender:placemarkId");
-
- // only add placemark ids once!
- var isFound = false;
- for (var j = 0; j < multiGeometriesFromKml && isFound === false; j++) {
- if (multiGeometriesFromKml == placemarkId) {
- isFound = true;
- }
- }
- if (!isFound) {
- multiGeometriesFromKml.push(placemarkId);
- }
- }
- else {
- multiGeometriesNotFromKml.push(i);
- }
- }
-
- // add geometries not from KML
- for (var i = 0, len = multiGeometriesNotFromKml.length; i < len; i++) {
- if (i > 0) {
- str += ",";
- }
- str += this.get(multiGeometriesNotFromKml[i]).toString();
- }
-
- // add geometries from KML
- if (multiGeometriesNotFromKml.length > 0 && multiGeometriesFromKml.length > 0) {
- str += ",";
- }
-
- for (var i=0; i < multiGeometriesFromKml.length; i++) {
- if (i > 0) {
- str += ",";
- }
- str += this.placemarkToString();
- }
-
- str += "]}";
- return str;
-};
-
-/**
- * @class a MultiGeometry is a List of Geometry objects
- *
- * @ extends List
- * @ requires Geometry
- * @ requires Point
- * @ constructor
- * @ param {String} geomType a geomType
- */
-function MultiGeometry(geomType){
-
- /*
- * creates a new, empty {@link Geometry} object and adds it to this {@link MultiGeometry}
- *
- */
- this.addGeometry = function(){
- this.add(new Geometry(this.geomType));
- };
-
- /**
- * deletes the {@link Geometry} object at index i; -1 refers to the last {@link Geometry object in the list
- * overwrites the del function of {@link List}.
- *
- * @param {Integer} i index
- */
- this.del = function(i){
- i = this.getIndex(i);
- if (i !== false){
- var tmpLength = this.count() - 1;
- for (var z = i; z < tmpLength ; z ++){
- this.list[z] = this.list[z+1];
- }
- this.list.length -= 1;
- if (this.list.length === 0) {return false;}
- }
- return true;
- };
-
- this.list = [];
- this.e = new Wfs_element();
- this.geomType = geomType;
- this.name = nameMultiGeometry;
-}
-
-MultiGeometry.prototype = new List();
-
-/**
- * updates all {@link Point} objects of this {@link MultiGeometry} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-MultiGeometry.prototype.updateAllPointsLike = function(oldP, newP){
- for (var i = 0; i < this.count(); i++) {
- this.get(i).updateAllPointsLike(oldP, newP);
- }
-};
-
-/**
- * gets the bounding box of this {@link MultiGeometry} as an Array of 2 points
- *
- * @return the bounding box
- * @type Array of two Point objects
- */
-MultiGeometry.prototype.getBBox = function(){
- var q = this.get(0).get(0);
- var min = cloneObject(q);
- var max = cloneObject(q);
- for(var i=0; i<this.count();i++){
- var pos = this.get(i).getBBox();
- if (pos[0].x < min.x) {min.x = pos[0].x;}
- if (pos[1].x > max.x) {max.x = pos[1].x;}
- if (pos[1].y > max.y) {max.y = pos[1].y;}
- if (pos[0].y < min.y) {min.y = pos[0].y;}
- }
- return [min, max];
-};
-
-/**
- * gets the bounding box of this {@link MultiGeometry} as a polygon of four points
- *
- * @return the bounding box
- * @type MultiGeometry
- */
-MultiGeometry.prototype.getBBox4 = function() {
- var bbox = this.getBBox();
- var realBox = new MultiGeometry(geomType.polygon);
- realBox.addGeometry(geomType.polygon);
- realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[0].y);
- realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[1].y);
- realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[1].y);
- realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[0].y);
- realBox.get(-1).close();
- return realBox;
-};
-
-/**
- * gets the center of the bounding box of this {@link MultiGeometry}.
- *
- * @return the center of the bounding box
- * @type Point
- */
-MultiGeometry.prototype.getCenter = function(){
- var tmp = this.getBBox();
- var x = parseFloat(tmp[0].x) + parseFloat((tmp[1].x - tmp[0].x)/2);
- var y = parseFloat(tmp[0].y) + parseFloat((tmp[1].y - tmp[0].y)/2);
- return new Point(x,y);
-};
-
-/**
- * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
- *
- * @return number of points
- * @type Integer
- */
-MultiGeometry.prototype.getTotalPointCount = function(){
- var c = 0;
- for (var i = 0 ; i < this.count(); i++) {
- c += this.get(i).count();
- }
- return c;
-};
-
-/**
- * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
- *
- * @return number of points
- * @type Integer
- */
-MultiGeometry.prototype.getPoint = function(j,k){
- return this.get(j).get(k);
-};
-
-/**
- * compares this {@link MultiGeometry} object with the {@link MultiGeometry} object multigeom.
- *
- * @param {MultiGeometry} multigeom another multigeometry
- * @return true if he multigeometries match; else false
- * @type Boolean
- */
-MultiGeometry.prototype.equals = function(multigeom) {
- if (this.geomType != multigeom.geomType) {return false;}
- if (this.count() != multigeom.count()) {return false;}
- if (this.getTotalPointCount() != multigeom.getTotalPointCount()) {return false;}
- for (var i=0; i<this.count(); i++) {
- if (!this.get(i).equals(multigeom.get(i))) {return false;}
- }
- return true;
-};
-
-/**
- * deletes the j-th {@link Point} object of the i-th {@link Geometry} object of this {@link MultiGeometry} object.
- *
- * @param {Integer} i geometry index
- * @param {Integer} j point index
- * @return true if the deletion succeded; else false.
- * @type Boolean
- */
-MultiGeometry.prototype.delPoint = function(i, j, k){
- var res;
- if (k == undefined) {
- res = this.get(i).del(j);
- if (res === false) {
- return this.del(i);
- }
- }
- else {
- res = this.get(i).innerRings.get(j).del(k);
- if (res === false) {
- this.get(i).innerRings.del(j);
- }
- }
- return true;
-};
-
-MultiGeometry.prototype.isFromKml = function () {
- if (this.e.getElementValueByName("Mapbender:kml")) {
- return true;
- }
- return false;
-};
-
-MultiGeometry.prototype.toText = function () {
- var text = "";
- var numOfGeom = this.count();
- if (numOfGeom >= 1) {
- if (this.geomType == geomType.polygon) {
- if (numOfGeom > 1) {
- text += "MULTIPOLYGON (";
- for (var i = 0; i < numOfGeom; i++) {
- if (i > 0) {
- text += ", ";
- }
- var currentPolygon = this.get(i);
- text += "(" + currentPolygon.toText() + ")";
- }
- text += ")";
- }
- else {
- text += "POLYGON (" + this.get(0).toText() + ")";
- }
- }
- else if (this.geomType == geomType.line) {
- text += "LINESTRING (";
-
- var currentLine = this.get(0);
- for (var j = 0; j < currentLine.count(); j++) {
- if (j > 0) {
- text += ", ";
- }
-
- var currentPoint = currentLine.get(j);
- text += currentPoint.x + " " + currentPoint.y
- }
-
- text += ")";
- }
-
- }
- return text;
-};
-
-MultiGeometry.prototype.toString = function () {
- var str = this.toStringWithoutProperties();
-
- // properties
- var propString = this.e.toString();
- if (propString) {
- str += "," + propString;
- }
-
- str += "}";
-
- return str;
-};
-
-MultiGeometry.prototype.placemarkToString = function () {
- var str = "";
- // geometries
- for (var i = 0, len = this.count(); i < len; i++) {
- if (i > 0) {
- str += ",";
- }
- str += this.get(i).toString();
- }
- return str;
-};
-
-MultiGeometry.prototype.toStringWithoutProperties = function () {
- var str = "{\"type\": \"Feature\", ";
-
- var epsg = this.getEpsg();
- if (epsg) {
- str += "\"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"" + epsg + "\"}}, ";
- }
- str += "\"geometry\": {";
-
- var len = this.count();
-
- switch (this.geomType) {
- case geomType.polygon:
- if (len > 1) {
- str += "\"type\": \"MultiPolygon\", ";
- }
- else {
- str += "\"type\": \"Polygon\", ";
- }
- break;
- case geomType.line:
- if (len > 1) {
- str += "\"type\": \"MultiLineString\", ";
- }
- else {
- str += "\"type\": \"LineString\", ";
- }
- break;
- case geomType.point:
- if (len > 1) {
- str += "\"type\": \"MultiPoint\", ";
- }
- else {
- str += "\"type\": \"Point\", ";
- }
- break;
- }
-
- str += "\"coordinates\": "
- // geometries
- if (len > 1) {
- str += "[";
- for (var i = 0; i < len; i++) {
- if (i > 0) {
- str += ",";
- }
- str += this.get(i).toString();
- }
- str += "]";
- }
- else {
- str += this.get(0).toString();
- }
-
- str += "}";
-
-// this closing curly bracket is added in toString()
-// str += "}";
-
- return str;
-};
-
-/**
- * @return the EPSG code of this geometry.
- * @type integer
- */
-MultiGeometry.prototype.getEpsg = function () {
- if (this.count() > 0) {
- return this.get(0).getEpsg();
- }
- return false;
-};
-
-
-function InnerRings () {
- this.list = [];
-};
-
-InnerRings.prototype = new List();
-
-/**
- * @class a Geometry is a List of Point objects. If it is a polygon, the last point has
- * to equal the first point.
- *
- * @extends List
- * @requires Point
- * @constructor
- * @param {String} a string representing a geometry type, see @see GeomType.
- */
-function Geometry(aGeomtype){
-
- /**
- * deletes the {@link Point} object at index i; -1 refers to the last
- * {@link Point} object in the list. Overwrites the del function of
- * {@link List}.
- *
- * @param {Integer} i index
- * @return false if deletion is not yet finished. It is cascaded to
- * {@link MultiGeometry}. True if the deletion is finished.
- */
- this.del = function(i){
- i = this.getIndex(i);
- if (i !== false) {
- var tmpLength = this.count()-1;
-
- for (var z = i; z < tmpLength ; z ++){
- this.list[z] = this.list[z+1];
- }
- this.list.length -= 1;
-
- if (this.geomType == geomType.polygon){
- if (i == tmpLength) {this.list[0] = this.list[tmpLength-1];}
- else if (i === 0) {this.list[tmpLength-1] = this.list[0];}
- if (this.list.length == 1){return false;}
- }
- updateDist();
- if(this.list.length === 0) {return false;}
- return true;
- }
- return false;
- };
-
- /**
- * adds a {@link Point} object to this {@link Geometry} object.
- *
- * @param {Float} x x value of the point
- * @param {Float} y y value of the point
- */
- this.addPointByCoordinates = function(x,y,z){
- var newPoint = new Point(x,y,z);
- this.add(newPoint);
-// updateDist();
- };
-
- /**
- * adds a {@link Point} object to this {@link Geometry} object.
- *
- * @param {Point} aPoint another point
- */
- this.addPoint = function(aPoint){
- this.add(new Point(aPoint.x, aPoint.y, aPoint.z));
- updateDist();
- };
-
- /**
- * inserts a {@link Point} object at index i of this {@link Geometry} object.
- *
- * @param {Point} p another point
- * @param {Integer} i index
- */
- this.addPointAtIndex = function(p,i){
- i = this.getIndex(i);
- if (i !== false){
- for(var z = this.count(); z > i; z--){
- this.list[z] = this.list[z-1];
- }
- this.list[i] = new Point(p.x, p.y, p.z);
- updateDist();
- }
- };
-
- /**
- * Overwrites the {@link Point) object at index i with the {@link Point} object p.
- *
- * @private
- * @param {Point} p another point
- * @param {Integer} i index
- */
- this.updatePointAtIndex = function(p, i){
- i = this.getIndex(i);
- if ((i === 0 || i == this.count()-1) && this.geomType == geomType.polygon){
- this.list[0] = p;
- this.list[this.count()-1] = p;
- }
- else {this.list[i] = p;}
- updateDist();
- };
-
- /**
- * Updates the {@link Geometry#dist} and {@link Geometry#totaldist}
- *
- * @private
- */
- var updateDist = function(){
-/*
- * DISABLED BECAUSE IT IS TOO SLOW
- dist[0] = 0;
- totaldist[0] = 0;
- for (var i = 1 ; i < that.count(); i++){
- dist[i] = that.get(i-1).dist(that.get(i));
- totaldist[i] = totaldist[i-1] + dist[i];
- }
-*/
- };
- /**
- * gets the distance between the last and last but one point of this {@link Geometry}.
- *
- * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
- * @return the distance
- * @type Float
- */
- this.getCurrentDist = function(numberOfDigits) {
- if (typeof(numberOfDigits) == "number") {
- return roundToDigits(dist[this.count()-1], numberOfDigits);
- }
- return dist[this.count()-1];
-
- };
- /**
- * gets the length of the outer rim of this {@link Geometry}.
- *
- * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
- * @return the distance
- * @type Float
- */
- this.getTotalDist = function(numberOfDigits) {
- if (typeof(numberOfDigits) == "number") {
- return roundToDigits(totaldist[this.count()-1], numberOfDigits);
- }
- return totaldist[this.count()-1];
- };
- /**
- * closes this {@link Geometry}.
- *
- * @return true if the geometry could be closed; otherwise false
- * @type Boolean
- */
- this.close = function(){
- complete = true;
- if (this.geomType == geomType.polygon){
- if (this.count() > 2){
- if (!this.get(0).equals(this.get(-1))) {
- this.addPoint(this.get(0));
- }
- }
- else {return false;}
- }
- if (this.geomType == geomType.line){
- if (this.count() < 2){return false;}
- }
- return true;
- };
- /**
- * checks if this {@link Geometry} has been closed.
- *
- * @return true if the geometry is closed; otherwise false
- * @type Boolean
- */
- this.isComplete = function() {
- return complete;
- };
-
- /**
- * Sets the EPSG of this geometry.
- *
- * @param {Integer} someEpsg the EPSG of this geometry.
- * @return true if the EPSG could be set; else false
- * @type boolean
- */
- this.setEpsg = function (someEpsg) {
- // TODO: how to check if EPSG code is correct?
- epsg = someEpsg;
- return true;
-
- var e = new Mb_exception("EPSG code not valid ("+someEpsg+")");
- return false;
- };
-
- /**
- * @return the EPSG code of this geometry.
- * @type integer
- */
- this.getEpsg = function () {
- return epsg;
- };
-
- this.list = [];
- var dist = [];
- var totaldist = [];
- var complete = false;
-
- var epsg;
-
- var that = this;
-
- this.geomType = aGeomtype;
- this.name = nameGeometry;
-
- // add these members if the geometry is a polygon
- if (this.geomType == geomType.polygon) {
- this.innerRings = new InnerRings();
- this.addInnerRing = function (somePolygon) {
- this.innerRings.add(somePolygon);
- };
- this.delInnerRing = function (index) {
- this.innerRings.del(index);
- };
- }
-}
-
-Geometry.prototype = new List();
-
-Geometry.prototype.toText = function () {
- var text = "";
- switch (this.geomType) {
- case geomType.polygon:
- text += "(";
- for (var j = 0; j < this.count(); j++) {
- if (j > 0) {
- text += ", ";
- }
- var currentPoint = this.get(j);
- text += currentPoint.x + " " + currentPoint.y
- }
- text += ")";
- if (this.innerRings && this.innerRings.count() > 0) {
- for (var k = 0; k < this.innerRings.count(); k++) {
- text += ", ";
- text += this.innerRings.get(k).toText();
- }
- }
- break;
- }
- return text;
-};
-/**
- * gets the bounding box of this {@link Geometry}
- *
- * @return the bounding box (array of two Point objects)
- * @type Point[]
- */
-Geometry.prototype.getBBox = function(){
- var q = this.get(0);
- var min = cloneObject(q);
- var max = cloneObject(q);
-
- for (var j=0; j<this.count(); j++){
- var pos = this.get(j);
- if (pos.x < min.x) {min.x = pos.x;}
- else if (pos.x > max.x) {max.x = pos.x;}
- if (pos.y < min.y) {min.y = pos.y;}
- else if (pos.y > max.y) {max.y = pos.y;}
- }
- if (this.geomType == geomType.polygon) {
- for (var i = 0; i < this.innerRings.count(); i++) {
- var currentRing = this.innerRings.get(i);
- for (var j=0; j<currentRing.count(); j++){
- var pos = currentRing.get(j);
- if (pos.x < min.x) {min.x = pos.x;}
- else if (pos.x > max.x) {max.x = pos.x;}
- if (pos.y < min.y) {min.y = pos.y;}
- else if (pos.y > max.y) {max.y = pos.y;}
- }
- }
- }
-
- return [min, max];
-};
-
-/**
- * updates all {@link Point} objects of this {@link Geometry} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-Geometry.prototype.updateAllPointsLike = function(oldP, newP){
- var len = this.count();
- for (var i = 0; i < len ; i++){
- if (oldP.equals(this.get(i))){
- if (i>0 && newP.equals(this.get(i-1))){
- this.del(i);
- len--;
- i--;
- }
- else {this.updatePointAtIndex(newP, i);}
- }
- }
- if (this.geomType == geomType.polygon) {
- for (var j = 0; j < this.innerRings.count(); j++) {
- var len = this.innerRings.get(j).count();
- for (var i = 0; i < len ; i++){
- if (oldP.equals(this.innerRings.get(j).get(i))){
- if (i>0 && newP.equals(this.innerRings.get(j).get(i-1))){
- this.innerRings.get(j).del(i);
- len--;
- i--;
- }
- else {this.innerRings.get(j).updatePointAtIndex(newP, i);}
- }
- }
-
- }
- }
-};
-
-/**
- * compares this {@link Geometry} object with the {@link Geometry} object geom point by point.
- *
- * @param {Geometry} geom another geometry
- * @return true if he geometries match; else false
- * @type Boolean
- */
-Geometry.prototype.equals = function(geom) {
- if (this.geomType != geom.geomType) {return false;}
- if (this.count() != geom.count()) {return false;}
- for (var i=0; i < this.count(); i++) {
- if (!this.get(i).equals(geom.get(i))) {return false;}
- }
- if (!this.innerRings && !geom.innerRings) {
- // no inner rings; fine
- }
- else if (this.innerRings && geom.innerRings) {
- if (this.innerRings.count() != geom.innerRings.count()) {
- return false;
- }
- for (var j = 0; j < this.innerRings.count(); j++) {
- if (!this.innerRings.get(j).equals(geom.innerRings.get(j))) {
- return false;
- }
- }
- }
- else {
- // inner ring mismatch
- return false;
- }
- return true;
-};
-
-/**
- * creates a polygon geometry object which form a buffer around the line geometry
- *
- * @param {float} real world units to buffer around the line
- * @param {float} (optional) units to buffer around the line in Y direction
- *
- * @return linebuffer polygon
- * @type Geometry
- */
-Geometry.prototype.bufferLine = function(bufferX, bufferY){
- if(typeof(bufferY)=='undefined')
- bufferY = bufferX;
- if(this.geomType!=geomType.line || this.count()<2)
- return false;
-
- var ret = new Geometry(geomType.polygon)
-
- //get vector from point 0 to point 1
- last_vec = this.get(1).minus(this.get(0));
-
- //get 90° rotated vector
- last_vec_o = new Point(-last_vec.y, last_vec.x);
-
- //resize vectors with apropriate linebuffer length
- last_vec_o = last_vec_o.dividedBy(last_vec_o.dist(new Point(0,0)));
- last_vec_o.x*=bufferX; last_vec_o.y*=bufferY;
- last_vec = last_vec.dividedBy(last_vec.dist(new Point(0,0)));
- last_vec.x*=bufferX; last_vec.y*=bufferY;
-
- //add first pointsets
- ret.list.unshift(this.get(0).plus(last_vec_o).minus(last_vec));
- ret.list.push(this.get(0).minus(last_vec_o).minus(last_vec));
-
- for(var i=1;i<this.count()-1;i++){
- //get vector from point n to point n+1
- vec = this.get(i+1).minus(this.get(i));
- //get orthogonal (90° rotated) vector
- vec_o = new Point(-vec.y, vec.x);
-
- //resize vectors to linebuffer length
- vec_o = vec_o.dividedBy(vec_o.dist(new Point(0,0)));
- vec_o.x*=bufferX; vec_o.y*=bufferY;
- vec = vec.dividedBy(vec.dist(new Point(0,0)));
- vec.x*=bufferX; vec.y*=bufferY;
-
- //if direction is the same continue
- if(vec.equals(last_vec))
- continue;
-
- // calculate directed angle between the two vectors by
- // calculating the argument diffenrences between complex numbers
- // arg(x + i*y) (because law of cosine can onlycalculate undirected angle)
- var angle = (Math.atan2(vec.x,vec.y)-Math.atan2(last_vec.x,last_vec.y))
- //ensure that angle is -180<=angle<=180
- if(angle<-Math.PI)angle=2*Math.PI+angle;
- if(angle>+Math.PI)angle=2*Math.PI-angle;
-
- //calculate the distance between the next points on boundary
- //and the line point
- //the point will be in the direction of angle/2 relative to last_vec_o
- //since cosine is adjacent side / hypothenuse and we know that
- //the adjacent side is lineBuffer the hypothenus (our distance) is
- var ndist = 1/(Math.cos(angle/2))
- //direction of next points on boundary
- var int_vec = vec_o.plus(last_vec_o);
- //resize direction vector to our distance
- int_vec = int_vec.times(ndist/int_vec.dist(new Point(0,0)));
- int_vec.x*=bufferX; int_vec.y*=bufferY;
-
- //look if we have an outer sharp corner (>90°)
- if(angle>Math.PI/2){
- //push cutted edge points
- ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
- ret.list.unshift(this.get(i).plus(vec_o).minus(vec));
- }
- else{
- //push inner/light edge
- ret.list.unshift(this.get(i).plus(int_vec));
- }
-
- //look if we have an inner sharp corner (<-90°)
- if(angle<-Math.PI/2){
- //push cutted edge points
- ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
- ret.list.push(this.get(i).minus(vec_o).minus(vec));
- }
- else{
- //push inner/light edge
- ret.list.push(this.get(i).minus(int_vec));
- }
-
- //copy for next point
- last_vec = vec;
- last_vec_o = vec_o;
- }
- //add last pointsets
- ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
- ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
-
- ret.close();
-
- return ret;
-}
-
-Geometry.prototype.toString = function () {
- var str = "";
- if (this.geomType == geomType.polygon) {
- str += "[[";
- for (var i = 0; i < this.count(); i++) {
- if (i > 0) {
- str += ", ";
- }
- str += this.get(i).toString();
- }
-
- if (typeof(this.innerRings) == "object" && this.innerRings.count() > 0) {
- for (var j = 0; j < this.innerRings.count(); j++) {
- var currentRing = this.innerRings.get(j);
-
- str += "],[";
- for (var i = 0; i < currentRing.count(); i++) {
- if (i > 0) {
- str += ", ";
- }
- str += currentRing.get(i).toString();
- }
- }
- }
- str += "]]";
- }
- else if (this.geomType == geomType.line) {
- str += "[";
- for (var i = 0; i < this.count(); i++) {
- if (i > 0) {
- str += ", ";
- }
- str += this.get(i).toString();
- }
- str += "]";
- }
- else if (this.geomType == geomType.point) {
- str += this.get(0).toString();
- }
-
- return str;
-};
-
-
-
-/**
- * @class an array of elements, each consisting of a name/value pair
- *
- * @ constructor
- */
-function Wfs_element(){
-
- /**
- * returns the number of elements of this {@link Wfs_element} object.
- *
- * @return the number of elements
- * @type Integer
- */
- this.count = function(){
- return name.length;
- };
-
- /**
- * returns the name of the element at index i.
- *
- * @param {Integer} i index
- * @return the name
- * @type String
- */
- this.getName = function(i){
- if (isValidElementIndex(i)) {return name[i];}
- return false;
- };
-
- /**
- * returns the value of the element at index i.
- *
- * @param {Integer} i index
- * @return the value
- */
- this.getValue = function(i){
- if (isValidElementIndex(i)) {return value[i];}
- return false;
- };
-
- /**
- * appends a new element with a given name. If an element with this name exists, it is overwritten.
- *
- * @param {String} aName the name of the new element
- * @param {String} aValue the value of the new element
- */
- this.setElement = function(aName, aValue){
- var i = this.getElementIndexByName(aName);
- if (i === false) {i = this.count();}
- name[i] = aName;
- value[i] = aValue;
- };
-
- /**
- * removes an element with a given name. If an element with this name exists, it is removed.
- *
- * @param {String} aName the name of the element to delete
- */
- this.delElement = function(aName){
- var i = this.getElementIndexByName(aName);
- if (i !== false) {
- name.splice(i, 1);
- value.splice(i, 1);
- }
- }
-
- /**
- * checks if an index is valid
- *
- * @private
- * @param {Integer} i an index
- * @return true if the index is valid; otherwise false
- * @type Boolean
- */
- var isValidElementIndex = function(i){
- if (i>=0 && i<name.length) {return true;}
- var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
- return false;
- };
-
- var name = [];
- var value = [];
-}
-
-/**
- * gets the index of the element with a given name.
- *
- * @param {String} elementName a name
- * @return the index of the element; if no element with this name exists, false
- * @type Integer, Boolean
- */
-Wfs_element.prototype.getElementIndexByName = function(elementName){
- for (var j = 0, len = this.count() ; j < len ; j++){
- if (this.getName(j) == elementName) {return j;}
- }
- return false;
-};
-
-/**
- * gets the value of the element with a given name.
- *
- * @param {String} elementName a name
- * @return the value of the element; if no element with this name exists, false
- * @type String, Boolean
- */
-Wfs_element.prototype.getElementValueByName = function(elementName){
- var i = this.getElementIndexByName(elementName);
- if (i === false) {return false;}
- return this.getValue(i);
-};
-
-Wfs_element.prototype.toString = function () {
- var str = "";
- if (this.count() > 0) {
- str += "\"properties\": {";
-
- for (i = 0, len = this.count(); i < len; i++) {
- if (i > 0) {
- str += ",";
- }
- var key = this.getName(i);
- var value = this.getValue(i);
- str += "\"" + key + "\":\"" + value + "\"";
- }
- str += "}";
- }
- return str;
-};
-
-/**
- * @class a {@link Canvas} contains a {@link DivTag} that holds graphics rendered by {@link jsGraphics}
- *
- * @constructor
- * @requires DivTag
- * @requires jsGraphics
- * @requires GeometryArray
- * @requires MultiGeometry
- * @requires Geometry
- * @param {String} aMapFrame name of the target mapframe
- * @param {String} aTagName name of the target div tag
- * @param {String} aStyle style of the div tag
- * @param {Integer} aLineWidth the line width of the jsGraphics output
- */
-function Canvas(aMapframe, aTagName, aStyle, aLineWidth) {
-
- /**
- * draws the geometry of the canvas
- *
- * @param {String} t geometry type (@see GeomType)
- * @param {MultiGeometry} g a MultiGeometry object
- * @param {String} col a color
- * @private
- */
- this.drawGeometry = function(t,g,col){
- if(t == geomType.point) {
- var poiIcon = g.e.getElementValueByName("Mapbender:icon");
- for(var i=0, ilen = g.count(); i < ilen; i++){
- var currentGeom = g.get(i);
- var p = realToMap(mapframe, currentGeom.get(0));
- var px = p.x;
- var py = p.y;
- var radius = diameter/2;
- if ((px - radius < mapframeWidth && px + radius > 0 &&
- py - radius < mapframeHeight && py + radius > 0) ||
- (p.dist(new Point(0,0)) < radius ||
- p.dist(new Point(mapframeWidth, mapframeHeight)) < radius ||
- p.dist(new Point(0,mapframeHeight)) < radius ||
- p.dist(new Point(mapframeWidth, 0)) < radius
- )
- ) {
- // if the point contains a link to an icon, display the icon
- if (poiIcon) {
- displayIcon(poiIcon, px, py);
- }
- else {
- drawCircle(px-1, py-1, diameter,col);
- }
- }
- }
- }
- else if(t == geomType.line || t==geomType.polygon) {
- for(var i=0, ilen = g.count(); i < ilen; i++){
- var currentGeom = g.get(i);
- // paint inner rings
- if (t==geomType.polygon && currentGeom.innerRings.count() > 0) {
- for (var k = 0; k < currentGeom.innerRings.count(); k++) {
- var currentRing = currentGeom.innerRings.get(k);
- var previousPoint = realToMap(mapframe, currentRing.get(0));
- for (var j=1, jlen = currentRing.count(); j < jlen; j++) {
- (function () {
- var currentPoint = realToMap(mapframe, currentRing.get(j));
-
- var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
- if (pq) {
- drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
- }
- previousPoint = currentPoint;
- })();
- }
-
- }
- }
- // paint line or outer ring
- var previousPoint = realToMap(mapframe, currentGeom.get(0));
- for (var j=1, jlen = currentGeom.count(); j < jlen; j++) {
- (function () {
- var currentPoint = realToMap(mapframe, currentGeom.get(j));
-
- var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
- if (pq) {
- drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
- }
- previousPoint = currentPoint;
- })();
- }
- }
- }
- else {
- var e = new Mb_exception("class Canvas: function drawGeometry: unknown geomType " + t);
- }
- };
-
- /**
- * checks if the MultiGeometry's bounding box width and height is smaller than minWidth
- *
- * @private
- * @param {MultiGeometry} g a MultiGeometry object
- */
- this.isTooSmall = function(g){
- // TODO switch between dot, original, circle
-// return false;
-
- var tmp = g.getBBox();
- var min = realToMap(mapframe,tmp[0]);
- var max = realToMap(mapframe,tmp[1]);
- if((Math.abs(max.x - min.x) < minWidth) && (Math.abs(max.y - min.y) < minWidth)) {
- return true;
- }
- return false;
- };
-
- /**
- * gets the jsGraphics.
- *
- * @private
- * @return the jsGraphics
- * @type jsGraphics
- */
- this.getCanvas = function(){
- return canvas;
- };
-
- this.setDiameter = function (px) {
- diameter = px;
- };
-
- /**
- * draws a circle with {@link jsGraphics}.
- *
- * @private
- * @param {Float} x x value of the center
- * @param {Float} y y value of the center
- * @param {Float} diameter diameter of the circle
- * @param {String} color the color of the circle in hex format
- */
- var drawCircle = function(x, y, diameter, color) {
- canvas.setColor(color);
- canvas.drawEllipse(x-diameter/2,y-diameter/2,diameter,diameter);
- };
-
- /**
- * draws a polyline with {@link jsGraphics}.
- *
- * @private
- * @param {Array} x_array array of x values
- * @param {Array} y_array array of y values
- * @param {String} color the color of the polyline in hex format
- */
- var drawLine = function(x_array, y_array, color) {
- canvas.setColor(color);
- canvas.drawPolyline(x_array, y_array);
- };
-
- /**
- * Displays an icon in the mapframe
- *
- * @private
- * @param {String} url link to the image
- * @param {Float} x x coordinate within the map frame
- * @param {Float} y y coordinate within the map frame
- */
- var displayIcon = function (url, x, y) {
- if(ie){
- var newImg = document.createElement("img");
- var newImgTop = y - Math.round(80/2);
- var newImgLeft = x - Math.round(80/2);
- that.canvasDivTag.getTag().innerHTML = "<img src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
- }
- else{
- var newImg = document.createElement("img");
- newImg.src = url;
- that.canvasDivTag.getTag().appendChild(newImg);
- //newImg.className = "mapsymbol";
- //newImg.style.cursor = "help";
- newImg.style.position = "absolute";
-
- // center the image at x, y
- newImg.style.top = y - Math.round(80/2);
- newImg.style.left = x - Math.round(80/2);
- // newImg.style.top = y - Math.round(80);
- // newImg.style.left = x;
- newImg.style.zIndex = 100;
- }
- };
-
- /**
- * This is the {@link DivTag} that contains the output by {@link jsGraphics}.
- *
- * @type DivTag
- */
- var mapframe = aMapframe;
- var mapObjInd = getMapObjIndexByName(mapframe);
-
- if (mb_mapObj[mapObjInd].getDomElement().frameName) {
- this.canvasDivTag = new DivTag(aTagName, mapName, aStyle);
- }
- else {
- this.canvasDivTag = new DivTag(aTagName, "", aStyle, mb_mapObj[mapObjInd].getDomElement());
- }
-
- var that = this;
-
- var diameter = 8;
- var minWidth = 8;
- var lineWidth = aLineWidth || 2;
- var mapframeWidth = mb_mapObj[mapObjInd].width;
- var mapframeHeight = mb_mapObj[mapObjInd].height;
- eventResizeMap.register(function () {
- mapframeWidth = mb_mapObj[mapObjInd].width;
- mapframeHeight = mb_mapObj[mapObjInd].height;
- });
- var style = aStyle;
- var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName ? window.frames[mapframe] : window);
- canvas.setStroke(lineWidth);
- mb_registerPanSubElement(aTagName);
-}
-
-/**
- * cleans the canvas by emptying the canvas {@link DivTag}.
- */
-Canvas.prototype.clean = function () {
- this.canvasDivTag.clean();
-};
-
-/**
- * paints all geometries.
- *
- * @param {GeometryArray} gA the geometries that will be drawn
- */
-Canvas.prototype.paint = function(gA) {
- for (var q = 0; q < gA.count(); q++) {
- var m = gA.get(q);
- var t = m.geomType;
- var col = m.color;
- if (t == geomType.point) {
- this.drawGeometry(t,m,col);
- }
- else {
- if (this.isTooSmall(m)){
- var newMember = new MultiGeometry(geomType.point);
- newMember.addGeometry();
- newMember.get(-1).addPoint(m.getCenter());
- this.drawGeometry(geomType.point,newMember,col);
- }
- else{
- if(t == geomType.line) {this.drawGeometry(t,m, col);}
- else if(t == geomType.polygon) {this.drawGeometry(t,m,col);}
- else {
- var e = new Mb_exception("class Canvas: function paint: unknown geomType" + t);
- }
- }
- }
- }
- this.getCanvas().paint();
-};
-
-/**
- * @class a {@link Highlight} object is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
- *
- * @constructor
- * @requires Canvas
- * @requires GeometryArray
- * @param {Array} aTargetArray an array of Strings referring to mapframes
- * @param {String} aTagName the name of the div tags
- * @param {Object} aStyle the style of the div tags
- * @param {Integer} the line width of the jsGraphics lines
- */
-function Highlight(aTargetArray, aTagName, aStyle, aLineWidth) {
- /**
- * removes a {@link MultiGeometry} object from the geometry Array
- *
- * @param {MultiGeometry} m a MultiGeometry
- * @param {String} color a color
- */
- this.del = function(m, color) {
- var newMultiGeom;
- if (m.name == nameMultiGeometry) {
- newMultiGeom = m;
- }
- else if (m.name == nameGeometry) {
- var newMultiGeom = new MultiGeometry(m.geomType);
- newMultiGeom.add(m);
- }
-
- var a = gA.findMultiGeometry(newMultiGeom);
- var del = false;
- for (var i=0; i<a.length && del === false; i++) {
- if (gA.get(a[i]).color == color) {
- gA.del(a[i]);
- del = true;
- }
- }
- };
-
- /**
- * adds a {@link MultiGeometry} object to the geometry Array
- *
- * @param {MultiGeometry} m a MultiGeometry
- * @param {String} color the color of the highlight
- */
- this.add = function(m, color) {
-
- if (m.name == nameMultiGeometry) {
- gA.addCopy(m);
- }
- else if (m.name == nameGeometry) {
- var newMultiGeom = new MultiGeometry(m.geomType);
- newMultiGeom.add(m);
- gA.addCopy(newMultiGeom);
- }
- if (typeof(color) != 'undefined') {gA.get(-1).color = color;}
- else {gA.get(-1).color = lineColor;}
- };
-
- this.hide = function () {
- for (var i=0; i < canvas.length; i++) {
- if (typeof(canvas[i]) == "object") {canvas[i].clean();}
- }
- };
-
- /**
- * removes all MultiGeometries.
- *
- */
- this.clean = function() {
- if (gA.count() > 0) {
- gA = new GeometryArray();
- this.paint();
- }
- };
-
- /**
- * displays the highlight
- *
- */
- this.paint = function() {
- this.hide();
- for (var i=0; i < canvas.length; i++) {
- if (typeof(canvas[i]) == "object") {canvas[i].clean();}
- }
- for (var i=0; i<targets.length; i++){
- if (typeof(canvas[i]) == 'undefined') {
- canvas[i] = new Canvas(targets[i], tagname + i, style, lineWidth);
- }
- canvas[i].paint(gA);
- }
- };
-
- this.setDiameter = function (radius) {
- for (var i = 0; i < targets.length; i++) {
- if (typeof(canvas[i]) != "undefined") {
- canvas[i].setDiameter(radius);
- }
- }
- }
-
- this.setMouseOver = function (callback) {
- for (var i=0; i<targets.length; i++){
- if (typeof(canvas[i]) !== 'undefined') {
- canvas[i].canvasDivTag.getTag().onmouseover = function (e) {
- callback(e);
- };
- }
- }
- };
-
- this.setMouseOut = function (callback) {
- for (var i=0; i<targets.length; i++){
- if (typeof(canvas[i]) !== 'undefined') {
- canvas[i].canvasDivTag.getTag().onmouseout = function (e) {
- callback(e);
- };
- }
- }
- };
-
- this.setMouseClick = function (callback) {
- for (var i=0; i<targets.length; i++){
- if (typeof(canvas[i]) !== 'undefined') {
- canvas[i].canvasDivTag.getTag().onclick = function (e) {
- callback(e);
- };
- }
- }
- };
-
- var lineWidth = aLineWidth;
- var tagname = 'mod_gaz_draw'+aTagName;
- var style = aStyle;
- var targets = aTargetArray;
- var canvas = [];
- var gA = new GeometryArray();
- var lineColor = "#ff0000";
- this.paint();
-}
-
-// ----------------------------------------------------------------------------------------------------
-// Snapping
-// ----------------------------------------------------------------------------------------------------
-/**
- * @class a {@link Snapping} object stores is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
- *
- * @constructor
- * @requires GeometryArray
- * @requires Highlight
- * @param {String} aTarget name of the mapframe where snapping occurs
- * @param {String} aTolerance Snapping is activated if the mouse is
- * within aTolerance pixel distance to the reference point.
- * @param {String} aColor apparently deprecated?
- * @param {Integer} aZIndex the z-Index of the {@link jsGraphics} generated by {@link Highlight}.
- */
-function Snapping(aTarget, aTolerance, aColor, aZIndex){
-
- /**
- * draws a circle to highlight the snapped point.
- *
- * @param {Point} center the snapped point.
- * @param {Integer} radius radius of the circular highlight.
- */
- this.draw = function(center,radius){
- mG = new MultiGeometry(geomType.point);
- mG.addGeometry();
- mG.get(-1).addPoint(center);
- highlight.add(mG,snappingColor);
- highlight.paint();
- };
- this.getTolerance = function() {
- return tolerance;
- };
- this.getTarget = function() {
- return target;
- };
- this.cleanHighlight = function() {
- return highlight.clean();
- };
- this.addPoint = function(aPoint) {
- coord.push(aPoint);
- };
- this.getPointCount = function() {
- return coord.length;
- };
- this.getPoint = function(i) {
- return coord[i];
- };
- this.resetPoints = function() {
- coord = [];
- };
- this.getNearestNeighbour = function(){
- if (min_i != -1) {return this.getPoint(min_i);}
- return false;
- };
- this.setIndexOfNearestNeighbour = function(i){
- min_i = i;
- };
- this.resetIndexOfNearestNeighbour = function(){
- min_i = -1;
- };
-
- /**
- * @private
- */
- var tolerance = (typeof(aTolerance) == 'undefined') ? 10 : aTolerance;
-
- /**
- * @private
- */
- var zIndex = (typeof(aZIndex) == 'undefined') ? 50 : aZIndex;
-
- /**
- * @private
- */
- var coord = [];
-
- /**
- * @private
- */
- var min_i = -1;
-
- /**
- * @private
- */
- var target = aTarget;
-
- /**
- * @private
- */
- var snappingColor = aColor;
-
- /**
- * @private
- */
- var lineWidth = 2;
-
- /**
- * @private
- */
- var style = {"position":"absolute", "top":"0px", "left":"0px", "z-index":zIndex};
-
- /**
- * @private
- */
- var highlight = new Highlight([target], "snapping"+Math.round(Math.random()*Math.pow(10,10)), style, lineWidth);
-}
-
-Snapping.prototype.check = function(currPoint){
- var minDist = false;
-
- for (var i = 0 ; i < this.getPointCount() ; i++) {
-
- var currDist = currPoint.dist(realToMap(this.getTarget(), this.getPoint(i)));
- if (minDist === false || currDist < minDist) {
- minDist = currDist;
- if (minDist < this.getTolerance()) {this.setIndexOfNearestNeighbour(i);}
- }
- }
- if (this.getPointCount() > 0 && minDist > this.getTolerance()) {
- this.resetIndexOfNearestNeighbour();
- }
- this.cleanHighlight();
- if (this.isSnapped()) {
- this.draw(this.getNearestNeighbour(), this.getTolerance());
- }
-};
-
-/**
- * Stores the points which will have the snapping property.
- *
- * @param {GeometryArray} geom all points of geom will be stored. May also be a
- * {@link MultiGeometry} or {@link Geometry}.
- * @param {Point} point this point is excluded. Useful when moving a point of a
- * geometry; you don't want to snap against the point you
- * move. Optional.
- */
-Snapping.prototype.store = function(geom, point){
- this.resetPoints();
- this.resetIndexOfNearestNeighbour();
-
- for (var i = 0 ; i < geom.count(); i++){
- if (geom.name == nameGeometryArray || geom.name == nameMultiGeometry){
- for (var j = 0 ; j < geom.get(i).count() ; j++){
- if (geom.get(i).name == nameMultiGeometry){
- // inner rings
- if (geom.get(i).get(j).geomType == geomType.polygon && geom.get(i).get(j).innerRings && geom.get(i).get(j).innerRings.count() > 0) {
- for (var l = 0; l < geom.get(i).get(j).innerRings.count(); l++) {
- var currentRing = geom.get(i).get(j).innerRings.get(l);
- for (var k = 0 ; k < currentRing.count() ; k++){
- if ((currentRing.isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !currentRing.get(k).equals(point))){
- this.add(currentRing.get(k));
- }
- }
-
- }
- }
- // lines, points, outer rings
- for (var k = 0 ; k < geom.get(i).get(j).count() ; k++){
- if ((geom.get(i).get(j).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
- this.add(geom.getPoint(i, j, k));
- }
- }
- }
- else {
- if ((geom.get(i).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
- this.add(geom.getPoint(i, j));
- }
- }
- }
- }
- else {
- if (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point)){
- this.add(geom.get(i));
- }
- }
- }
-};
-
-/**
- * Determines whether a point is within snapping distance to the mouse cursor
- *
- * @return true if a point is within snapping distance; else false
- * @type Boolean
- */
-Snapping.prototype.isSnapped = function(){
- if (this.getNearestNeighbour() !== false) {return true;}
- return false;
-};
-
-/**
- * Returns the point that is within snapping distance and closest to the mouse cursor.
- *
- * @return the point (if there is any); else false
- * @type Point
- */
-Snapping.prototype.getSnappedPoint = function(){
- return this.getNearestNeighbour();
-};
-
-/**
- * Adds the point to the stored points with snapping property.
- *
- * @param {Point} point which receives snapping property.
- */
-Snapping.prototype.add = function(aPoint){
- this.addPoint(aPoint);
-};
-
-/**
- * Removes the highlight.
- */
-Snapping.prototype.clean = function(){
- this.cleanHighlight();
-};
-
-
-
-// ----------------------------------------------------------------------------------------------------
-// misc. functions
-// ----------------------------------------------------------------------------------------------------
-
-/**
- * @ignore
- */
-function calculateVisibleDash (p0, p1, width, height) {
- if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;}
- var p = p0; var q = p1; var m; var ix; var iy;
- if (p1.x != p0.x) {
- m = -(p1.y-p0.y)/(p1.x-p0.x);
- if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) {
- if (p0.x < 0) {
- iy = p0.y - m*(0-p0.x);
- if (iy > 0 && iy < height) {p = new Point(0, iy);}
- else if (iy > height) {
- ix = p0.x+((p0.y - height)/m);
- if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
- }
- else if (iy < 0) {
- ix = p0.x+(p0.y/m);
- if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
- }
- else {return false;}
- }
- else if (p0.y >= 0 && p0.y <= height) {p = p0;}
- else if (p0.y < 0) {
- ix = p0.x+(p0.y/m);
- if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
- }
- else if (p0.y > height && m > 0) {
- ix = p0.x+((p0.y - height)/m);
- if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
- }
- else {return false;}
- if (p1.x > width) {
- iy = p1.y - m*(width-p1.x);
- if (iy > 0 && iy < height) {q = new Point(width, iy);}
- else if (iy < 0) {
- ix = p0.x+(p0.y/m);
- if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
- }
- else if (iy > height) {
- ix = p0.x+((p0.y - height)/m);
- if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
- }
- else {return false;}
- }
- else if (p1.y >= 0 && p1.y <= height) {q = p1;}
- else if (p1.y < 0) {
- ix = p1.x+(p1.y/m);
- if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
- }
- else if (p1.y > height) {
- ix = p1.x+((p1.y- height)/m);
- if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
- }
- }
- else {return false;}
- }
- else {
- if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) {
- if (p0.y < 0) {p = new Point(p0.x, 0);}
- else if (p0.y > height) {p = new Point(p0.x, height);}
- else {p = p0;}
- if (p1.y < 0) {q = new Point(p0.x, 0);}
- else if (p1.y > height) {q = new Point(p0.x, height);}
- else {q = p1;}
- }
- else {return false;}
- }
- return [new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))];
-}
-
-/**
- * @ignore
- */
-function objString (a){
- var z = "";
-
- for (attr in a) {
- var b = a[attr];
- if (typeof(b) == "object") {z += objString(b);}
- else {z += attr + " " + b + "\n";}
- }
- return z;
-}
Copied: branches/google_dev/trunk/http/javascripts/geometry.js (from rev 3947, trunk/mapbender/http/javascripts/geometry.js)
===================================================================
--- branches/google_dev/trunk/http/javascripts/geometry.js (rev 0)
+++ branches/google_dev/trunk/http/javascripts/geometry.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,2176 @@
+/*
+* $Id$
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
+*/
+// http://www.mapbender.org/index.php/GeometryArray.js
+
+
+var nameGeometryArray = "GeometryArray";
+var nameMultiGeometry = "MultiGeometry";
+var nameGeometry = "Geometry";
+
+/**
+ * @class A class representing geometry types "polygon", "line" and "point".
+ *
+ * @constructor
+ */
+function GeomType(){
+ /**
+ * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+ * or {@link Geometry} is a polygon, write
+ * if (someGeometry.geomType == geomType.polygon
+ *
+ * @type String
+ */
+ this.polygon = "polygon";
+
+ /**
+ * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+ * or {@link Geometry} is a line, write
+ * if (someGeometry.geomType == geomType.line
+ *
+ * @type String
+ */
+ this.line = "line";
+
+ /**
+ * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+ * or {@link Geometry} is a point, write
+ * if (someGeometry.geomType == geomType.point
+ *
+ * @type String
+ */
+ this.point = "point";
+}
+var geomType = new GeomType();
+
+
+/**
+ * @class a {@link GeometryArray} is a {@link List} of {@link MultiGeometry} objects
+ *
+ * @ extends List
+ * @ requires MultiGeometry
+ * @ requires Geometry
+ * @ requires Point
+ * @ constructor
+ */
+function GeometryArray(){
+
+ /*
+ * creates a new, empty Multigeometry and adds it to this GeometryArray
+ *
+ * @param {String} geomType a {@link GeomType}
+ */
+ this.addMember = function(geomType){
+ this.add(new MultiGeometry(geomType));
+ };
+
+ /**
+ * @ignore
+ */
+ this.name = nameGeometryArray;
+
+ /**
+ * A {@link List} of {@link MultiGeometry} objects.
+ *
+ * @type List
+ */
+ this.list = [];
+}
+
+GeometryArray.prototype = new List();
+
+/**
+ * gets the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @type Geometry
+ */
+GeometryArray.prototype.getGeometry = function(i,j){
+ var tmp = this.get(i);
+ return tmp.get(j);
+};
+
+/**
+ * gets the k-th Point of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @param {Integer} k index of the Point
+ * @type Point
+ * @returns the Point object at the given indices
+ */
+GeometryArray.prototype.getPoint = function(i, j, k, l){
+ if (l == undefined) {
+ return this.get(i).get(j).get(k);
+ }
+ return this.get(i).get(j).innerRings.get(k).get(l);
+};
+
+/**
+ * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
+ *
+ * @type Integer[]
+ * @param {MultiGeometry} geom
+ * @returns an Array of indices
+ */
+GeometryArray.prototype.findMultiGeometry = function(geom) {
+ var a = [];
+ for (var i=0; i < this.count(); i++) {
+ if (this.get(i).equals(geom)) {a.push(i);}
+ }
+ return a;
+};
+
+/**
+ * deletes the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ */
+GeometryArray.prototype.delGeometry = function(i,j){
+ if (this.get(i).del(j) === false) {
+ this.del(i);
+ }
+};
+
+/**
+ * deletes the k-th {@link Point} of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @param {Integer} k index of the Point
+ */
+GeometryArray.prototype.delPoint = function (i, j, k, l) {
+ var res = this.get(i).delPoint(j, k, l);
+ if (res === false) {
+ this.del(i);
+ }
+};
+
+/**
+ * closes the current {@link MultiGeometry}. Calls method close of the {@link Geometry} class.
+ *
+ */
+GeometryArray.prototype.close = function(){
+ if (!this.get(-1).get(-1).close()) {
+ this.delGeometry(-1, -1);
+ }
+ else {
+ if (this.get(-1).get(-1).count() === 0) {
+ this.get(-1).del(-1);
+ }
+ if (this.get(-1).count() === 0) {
+ this.del(-1);
+ }
+ }
+
+};
+
+/**
+ * deletes all {@link Point} objects of this {@link GeometryArray} that equal point
+ *
+ * @param {Point} point
+ */
+GeometryArray.prototype.delAllPointsLike = function(point){
+ var finished = false;
+ while (finished === false){
+ finished = true;
+ for (var i = 0 ; finished === true && i < this.count() ; i++){
+ for (var j = 0 ; finished === true && j < this.get(i).count() ; j++){
+
+ var currentGeometry = this.get(i).get(j);
+ if (currentGeometry.geomType == geomType.polygon && currentGeometry.innerRings) {
+ for (var k = 0; finished === true && k < currentGeometry.innerRings.count(); k++) {
+ for (var l = 0; finished === true && l < currentGeometry.innerRings.get(k).count(); l++) {
+ if (this.getPoint(i, j, k, l).equals(point)) {
+ this.delPoint(i, j, k, l);
+ finished = false;
+ }
+ }
+ }
+ }
+ if (!finished) {
+ break;
+ }
+
+ for (var k = 0 ; finished === true && k < this.get(i).get(j).count() ; k++){
+ if (this.getPoint(i,j,k).equals(point)){
+ this.delPoint(i,j,k);
+ finished = false;
+ }
+ }
+ }
+ }
+ }
+};
+
+/**
+ * updates all {@link Point} objects of this {@link GeometryArray} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+GeometryArray.prototype.updateAllPointsLike = function(oldP, newP){
+ for (var i = 0; i < this.count(); i++){
+ this.get(i).updateAllPointsLike(oldP, newP);
+ }
+};
+
+GeometryArray.prototype.placemarkToString = function (placemarkId) {
+ var str = "{\"type\": \"Feature\", \"geometry\": ";
+
+ // get geometries with placemarkId
+ var geometriesFromPlacemark = [];
+ for (var i = 0, len = this.count(); i < len; i++) {
+ if (this.get(i).isFromKml() && this.get(i).e.getElementValueByName("Mapbender:placemarkId") == placemarkId) {
+ geometriesFromPlacemark.push(i);
+ }
+ }
+
+ if (geometriesFromPlacemark.length > 1) {
+ str += "{\"type\": \"GeometryCollection\", \"geometries\": [";
+ for (var i = 0; i < geometriesFromPlacemark.length; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ str += this.get(geometriesFromPlacemark[i]).placemarkToString();
+ }
+ str += "]}";
+
+ // metadata is the same for all indices...get from index 0
+ var propString = this.get(geometriesFromPlacemark[0]).e.toString();
+ if (propString) {
+ str += "," + propString;
+ }
+ }
+ else if (geometriesFromPlacemark.length === 1) {
+ str += this.get(geometriesFromPlacemark[0]).placemarkToString();
+ }
+
+ str += "}";
+ return str;
+};
+
+GeometryArray.prototype.getBBox = function(){
+ var q = this.get(0).get(0).get(0);
+ var min = cloneObject(q);
+ var max = cloneObject(q);
+ for(var i=0; i < this.count();i++){
+ var pos = this.get(i).getBBox();
+ if (pos[0].x < min.x) {min.x = pos[0].x;}
+ if (pos[1].x > max.x) {max.x = pos[1].x;}
+ if (pos[1].y > max.y) {max.y = pos[1].y;}
+ if (pos[0].y < min.y) {min.y = pos[0].y;}
+ }
+ return [min, max];
+};
+
+GeometryArray.prototype.importGeometryFromText = function (text, srs) {
+
+ var tmpArray = text.split("(");
+ var geometryType = tmpArray[0];
+
+ switch (geometryType) {
+ case "MULTIPOLYGON":
+ var text = text.replace(/\)/g, "");
+ var sepArray = text.split("(((");
+ var polyArray = sepArray[1].split(",((");
+
+ this.addMember(geomType.polygon);
+ for (var i = 0; i < polyArray.length; i++) {
+ var ringArray = polyArray[i].split(",(");
+ for (var j = 0; j < ringArray.length; j++) {
+ var coordinatesArray = ringArray[j].split(",");
+ if (j === 0) {
+ // add outer ring
+ this.get(-1).addGeometry();
+ for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+ var currentPoint = coordinatesArray[m].split(" ");
+ this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+ this.getGeometry(-1,-1).setEpsg(srs);
+ }
+ this.close();
+ }
+ else {
+ // add inner ring
+ var ring = new Geometry(geomType.polygon);
+ for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+ var currentPoint = coordinatesArray[m].split(" ");
+ ring.addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+ }
+ ring.close();
+ this.getGeometry(-1,-1).addInnerRing(ring);
+ this.getGeometry(-1,-1).setEpsg(srs);
+ }
+ }
+ }
+ break;
+ }
+};
+
+GeometryArray.prototype.importGeoJSON = function (geoJSON) {
+ // you can pass either geoJSON or the evaluated geoJSON string
+ // for backwards compatibility
+ if (typeof(geoJSON) == 'string') {
+ var geoJSON = eval('(' + geoJSON + ')');
+ }
+
+ //
+ // FEATURE COLLECTION
+ //
+ var isFeatureCollection = (geoJSON.type == "FeatureCollection") ? true : false;
+ if (isFeatureCollection) {
+ //
+ // FEATURE
+ //
+ var featureArray = geoJSON.features;
+ for (var j = 0; j < featureArray.length; j++) {
+ var currentFeature = featureArray[j];
+ var isFeature = (currentFeature.type == "Feature") ? true : false;
+
+ // add geometry ...
+ if (currentFeature.geometry && isFeature) {
+ var featureEpsg = "EPSG:4326";
+ if (!currentFeature.crs || currentFeature.crs.type !== "name" || !currentFeature.crs.properties.name) {
+ var e = new Mb_warning("SRS not set or unknown in GeoJSON. Using 'EPSG:4326'.");
+ }
+ else {
+ featureEpsg = currentFeature.crs.properties.name;
+ }
+
+ //
+ // GEOMETRY
+ //
+ var currentGeometry = currentFeature.geometry;
+ var geometrytype = currentGeometry.type;
+ var coordinates = currentGeometry.coordinates;
+ switch (geometrytype) {
+ case "Point":
+ //
+ // POINT
+ //
+ this.addMember(geomType.point);
+
+ this.get(-1).addGeometry();
+ this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
+ this.getGeometry(-1,-1).setEpsg(featureEpsg);
+ this.close();
+ break;
+
+ case "LineString":
+ //
+ // LINESTRING
+ //
+ this.addMember(geomType.line);
+ this.get(-1).addGeometry();
+ for (var m = 0; m < coordinates.length; m++) {
+ var currentPoint = coordinates[m];
+ this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+ }
+ this.getGeometry(-1,-1).setEpsg(featureEpsg);
+ this.close();
+ break;
+
+ case "MultiLineString":
+ //
+ // MULTILINESTRING
+ //
+ this.addMember(geomType.line);
+ for (var m = 0; m < coordinates.length; m++) {
+ this.get(-1).addGeometry();
+ var currentLine = coordinates[m];
+ for (var n = 0; n < currentLine.length; n++) {
+ var currentPoint = currentLine[n];
+ this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+ }
+ this.getGeometry(-1,-1).setEpsg(featureEpsg);
+ }
+ this.close();
+ break;
+
+ case "Polygon":
+ //
+ // POLYGON
+ //
+ this.addMember(geomType.polygon);
+ for (var m = 0; m < coordinates.length; m++) {
+ this.get(-1).addGeometry();
+ var currentPolygon = coordinates[m];
+ for (var n = 0; n < currentPolygon.length; n++) {
+ var currentPoint = currentPolygon[n];
+ this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+ }
+ this.getGeometry(-1,-1).setEpsg(featureEpsg);
+ }
+ this.close();
+ break;
+
+ case "MultiPolygon":
+ //
+ // MULTIPOLYGON
+ //
+ this.addMember(geomType.polygon);
+ for (var m = 0; m < coordinates.length; m++) {
+ this.get(-1).addGeometry();
+ var currentPolygon = coordinates[m];
+ for (var n = 0; n < currentPolygon.length; n++) {
+ var currentRing = currentPolygon[n];
+ if (n == 0) {
+ for (var p = 0; p < currentRing.length; p++) {
+ var currentPoint = currentRing[p];
+ this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+ }
+ }
+ else {
+ var ring = new Geometry(geomType.polygon);
+ for (var p = 0; p < currentRing.length; p++) {
+ var currentPoint = currentRing[p];
+ ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+ }
+ ring.close();
+ this.getGeometry(-1,-1).addInnerRing(ring);
+ }
+ }
+ this.getGeometry(-1,-1).setEpsg(featureEpsg);
+ }
+ this.close();
+ break;
+
+ case "GeometryCollection":
+ var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
+ break;
+ }
+ }
+
+ if (currentFeature.properties) {
+ var properties = currentFeature.properties;
+ // GeometryCollections are NOT YET IMPLEMENTED
+ if (geometrytype != "GeometryCollection") {
+ for (var l in properties) {
+ if (typeof(properties[l]) != "function") {
+ this.get(-1).e.setElement(l, properties[l]);
+ }
+ }
+ this.get(-1).e.setElement("fid", currentFeature.id);
+ }
+ }
+ }
+ }
+ return true;
+}
+
+GeometryArray.prototype.featureToString = function (i) {
+ var str = "{\"type\": \"FeatureCollection\", \"features\": [";
+ str += this.get(i).toString();
+ str += "]}";
+ return str;
+};
+
+
+GeometryArray.prototype.toString = function () {
+ var str = "{\"type\": \"FeatureCollection\", \"features\": [";
+
+ // separate: geometries that are from a KML and those which are not
+ var multiGeometriesFromKml = [];
+ var multiGeometriesNotFromKml = [];
+ for (var i = 0, len = this.count(); i < len; i++) {
+ if (this.get(i).isFromKml()) {
+ var placemarkId = this.get(i).e.getElementValueByName("Mapbender:placemarkId");
+
+ // only add placemark ids once!
+ var isFound = false;
+ for (var j = 0; j < multiGeometriesFromKml && isFound === false; j++) {
+ if (multiGeometriesFromKml == placemarkId) {
+ isFound = true;
+ }
+ }
+ if (!isFound) {
+ multiGeometriesFromKml.push(placemarkId);
+ }
+ }
+ else {
+ multiGeometriesNotFromKml.push(i);
+ }
+ }
+
+ // add geometries not from KML
+ for (var i = 0, len = multiGeometriesNotFromKml.length; i < len; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ str += this.get(multiGeometriesNotFromKml[i]).toString();
+ }
+
+ // add geometries from KML
+ if (multiGeometriesNotFromKml.length > 0 && multiGeometriesFromKml.length > 0) {
+ str += ",";
+ }
+
+ for (var i=0; i < multiGeometriesFromKml.length; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ str += this.placemarkToString();
+ }
+
+ str += "]}";
+ return str;
+};
+
+/**
+ * @class a MultiGeometry is a List of Geometry objects
+ *
+ * @ extends List
+ * @ requires Geometry
+ * @ requires Point
+ * @ constructor
+ * @ param {String} geomType a geomType
+ */
+function MultiGeometry(geomType){
+
+ /*
+ * creates a new, empty {@link Geometry} object and adds it to this {@link MultiGeometry}
+ *
+ */
+ this.addGeometry = function(){
+ this.add(new Geometry(this.geomType));
+ };
+
+ /**
+ * deletes the {@link Geometry} object at index i; -1 refers to the last {@link Geometry object in the list
+ * overwrites the del function of {@link List}.
+ *
+ * @param {Integer} i index
+ */
+ this.del = function(i){
+ i = this.getIndex(i);
+ if (i !== false){
+ var tmpLength = this.count() - 1;
+ for (var z = i; z < tmpLength ; z ++){
+ this.list[z] = this.list[z+1];
+ }
+ this.list.length -= 1;
+ if (this.list.length === 0) {return false;}
+ }
+ return true;
+ };
+
+ this.list = [];
+ this.e = new Wfs_element();
+ this.geomType = geomType;
+ this.name = nameMultiGeometry;
+}
+
+MultiGeometry.prototype = new List();
+
+/**
+ * updates all {@link Point} objects of this {@link MultiGeometry} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+MultiGeometry.prototype.updateAllPointsLike = function(oldP, newP){
+ for (var i = 0; i < this.count(); i++) {
+ this.get(i).updateAllPointsLike(oldP, newP);
+ }
+};
+
+/**
+ * gets the bounding box of this {@link MultiGeometry} as an Array of 2 points
+ *
+ * @return the bounding box
+ * @type Array of two Point objects
+ */
+MultiGeometry.prototype.getBBox = function(){
+ var q = this.get(0).get(0);
+ var min = cloneObject(q);
+ var max = cloneObject(q);
+ for(var i=0; i<this.count();i++){
+ var pos = this.get(i).getBBox();
+ if (pos[0].x < min.x) {min.x = pos[0].x;}
+ if (pos[1].x > max.x) {max.x = pos[1].x;}
+ if (pos[1].y > max.y) {max.y = pos[1].y;}
+ if (pos[0].y < min.y) {min.y = pos[0].y;}
+ }
+ return [min, max];
+};
+
+/**
+ * gets the bounding box of this {@link MultiGeometry} as a polygon of four points
+ *
+ * @return the bounding box
+ * @type MultiGeometry
+ */
+MultiGeometry.prototype.getBBox4 = function() {
+ var bbox = this.getBBox();
+ var realBox = new MultiGeometry(geomType.polygon);
+ realBox.addGeometry(geomType.polygon);
+ realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[0].y);
+ realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[1].y);
+ realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[1].y);
+ realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[0].y);
+ realBox.get(-1).close();
+ return realBox;
+};
+
+/**
+ * gets the center of the bounding box of this {@link MultiGeometry}.
+ *
+ * @return the center of the bounding box
+ * @type Point
+ */
+MultiGeometry.prototype.getCenter = function(){
+ var tmp = this.getBBox();
+ var x = parseFloat(tmp[0].x) + parseFloat((tmp[1].x - tmp[0].x)/2);
+ var y = parseFloat(tmp[0].y) + parseFloat((tmp[1].y - tmp[0].y)/2);
+ return new Point(x,y);
+};
+
+/**
+ * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
+ *
+ * @return number of points
+ * @type Integer
+ */
+MultiGeometry.prototype.getTotalPointCount = function(){
+ var c = 0;
+ for (var i = 0 ; i < this.count(); i++) {
+ c += this.get(i).count();
+ }
+ return c;
+};
+
+/**
+ * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
+ *
+ * @return number of points
+ * @type Integer
+ */
+MultiGeometry.prototype.getPoint = function(j,k){
+ return this.get(j).get(k);
+};
+
+/**
+ * compares this {@link MultiGeometry} object with the {@link MultiGeometry} object multigeom.
+ *
+ * @param {MultiGeometry} multigeom another multigeometry
+ * @return true if he multigeometries match; else false
+ * @type Boolean
+ */
+MultiGeometry.prototype.equals = function(multigeom) {
+ if (this.geomType != multigeom.geomType) {return false;}
+ if (this.count() != multigeom.count()) {return false;}
+ if (this.getTotalPointCount() != multigeom.getTotalPointCount()) {return false;}
+ for (var i=0; i<this.count(); i++) {
+ if (!this.get(i).equals(multigeom.get(i))) {return false;}
+ }
+ return true;
+};
+
+/**
+ * deletes the j-th {@link Point} object of the i-th {@link Geometry} object of this {@link MultiGeometry} object.
+ *
+ * @param {Integer} i geometry index
+ * @param {Integer} j point index
+ * @return true if the deletion succeded; else false.
+ * @type Boolean
+ */
+MultiGeometry.prototype.delPoint = function(i, j, k){
+ var res;
+ if (k == undefined) {
+ res = this.get(i).del(j);
+ if (res === false) {
+ return this.del(i);
+ }
+ }
+ else {
+ res = this.get(i).innerRings.get(j).del(k);
+ if (res === false) {
+ this.get(i).innerRings.del(j);
+ }
+ }
+ return true;
+};
+
+MultiGeometry.prototype.isFromKml = function () {
+ if (this.e.getElementValueByName("Mapbender:kml")) {
+ return true;
+ }
+ return false;
+};
+
+MultiGeometry.prototype.toText = function () {
+ var text = "";
+ var numOfGeom = this.count();
+ if (numOfGeom >= 1) {
+ if (this.geomType == geomType.polygon) {
+ if (numOfGeom > 1) {
+ text += "MULTIPOLYGON (";
+ for (var i = 0; i < numOfGeom; i++) {
+ if (i > 0) {
+ text += ", ";
+ }
+ var currentPolygon = this.get(i);
+ text += "(" + currentPolygon.toText() + ")";
+ }
+ text += ")";
+ }
+ else {
+ text += "POLYGON (" + this.get(0).toText() + ")";
+ }
+ }
+ else if (this.geomType == geomType.line) {
+ text += "LINESTRING (";
+
+ var currentLine = this.get(0);
+ for (var j = 0; j < currentLine.count(); j++) {
+ if (j > 0) {
+ text += ", ";
+ }
+
+ var currentPoint = currentLine.get(j);
+ text += currentPoint.x + " " + currentPoint.y
+ }
+
+ text += ")";
+ }
+
+ }
+ return text;
+};
+
+MultiGeometry.prototype.toString = function () {
+ var str = this.toStringWithoutProperties();
+
+ // properties
+ var propString = this.e.toString();
+ if (propString) {
+ str += "," + propString;
+ }
+
+ str += "}";
+
+ return str;
+};
+
+MultiGeometry.prototype.placemarkToString = function () {
+ var str = "";
+ // geometries
+ for (var i = 0, len = this.count(); i < len; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ str += this.get(i).toString();
+ }
+ return str;
+};
+
+MultiGeometry.prototype.toStringWithoutProperties = function () {
+ var str = "{\"type\": \"Feature\", ";
+
+ var epsg = this.getEpsg();
+ if (epsg) {
+ str += "\"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"" + epsg + "\"}}, ";
+ }
+ str += "\"geometry\": {";
+
+ var len = this.count();
+
+ switch (this.geomType) {
+ case geomType.polygon:
+ if (len > 1) {
+ str += "\"type\": \"MultiPolygon\", ";
+ }
+ else {
+ str += "\"type\": \"Polygon\", ";
+ }
+ break;
+ case geomType.line:
+ if (len > 1) {
+ str += "\"type\": \"MultiLineString\", ";
+ }
+ else {
+ str += "\"type\": \"LineString\", ";
+ }
+ break;
+ case geomType.point:
+ if (len > 1) {
+ str += "\"type\": \"MultiPoint\", ";
+ }
+ else {
+ str += "\"type\": \"Point\", ";
+ }
+ break;
+ }
+
+ str += "\"coordinates\": "
+ // geometries
+ if (len > 1) {
+ str += "[";
+ for (var i = 0; i < len; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ str += this.get(i).toString();
+ }
+ str += "]";
+ }
+ else {
+ str += this.get(0).toString();
+ }
+
+ str += "}";
+
+// this closing curly bracket is added in toString()
+// str += "}";
+
+ return str;
+};
+
+/**
+ * @return the EPSG code of this geometry.
+ * @type integer
+ */
+MultiGeometry.prototype.getEpsg = function () {
+ if (this.count() > 0) {
+ return this.get(0).getEpsg();
+ }
+ return false;
+};
+
+
+function InnerRings () {
+ this.list = [];
+};
+
+InnerRings.prototype = new List();
+
+/**
+ * @class a Geometry is a List of Point objects. If it is a polygon, the last point has
+ * to equal the first point.
+ *
+ * @extends List
+ * @requires Point
+ * @constructor
+ * @param {String} a string representing a geometry type, see @see GeomType.
+ */
+function Geometry(aGeomtype){
+
+ /**
+ * deletes the {@link Point} object at index i; -1 refers to the last
+ * {@link Point} object in the list. Overwrites the del function of
+ * {@link List}.
+ *
+ * @param {Integer} i index
+ * @return false if deletion is not yet finished. It is cascaded to
+ * {@link MultiGeometry}. True if the deletion is finished.
+ */
+ this.del = function(i){
+ i = this.getIndex(i);
+ if (i !== false) {
+ var tmpLength = this.count()-1;
+
+ for (var z = i; z < tmpLength ; z ++){
+ this.list[z] = this.list[z+1];
+ }
+ this.list.length -= 1;
+
+ if (this.geomType == geomType.polygon){
+ if (i == tmpLength) {this.list[0] = this.list[tmpLength-1];}
+ else if (i === 0) {this.list[tmpLength-1] = this.list[0];}
+ if (this.list.length == 1){return false;}
+ }
+ updateDist();
+ if(this.list.length === 0) {return false;}
+ return true;
+ }
+ return false;
+ };
+
+ /**
+ * adds a {@link Point} object to this {@link Geometry} object.
+ *
+ * @param {Float} x x value of the point
+ * @param {Float} y y value of the point
+ */
+ this.addPointByCoordinates = function(x,y,z){
+ var newPoint = new Point(x,y,z);
+ this.add(newPoint);
+// updateDist();
+ };
+
+ /**
+ * adds a {@link Point} object to this {@link Geometry} object.
+ *
+ * @param {Point} aPoint another point
+ */
+ this.addPoint = function(aPoint){
+ this.add(new Point(aPoint.x, aPoint.y, aPoint.z));
+ updateDist();
+ };
+
+ /**
+ * inserts a {@link Point} object at index i of this {@link Geometry} object.
+ *
+ * @param {Point} p another point
+ * @param {Integer} i index
+ */
+ this.addPointAtIndex = function(p,i){
+ i = this.getIndex(i);
+ if (i !== false){
+ for(var z = this.count(); z > i; z--){
+ this.list[z] = this.list[z-1];
+ }
+ this.list[i] = new Point(p.x, p.y, p.z);
+ updateDist();
+ }
+ };
+
+ /**
+ * Overwrites the {@link Point) object at index i with the {@link Point} object p.
+ *
+ * @private
+ * @param {Point} p another point
+ * @param {Integer} i index
+ */
+ this.updatePointAtIndex = function(p, i){
+ i = this.getIndex(i);
+ if ((i === 0 || i == this.count()-1) && this.geomType == geomType.polygon){
+ this.list[0] = p;
+ this.list[this.count()-1] = p;
+ }
+ else {this.list[i] = p;}
+ updateDist();
+ };
+
+ /**
+ * Updates the {@link Geometry#dist} and {@link Geometry#totaldist}
+ *
+ * @private
+ */
+ var updateDist = function(){
+/*
+ * DISABLED BECAUSE IT IS TOO SLOW
+ dist[0] = 0;
+ totaldist[0] = 0;
+ for (var i = 1 ; i < that.count(); i++){
+ dist[i] = that.get(i-1).dist(that.get(i));
+ totaldist[i] = totaldist[i-1] + dist[i];
+ }
+*/
+ };
+ /**
+ * gets the distance between the last and last but one point of this {@link Geometry}.
+ *
+ * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
+ * @return the distance
+ * @type Float
+ */
+ this.getCurrentDist = function(numberOfDigits) {
+ if (typeof(numberOfDigits) == "number") {
+ return roundToDigits(dist[this.count()-1], numberOfDigits);
+ }
+ return dist[this.count()-1];
+
+ };
+ /**
+ * gets the length of the outer rim of this {@link Geometry}.
+ *
+ * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
+ * @return the distance
+ * @type Float
+ */
+ this.getTotalDist = function(numberOfDigits) {
+ if (typeof(numberOfDigits) == "number") {
+ return roundToDigits(totaldist[this.count()-1], numberOfDigits);
+ }
+ return totaldist[this.count()-1];
+ };
+ /**
+ * closes this {@link Geometry}.
+ *
+ * @return true if the geometry could be closed; otherwise false
+ * @type Boolean
+ */
+ this.close = function(){
+ complete = true;
+ if (this.geomType == geomType.polygon){
+ if (this.count() > 2){
+ if (!this.get(0).equals(this.get(-1))) {
+ this.addPoint(this.get(0));
+ }
+ }
+ else {return false;}
+ }
+ if (this.geomType == geomType.line){
+ if (this.count() < 2){return false;}
+ }
+ return true;
+ };
+ /**
+ * checks if this {@link Geometry} has been closed.
+ *
+ * @return true if the geometry is closed; otherwise false
+ * @type Boolean
+ */
+ this.isComplete = function() {
+ return complete;
+ };
+
+ /**
+ * Sets the EPSG of this geometry.
+ *
+ * @param {Integer} someEpsg the EPSG of this geometry.
+ * @return true if the EPSG could be set; else false
+ * @type boolean
+ */
+ this.setEpsg = function (someEpsg) {
+ // TODO: how to check if EPSG code is correct?
+ epsg = someEpsg;
+ return true;
+
+ var e = new Mb_exception("EPSG code not valid ("+someEpsg+")");
+ return false;
+ };
+
+ /**
+ * @return the EPSG code of this geometry.
+ * @type integer
+ */
+ this.getEpsg = function () {
+ return epsg;
+ };
+
+ this.list = [];
+ var dist = [];
+ var totaldist = [];
+ var complete = false;
+
+ var epsg;
+
+ var that = this;
+
+ this.geomType = aGeomtype;
+ this.name = nameGeometry;
+
+ // add these members if the geometry is a polygon
+ if (this.geomType == geomType.polygon) {
+ this.innerRings = new InnerRings();
+ this.addInnerRing = function (somePolygon) {
+ this.innerRings.add(somePolygon);
+ };
+ this.delInnerRing = function (index) {
+ this.innerRings.del(index);
+ };
+ }
+}
+
+Geometry.prototype = new List();
+
+Geometry.prototype.toText = function () {
+ var text = "";
+ switch (this.geomType) {
+ case geomType.polygon:
+ text += "(";
+ for (var j = 0; j < this.count(); j++) {
+ if (j > 0) {
+ text += ", ";
+ }
+ var currentPoint = this.get(j);
+ text += currentPoint.x + " " + currentPoint.y
+ }
+ text += ")";
+ if (this.innerRings && this.innerRings.count() > 0) {
+ for (var k = 0; k < this.innerRings.count(); k++) {
+ text += ", ";
+ text += this.innerRings.get(k).toText();
+ }
+ }
+ break;
+ }
+ return text;
+};
+/**
+ * gets the bounding box of this {@link Geometry}
+ *
+ * @return the bounding box (array of two Point objects)
+ * @type Point[]
+ */
+Geometry.prototype.getBBox = function(){
+ var q = this.get(0);
+ var min = cloneObject(q);
+ var max = cloneObject(q);
+
+ for (var j=0; j<this.count(); j++){
+ var pos = this.get(j);
+ if (pos.x < min.x) {min.x = pos.x;}
+ else if (pos.x > max.x) {max.x = pos.x;}
+ if (pos.y < min.y) {min.y = pos.y;}
+ else if (pos.y > max.y) {max.y = pos.y;}
+ }
+ if (this.geomType == geomType.polygon) {
+ for (var i = 0; i < this.innerRings.count(); i++) {
+ var currentRing = this.innerRings.get(i);
+ for (var j=0; j<currentRing.count(); j++){
+ var pos = currentRing.get(j);
+ if (pos.x < min.x) {min.x = pos.x;}
+ else if (pos.x > max.x) {max.x = pos.x;}
+ if (pos.y < min.y) {min.y = pos.y;}
+ else if (pos.y > max.y) {max.y = pos.y;}
+ }
+ }
+ }
+
+ return [min, max];
+};
+
+/**
+ * updates all {@link Point} objects of this {@link Geometry} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+Geometry.prototype.updateAllPointsLike = function(oldP, newP){
+ var len = this.count();
+ for (var i = 0; i < len ; i++){
+ if (oldP.equals(this.get(i))){
+ if (i>0 && newP.equals(this.get(i-1))){
+ this.del(i);
+ len--;
+ i--;
+ }
+ else {this.updatePointAtIndex(newP, i);}
+ }
+ }
+ if (this.geomType == geomType.polygon) {
+ for (var j = 0; j < this.innerRings.count(); j++) {
+ var len = this.innerRings.get(j).count();
+ for (var i = 0; i < len ; i++){
+ if (oldP.equals(this.innerRings.get(j).get(i))){
+ if (i>0 && newP.equals(this.innerRings.get(j).get(i-1))){
+ this.innerRings.get(j).del(i);
+ len--;
+ i--;
+ }
+ else {this.innerRings.get(j).updatePointAtIndex(newP, i);}
+ }
+ }
+
+ }
+ }
+};
+
+/**
+ * compares this {@link Geometry} object with the {@link Geometry} object geom point by point.
+ *
+ * @param {Geometry} geom another geometry
+ * @return true if he geometries match; else false
+ * @type Boolean
+ */
+Geometry.prototype.equals = function(geom) {
+ if (this.geomType != geom.geomType) {return false;}
+ if (this.count() != geom.count()) {return false;}
+ for (var i=0; i < this.count(); i++) {
+ if (!this.get(i).equals(geom.get(i))) {return false;}
+ }
+ if (!this.innerRings && !geom.innerRings) {
+ // no inner rings; fine
+ }
+ else if (this.innerRings && geom.innerRings) {
+ if (this.innerRings.count() != geom.innerRings.count()) {
+ return false;
+ }
+ for (var j = 0; j < this.innerRings.count(); j++) {
+ if (!this.innerRings.get(j).equals(geom.innerRings.get(j))) {
+ return false;
+ }
+ }
+ }
+ else {
+ // inner ring mismatch
+ return false;
+ }
+ return true;
+};
+
+/**
+ * creates a polygon geometry object which form a buffer around the line geometry
+ *
+ * @param {float} real world units to buffer around the line
+ * @param {float} (optional) units to buffer around the line in Y direction
+ *
+ * @return linebuffer polygon
+ * @type Geometry
+ */
+Geometry.prototype.bufferLine = function(bufferX, bufferY){
+ if(typeof(bufferY)=='undefined')
+ bufferY = bufferX;
+ if(this.geomType!=geomType.line || this.count()<2)
+ return false;
+
+ var ret = new Geometry(geomType.polygon)
+
+ //get vector from point 0 to point 1
+ last_vec = this.get(1).minus(this.get(0));
+
+ //get 90° rotated vector
+ last_vec_o = new Point(-last_vec.y, last_vec.x);
+
+ //resize vectors with apropriate linebuffer length
+ last_vec_o = last_vec_o.dividedBy(last_vec_o.dist(new Point(0,0)));
+ last_vec_o.x*=bufferX; last_vec_o.y*=bufferY;
+ last_vec = last_vec.dividedBy(last_vec.dist(new Point(0,0)));
+ last_vec.x*=bufferX; last_vec.y*=bufferY;
+
+ //add first pointsets
+ ret.list.unshift(this.get(0).plus(last_vec_o).minus(last_vec));
+ ret.list.push(this.get(0).minus(last_vec_o).minus(last_vec));
+
+ for(var i=1;i<this.count()-1;i++){
+ //get vector from point n to point n+1
+ vec = this.get(i+1).minus(this.get(i));
+ //get orthogonal (90° rotated) vector
+ vec_o = new Point(-vec.y, vec.x);
+
+ //resize vectors to linebuffer length
+ vec_o = vec_o.dividedBy(vec_o.dist(new Point(0,0)));
+ vec_o.x*=bufferX; vec_o.y*=bufferY;
+ vec = vec.dividedBy(vec.dist(new Point(0,0)));
+ vec.x*=bufferX; vec.y*=bufferY;
+
+ //if direction is the same continue
+ if(vec.equals(last_vec))
+ continue;
+
+ // calculate directed angle between the two vectors by
+ // calculating the argument diffenrences between complex numbers
+ // arg(x + i*y) (because law of cosine can onlycalculate undirected angle)
+ var angle = (Math.atan2(vec.x,vec.y)-Math.atan2(last_vec.x,last_vec.y))
+ //ensure that angle is -180<=angle<=180
+ if(angle<-Math.PI)angle=2*Math.PI+angle;
+ if(angle>+Math.PI)angle=2*Math.PI-angle;
+
+ //calculate the distance between the next points on boundary
+ //and the line point
+ //the point will be in the direction of angle/2 relative to last_vec_o
+ //since cosine is adjacent side / hypothenuse and we know that
+ //the adjacent side is lineBuffer the hypothenus (our distance) is
+ var ndist = 1/(Math.cos(angle/2))
+ //direction of next points on boundary
+ var int_vec = vec_o.plus(last_vec_o);
+ //resize direction vector to our distance
+ int_vec = int_vec.times(ndist/int_vec.dist(new Point(0,0)));
+ int_vec.x*=bufferX; int_vec.y*=bufferY;
+
+ //look if we have an outer sharp corner (>90°)
+ if(angle>Math.PI/2){
+ //push cutted edge points
+ ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
+ ret.list.unshift(this.get(i).plus(vec_o).minus(vec));
+ }
+ else{
+ //push inner/light edge
+ ret.list.unshift(this.get(i).plus(int_vec));
+ }
+
+ //look if we have an inner sharp corner (<-90°)
+ if(angle<-Math.PI/2){
+ //push cutted edge points
+ ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
+ ret.list.push(this.get(i).minus(vec_o).minus(vec));
+ }
+ else{
+ //push inner/light edge
+ ret.list.push(this.get(i).minus(int_vec));
+ }
+
+ //copy for next point
+ last_vec = vec;
+ last_vec_o = vec_o;
+ }
+ //add last pointsets
+ ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
+ ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
+
+ ret.close();
+
+ return ret;
+}
+
+Geometry.prototype.toString = function () {
+ var str = "";
+ if (this.geomType == geomType.polygon) {
+ str += "[[";
+ for (var i = 0; i < this.count(); i++) {
+ if (i > 0) {
+ str += ", ";
+ }
+ str += this.get(i).toString();
+ }
+
+ if (typeof(this.innerRings) == "object" && this.innerRings.count() > 0) {
+ for (var j = 0; j < this.innerRings.count(); j++) {
+ var currentRing = this.innerRings.get(j);
+
+ str += "],[";
+ for (var i = 0; i < currentRing.count(); i++) {
+ if (i > 0) {
+ str += ", ";
+ }
+ str += currentRing.get(i).toString();
+ }
+ }
+ }
+ str += "]]";
+ }
+ else if (this.geomType == geomType.line) {
+ str += "[";
+ for (var i = 0; i < this.count(); i++) {
+ if (i > 0) {
+ str += ", ";
+ }
+ str += this.get(i).toString();
+ }
+ str += "]";
+ }
+ else if (this.geomType == geomType.point) {
+ str += this.get(0).toString();
+ }
+
+ return str;
+};
+
+
+
+/**
+ * @class an array of elements, each consisting of a name/value pair
+ *
+ * @ constructor
+ */
+function Wfs_element(){
+
+ /**
+ * returns the number of elements of this {@link Wfs_element} object.
+ *
+ * @return the number of elements
+ * @type Integer
+ */
+ this.count = function(){
+ return this.name.length;
+ };
+
+ /**
+ * returns the name of the element at index i.
+ *
+ * @param {Integer} i index
+ * @return the name
+ * @type String
+ */
+ this.getName = function(i){
+ if (this.isValidElementIndex(i)) {return this.name[i];}
+ return false;
+ };
+
+ /**
+ * returns the value of the element at index i.
+ *
+ * @param {Integer} i index
+ * @return the value
+ */
+ this.getValue = function(i){
+ if (this.isValidElementIndex(i)) {return this.value[i];}
+ return false;
+ };
+
+ /**
+ * appends a new element with a given name. If an element with this name exists, it is overwritten.
+ *
+ * @param {String} aName the name of the new element
+ * @param {String} aValue the value of the new element
+ */
+ this.setElement = function(aName, aValue){
+ var i = this.getElementIndexByName(aName);
+ if (i === false) {i = this.count();}
+ this.name[i] = aName;
+ this.value[i] = aValue;
+ };
+
+ /**
+ * removes an element with a given name. If an element with this name exists, it is removed.
+ *
+ * @param {String} aName the name of the element to delete
+ */
+ this.delElement = function(aName){
+ var i = this.getElementIndexByName(aName);
+ if (i !== false) {
+ this.name.splice(i, 1);
+ this.value.splice(i, 1);
+ }
+ }
+
+ /**
+ * checks if an index is valid
+ *
+ * @private
+ * @param {Integer} i an index
+ * @return true if the index is valid; otherwise false
+ * @type Boolean
+ */
+ this.isValidElementIndex = function(i){
+ if (i>=0 && i<this.name.length) {return true;}
+ var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
+ return false;
+ };
+
+ this.name = [];
+ this.value = [];
+}
+
+/**
+ * gets the index of the element with a given name.
+ *
+ * @param {String} elementName a name
+ * @return the index of the element; if no element with this name exists, false
+ * @type Integer, Boolean
+ */
+Wfs_element.prototype.getElementIndexByName = function(elementName){
+ for (var j = 0, len = this.count() ; j < len ; j++){
+ if (this.getName(j) == elementName) {return j;}
+ }
+ return false;
+};
+
+/**
+ * gets the value of the element with a given name.
+ *
+ * @param {String} elementName a name
+ * @return the value of the element; if no element with this name exists, false
+ * @type String, Boolean
+ */
+Wfs_element.prototype.getElementValueByName = function(elementName){
+ var i = this.getElementIndexByName(elementName);
+ if (i === false) {return false;}
+ return this.getValue(i);
+};
+
+Wfs_element.prototype.toString = function () {
+ var str = "";
+ if (this.count() > 0) {
+ str += "\"properties\": {";
+
+ for (i = 0, len = this.count(); i < len; i++) {
+ if (i > 0) {
+ str += ",";
+ }
+ var key = this.getName(i);
+ var value = this.getValue(i);
+ str += "\"" + key + "\":\"" + value + "\"";
+ }
+ str += "}";
+ }
+ return str;
+};
+
+/**
+ * @class a {@link Canvas} contains a {@link DivTag} that holds graphics rendered by {@link jsGraphics}
+ *
+ * @constructor
+ * @requires DivTag
+ * @requires jsGraphics
+ * @requires GeometryArray
+ * @requires MultiGeometry
+ * @requires Geometry
+ * @param {String} aMapFrame name of the target mapframe
+ * @param {String} aTagName name of the target div tag
+ * @param {String} aStyle style of the div tag
+ * @param {Integer} aLineWidth the line width of the jsGraphics output
+ */
+function Canvas(aMapframe, aTagName, aStyle, aLineWidth) {
+
+ /**
+ * draws the geometry of the canvas
+ *
+ * @param {String} t geometry type (@see GeomType)
+ * @param {MultiGeometry} g a MultiGeometry object
+ * @param {String} col a color
+ * @private
+ */
+ this.drawGeometry = function(t,g,col){
+ var mapframeWidth = mb_mapObj[mapObjInd].width;
+ var mapframeHeight = mb_mapObj[mapObjInd].height;
+
+ if(t == geomType.point) {
+ var poiIcon = g.e.getElementValueByName("Mapbender:icon");
+ for(var i=0, ilen = g.count(); i < ilen; i++){
+ var currentGeom = g.get(i);
+ var p = realToMap(mapframe, currentGeom.get(0));
+ var px = p.x;
+ var py = p.y;
+ var radius = diameter/2;
+ if ((px - radius < mapframeWidth && px + radius > 0 &&
+ py - radius < mapframeHeight && py + radius > 0) ||
+ (p.dist(new Point(0,0)) < radius ||
+ p.dist(new Point(mapframeWidth, mapframeHeight)) < radius ||
+ p.dist(new Point(0,mapframeHeight)) < radius ||
+ p.dist(new Point(mapframeWidth, 0)) < radius
+ )
+ ) {
+ // if the point contains a link to an icon, display the icon
+ if (poiIcon) {
+ displayIcon(poiIcon, px, py);
+ }
+ else {
+ drawCircle(px-1, py-1, diameter,col);
+ }
+ }
+ }
+ }
+ else if(t == geomType.line || t==geomType.polygon) {
+ for(var i=0, ilen = g.count(); i < ilen; i++){
+ var currentGeom = g.get(i);
+ // paint inner rings
+ if (t==geomType.polygon && currentGeom.innerRings.count() > 0) {
+ for (var k = 0; k < currentGeom.innerRings.count(); k++) {
+ var currentRing = currentGeom.innerRings.get(k);
+ var previousPoint = realToMap(mapframe, currentRing.get(0));
+ for (var j=1, jlen = currentRing.count(); j < jlen; j++) {
+ (function () {
+ var currentPoint = realToMap(mapframe, currentRing.get(j));
+
+ var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
+ if (pq) {
+ drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
+ }
+ previousPoint = currentPoint;
+ })();
+ }
+
+ }
+ }
+ // paint line or outer ring
+ var previousPoint = realToMap(mapframe, currentGeom.get(0));
+ for (var j=1, jlen = currentGeom.count(); j < jlen; j++) {
+ (function () {
+ var currentPoint = realToMap(mapframe, currentGeom.get(j));
+
+ var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
+ if (pq) {
+ drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
+ }
+ previousPoint = currentPoint;
+ })();
+ }
+ }
+ }
+ else {
+ var e = new Mb_exception("class Canvas: function drawGeometry: unknown geomType " + t);
+ }
+ };
+
+ /**
+ * checks if the MultiGeometry's bounding box width and height is smaller than minWidth
+ *
+ * @private
+ * @param {MultiGeometry} g a MultiGeometry object
+ */
+ this.isTooSmall = function(g){
+ // TODO switch between dot, original, circle
+// return false;
+
+ var tmp = g.getBBox();
+ var min = realToMap(mapframe,tmp[0]);
+ var max = realToMap(mapframe,tmp[1]);
+ if((Math.abs(max.x - min.x) < minWidth) && (Math.abs(max.y - min.y) < minWidth)) {
+ return true;
+ }
+ return false;
+ };
+
+ /**
+ * gets the jsGraphics.
+ *
+ * @private
+ * @return the jsGraphics
+ * @type jsGraphics
+ */
+ this.getCanvas = function(){
+ return canvas;
+ };
+
+ this.setDiameter = function (px) {
+ diameter = px;
+ };
+
+ /**
+ * draws a circle with {@link jsGraphics}.
+ *
+ * @private
+ * @param {Float} x x value of the center
+ * @param {Float} y y value of the center
+ * @param {Float} diameter diameter of the circle
+ * @param {String} color the color of the circle in hex format
+ */
+ var drawCircle = function(x, y, diameter, color) {
+ canvas.setColor(color);
+ canvas.drawEllipse(x-diameter/2,y-diameter/2,diameter,diameter);
+ };
+
+ /**
+ * draws a polyline with {@link jsGraphics}.
+ *
+ * @private
+ * @param {Array} x_array array of x values
+ * @param {Array} y_array array of y values
+ * @param {String} color the color of the polyline in hex format
+ */
+ var drawLine = function(x_array, y_array, color) {
+ canvas.setColor(color);
+ canvas.drawPolyline(x_array, y_array);
+ };
+
+ /**
+ * Displays an icon in the mapframe
+ *
+ * @private
+ * @param {String} url link to the image
+ * @param {Float} x x coordinate within the map frame
+ * @param {Float} y y coordinate within the map frame
+ */
+ var displayIcon = function (url, x, y) {
+ if(ie){
+ var newImg = document.createElement("img");
+ var newImgTop = y - Math.round(80/2);
+ var newImgLeft = x - Math.round(80/2);
+ that.canvasDivTag.getTag().innerHTML = "<img src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
+ }
+ else{
+ var newImg = document.createElement("img");
+ newImg.src = url;
+ that.canvasDivTag.getTag().appendChild(newImg);
+ //newImg.className = "mapsymbol";
+ //newImg.style.cursor = "help";
+ newImg.style.position = "absolute";
+
+ // center the image at x, y
+ newImg.style.top = y - Math.round(80/2);
+ newImg.style.left = x - Math.round(80/2);
+ // newImg.style.top = y - Math.round(80);
+ // newImg.style.left = x;
+ newImg.style.zIndex = 100;
+ }
+ };
+
+ /**
+ * This is the {@link DivTag} that contains the output by {@link jsGraphics}.
+ *
+ * @type DivTag
+ */
+ var mapframe = aMapframe;
+ var mapObjInd = getMapObjIndexByName(mapframe);
+
+ if (mb_mapObj[mapObjInd].getDomElement().frameName) {
+ this.canvasDivTag = new DivTag(aTagName, mapName, aStyle);
+ }
+ else {
+ this.canvasDivTag = new DivTag(aTagName, "", aStyle, mb_mapObj[mapObjInd].getDomElement());
+ }
+
+ var that = this;
+
+ var diameter = 8;
+ var minWidth = 8;
+ var lineWidth = aLineWidth || 2;
+ var style = aStyle;
+ var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName ? window.frames[mapframe] : window);
+ canvas.setStroke(lineWidth);
+ mb_registerPanSubElement(aTagName);
+}
+
+/**
+ * cleans the canvas by emptying the canvas {@link DivTag}.
+ */
+Canvas.prototype.clean = function () {
+ this.canvasDivTag.clean();
+};
+
+/**
+ * paints all geometries.
+ *
+ * @param {GeometryArray} gA the geometries that will be drawn
+ */
+Canvas.prototype.paint = function(gA) {
+ for (var q = 0; q < gA.count(); q++) {
+ var m = gA.get(q);
+ var t = m.geomType;
+ var col = m.color;
+ if (t == geomType.point) {
+ this.drawGeometry(t,m,col);
+ }
+ else {
+ if (this.isTooSmall(m)){
+ var newMember = new MultiGeometry(geomType.point);
+ newMember.addGeometry();
+ newMember.get(-1).addPoint(m.getCenter());
+ this.drawGeometry(geomType.point,newMember,col);
+ }
+ else{
+ if(t == geomType.line) {this.drawGeometry(t,m, col);}
+ else if(t == geomType.polygon) {this.drawGeometry(t,m,col);}
+ else {
+ var e = new Mb_exception("class Canvas: function paint: unknown geomType" + t);
+ }
+ }
+ }
+ }
+ this.getCanvas().paint();
+};
+
+/**
+ * @class a {@link Highlight} object is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
+ *
+ * @constructor
+ * @requires Canvas
+ * @requires GeometryArray
+ * @param {Array} aTargetArray an array of Strings referring to mapframes
+ * @param {String} aTagName the name of the div tags
+ * @param {Object} aStyle the style of the div tags
+ * @param {Integer} the line width of the jsGraphics lines
+ */
+function Highlight(aTargetArray, aTagName, aStyle, aLineWidth) {
+ /**
+ * removes a {@link MultiGeometry} object from the geometry Array
+ *
+ * @param {MultiGeometry} m a MultiGeometry
+ * @param {String} color a color
+ */
+ this.del = function(m, color) {
+ var newMultiGeom;
+ if (m.name == nameMultiGeometry) {
+ newMultiGeom = m;
+ }
+ else if (m.name == nameGeometry) {
+ var newMultiGeom = new MultiGeometry(m.geomType);
+ newMultiGeom.add(m);
+ }
+
+ var a = gA.findMultiGeometry(newMultiGeom);
+ var del = false;
+ for (var i=0; i<a.length && del === false; i++) {
+ if (gA.get(a[i]).color == color) {
+ gA.del(a[i]);
+ del = true;
+ }
+ }
+ };
+
+ /**
+ * adds a {@link MultiGeometry} object to the geometry Array
+ *
+ * @param {MultiGeometry} m a MultiGeometry
+ * @param {String} color the color of the highlight
+ */
+ this.add = function(m, color) {
+
+ if (m.name == nameMultiGeometry) {
+ gA.addCopy(m);
+ }
+ else if (m.name == nameGeometry) {
+ var newMultiGeom = new MultiGeometry(m.geomType);
+ newMultiGeom.add(m);
+ gA.addCopy(newMultiGeom);
+ }
+ if (typeof(color) != 'undefined') {gA.get(-1).color = color;}
+ else {gA.get(-1).color = lineColor;}
+ };
+
+ this.hide = function () {
+ for (var i=0; i < canvas.length; i++) {
+ if (typeof(canvas[i]) == "object") {canvas[i].clean();}
+ }
+ };
+
+ /**
+ * removes all MultiGeometries.
+ *
+ */
+ this.clean = function() {
+ if (gA.count() > 0) {
+ gA = new GeometryArray();
+ this.paint();
+ }
+ };
+
+ /**
+ * displays the highlight
+ *
+ */
+ this.paint = function() {
+ this.hide();
+ for (var i=0; i < canvas.length; i++) {
+ if (typeof(canvas[i]) == "object") {canvas[i].clean();}
+ }
+ for (var i=0; i<targets.length; i++){
+ if (typeof(canvas[i]) == 'undefined') {
+ canvas[i] = new Canvas(targets[i], tagname + i, style, lineWidth);
+ }
+ canvas[i].paint(gA);
+ }
+ };
+
+ this.setDiameter = function (radius) {
+ for (var i = 0; i < targets.length; i++) {
+ if (typeof(canvas[i]) != "undefined") {
+ canvas[i].setDiameter(radius);
+ }
+ }
+ }
+
+ this.setMouseOver = function (callback) {
+ for (var i=0; i<targets.length; i++){
+ if (typeof(canvas[i]) !== 'undefined') {
+ canvas[i].canvasDivTag.getTag().onmouseover = function (e) {
+ callback(e);
+ };
+ }
+ }
+ };
+
+ this.setMouseOut = function (callback) {
+ for (var i=0; i<targets.length; i++){
+ if (typeof(canvas[i]) !== 'undefined') {
+ canvas[i].canvasDivTag.getTag().onmouseout = function (e) {
+ callback(e);
+ };
+ }
+ }
+ };
+
+ this.setMouseClick = function (callback) {
+ for (var i=0; i<targets.length; i++){
+ if (typeof(canvas[i]) !== 'undefined') {
+ canvas[i].canvasDivTag.getTag().onclick = function (e) {
+ callback(e);
+ };
+ }
+ }
+ };
+
+ var lineWidth = aLineWidth;
+ var tagname = 'mod_gaz_draw'+aTagName;
+ var style = aStyle;
+ var targets = aTargetArray;
+ var canvas = [];
+ var gA = new GeometryArray();
+ var lineColor = "#ff0000";
+ this.paint();
+}
+
+// ----------------------------------------------------------------------------------------------------
+// Snapping
+// ----------------------------------------------------------------------------------------------------
+/**
+ * @class a {@link Snapping} object stores is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
+ *
+ * @constructor
+ * @requires GeometryArray
+ * @requires Highlight
+ * @param {String} aTarget name of the mapframe where snapping occurs
+ * @param {String} aTolerance Snapping is activated if the mouse is
+ * within aTolerance pixel distance to the reference point.
+ * @param {String} aColor apparently deprecated?
+ * @param {Integer} aZIndex the z-Index of the {@link jsGraphics} generated by {@link Highlight}.
+ */
+function Snapping(aTarget, aTolerance, aColor, aZIndex){
+
+ /**
+ * draws a circle to highlight the snapped point.
+ *
+ * @param {Point} center the snapped point.
+ * @param {Integer} radius radius of the circular highlight.
+ */
+ this.draw = function(center,radius){
+ mG = new MultiGeometry(geomType.point);
+ mG.addGeometry();
+ mG.get(-1).addPoint(center);
+ highlight.add(mG,snappingColor);
+ highlight.paint();
+ };
+ this.getTolerance = function() {
+ return tolerance;
+ };
+ this.getTarget = function() {
+ return target;
+ };
+ this.cleanHighlight = function() {
+ return highlight.clean();
+ };
+ this.addPoint = function(aPoint) {
+ coord.push(aPoint);
+ };
+ this.getPointCount = function() {
+ return coord.length;
+ };
+ this.getPoint = function(i) {
+ return coord[i];
+ };
+ this.resetPoints = function() {
+ coord = [];
+ };
+ this.getNearestNeighbour = function(){
+ if (min_i != -1) {return this.getPoint(min_i);}
+ return false;
+ };
+ this.setIndexOfNearestNeighbour = function(i){
+ min_i = i;
+ };
+ this.resetIndexOfNearestNeighbour = function(){
+ min_i = -1;
+ };
+
+ /**
+ * @private
+ */
+ var tolerance = (typeof(aTolerance) == 'undefined') ? 10 : aTolerance;
+
+ /**
+ * @private
+ */
+ var zIndex = (typeof(aZIndex) == 'undefined') ? 50 : aZIndex;
+
+ /**
+ * @private
+ */
+ var coord = [];
+
+ /**
+ * @private
+ */
+ var min_i = -1;
+
+ /**
+ * @private
+ */
+ var target = aTarget;
+
+ /**
+ * @private
+ */
+ var snappingColor = aColor;
+
+ /**
+ * @private
+ */
+ var lineWidth = 2;
+
+ /**
+ * @private
+ */
+ var style = {"position":"absolute", "top":"0px", "left":"0px", "z-index":zIndex};
+
+ /**
+ * @private
+ */
+ var highlight = new Highlight([target], "snapping"+Math.round(Math.random()*Math.pow(10,10)), style, lineWidth);
+}
+
+Snapping.prototype.check = function(currPoint){
+ var minDist = false;
+
+ for (var i = 0 ; i < this.getPointCount() ; i++) {
+
+ var currDist = currPoint.dist(realToMap(this.getTarget(), this.getPoint(i)));
+ if (minDist === false || currDist < minDist) {
+ minDist = currDist;
+ if (minDist < this.getTolerance()) {this.setIndexOfNearestNeighbour(i);}
+ }
+ }
+ if (this.getPointCount() > 0 && minDist > this.getTolerance()) {
+ this.resetIndexOfNearestNeighbour();
+ }
+ this.cleanHighlight();
+ if (this.isSnapped()) {
+ this.draw(this.getNearestNeighbour(), this.getTolerance());
+ }
+};
+
+/**
+ * Stores the points which will have the snapping property.
+ *
+ * @param {GeometryArray} geom all points of geom will be stored. May also be a
+ * {@link MultiGeometry} or {@link Geometry}.
+ * @param {Point} point this point is excluded. Useful when moving a point of a
+ * geometry; you don't want to snap against the point you
+ * move. Optional.
+ */
+Snapping.prototype.store = function(geom, point){
+ this.resetPoints();
+ this.resetIndexOfNearestNeighbour();
+
+ for (var i = 0 ; i < geom.count(); i++){
+ if (geom.name == nameGeometryArray || geom.name == nameMultiGeometry){
+ for (var j = 0 ; j < geom.get(i).count() ; j++){
+ if (geom.get(i).name == nameMultiGeometry){
+ // inner rings
+ if (geom.get(i).get(j).geomType == geomType.polygon && geom.get(i).get(j).innerRings && geom.get(i).get(j).innerRings.count() > 0) {
+ for (var l = 0; l < geom.get(i).get(j).innerRings.count(); l++) {
+ var currentRing = geom.get(i).get(j).innerRings.get(l);
+ for (var k = 0 ; k < currentRing.count() ; k++){
+ if ((currentRing.isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !currentRing.get(k).equals(point))){
+ this.add(currentRing.get(k));
+ }
+ }
+
+ }
+ }
+ // lines, points, outer rings
+ for (var k = 0 ; k < geom.get(i).get(j).count() ; k++){
+ if ((geom.get(i).get(j).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
+ this.add(geom.getPoint(i, j, k));
+ }
+ }
+ }
+ else {
+ if ((geom.get(i).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
+ this.add(geom.getPoint(i, j));
+ }
+ }
+ }
+ }
+ else {
+ if (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point)){
+ this.add(geom.get(i));
+ }
+ }
+ }
+};
+
+/**
+ * Determines whether a point is within snapping distance to the mouse cursor
+ *
+ * @return true if a point is within snapping distance; else false
+ * @type Boolean
+ */
+Snapping.prototype.isSnapped = function(){
+ if (this.getNearestNeighbour() !== false) {return true;}
+ return false;
+};
+
+/**
+ * Returns the point that is within snapping distance and closest to the mouse cursor.
+ *
+ * @return the point (if there is any); else false
+ * @type Point
+ */
+Snapping.prototype.getSnappedPoint = function(){
+ return this.getNearestNeighbour();
+};
+
+/**
+ * Adds the point to the stored points with snapping property.
+ *
+ * @param {Point} point which receives snapping property.
+ */
+Snapping.prototype.add = function(aPoint){
+ this.addPoint(aPoint);
+};
+
+/**
+ * Removes the highlight.
+ */
+Snapping.prototype.clean = function(){
+ this.cleanHighlight();
+};
+
+
+
+// ----------------------------------------------------------------------------------------------------
+// misc. functions
+// ----------------------------------------------------------------------------------------------------
+
+/**
+ * @ignore
+ */
+function calculateVisibleDash (p0, p1, width, height) {
+ if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;}
+ var p = p0; var q = p1; var m; var ix; var iy;
+ if (p1.x != p0.x) {
+ m = -(p1.y-p0.y)/(p1.x-p0.x);
+ if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) {
+ if (p0.x < 0) {
+ iy = p0.y - m*(0-p0.x);
+ if (iy > 0 && iy < height) {p = new Point(0, iy);}
+ else if (iy > height) {
+ ix = p0.x+((p0.y - height)/m);
+ if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
+ }
+ else if (iy < 0) {
+ ix = p0.x+(p0.y/m);
+ if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
+ }
+ else {return false;}
+ }
+ else if (p0.y >= 0 && p0.y <= height) {p = p0;}
+ else if (p0.y < 0) {
+ ix = p0.x+(p0.y/m);
+ if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
+ }
+ else if (p0.y > height && m > 0) {
+ ix = p0.x+((p0.y - height)/m);
+ if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
+ }
+ else {return false;}
+ if (p1.x > width) {
+ iy = p1.y - m*(width-p1.x);
+ if (iy > 0 && iy < height) {q = new Point(width, iy);}
+ else if (iy < 0) {
+ ix = p0.x+(p0.y/m);
+ if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
+ }
+ else if (iy > height) {
+ ix = p0.x+((p0.y - height)/m);
+ if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
+ }
+ else {return false;}
+ }
+ else if (p1.y >= 0 && p1.y <= height) {q = p1;}
+ else if (p1.y < 0) {
+ ix = p1.x+(p1.y/m);
+ if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
+ }
+ else if (p1.y > height) {
+ ix = p1.x+((p1.y- height)/m);
+ if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
+ }
+ }
+ else {return false;}
+ }
+ else {
+ if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) {
+ if (p0.y < 0) {p = new Point(p0.x, 0);}
+ else if (p0.y > height) {p = new Point(p0.x, height);}
+ else {p = p0;}
+ if (p1.y < 0) {q = new Point(p0.x, 0);}
+ else if (p1.y > height) {q = new Point(p0.x, height);}
+ else {q = p1;}
+ }
+ else {return false;}
+ }
+ return [new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))];
+}
+
+/**
+ * @ignore
+ */
+function objString (a){
+ var z = "";
+
+ for (attr in a) {
+ var b = a[attr];
+ if (typeof(b) == "object") {z += objString(b);}
+ else {z += attr + " " + b + "\n";}
+ }
+ return z;
+}
Modified: branches/google_dev/trunk/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/map.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -16,14 +16,81 @@
* @type Object
*/
function Extent(minx,miny,maxx,maxy) {
- this.minx = parseFloat(minx);
- this.miny = parseFloat(miny);
- this.maxx = parseFloat(maxx);
- this.maxy = parseFloat(maxy);
- this.extentx = this.maxx - this.minx;
- this.extenty = this.maxy - this.miny;
- this.centerx = this.minx + this.extentx/2;
- this.centery = this.miny + this.extenty/2;
+ var that = this;
+
+ var setMin = function (min) {
+ that.min = min;
+ that.minx = min.x;
+ that.miny = min.y;
+ };
+ var setMax = function (max) {
+ that.max = max;
+ that.maxx = max.x;
+ that.maxy = max.y;
+ };
+
+ var setExtent = function (extent) {
+ that.extent = extent;
+ that.extentx = extent.x;
+ that.extenty = extent.y;
+ };
+
+ var setCenter = function (center) {
+ that.center = center;
+ that.centerx = center.x;
+ that.centery = center.y;
+ };
+
+ /**
+ * Allows to set the center (one param) or the extent (two params)
+ *
+ * @param {Point} min or center
+ * @param {Point} max [obsolete if first is center]
+ */
+ this.set = function (min, max) {
+ // only one parameter (center)
+ if (typeof max === "undefined") {
+ var newLowerLeft = min.minus(this.extent.dividedBy(2));
+ var newUpperRight = min.plus(this.extent.dividedBy(2));
+ setMin(newLowerLeft);
+ setMax(newUpperRight);
+ setCenter(min);
+ }
+ // two parameters (lower left and upper right ( = extent))
+ else {
+ setMin(min);
+ setMax(max);
+ setExtent(max.minus(min));
+ setCenter((min.plus(max)).dividedBy(2));
+ }
+ };
+
+ this.toString = function () {
+ return this.min.x + "," + this.min.y + "," + this.max.x + "," + this.max.y;
+ };
+
+ var isPoint = function (param) {
+ if (typeof param === "object" && param.constructor === Point) {
+ return true;
+ }
+ return false;
+ };
+
+ if (isPoint(minx) && isPoint(miny) &&
+ typeof maxx === "undefined" &&
+ typeof maxy === "undefined") {
+
+ // input is "point, point"
+ this.set(minx, miny);
+ }
+ else {
+ // input is "coordinate, coordinate, coordinate, coordinate"
+ // deprecated
+ this.set(
+ new Point(parseFloat(minx), parseFloat(miny)),
+ new Point(parseFloat(maxx), parseFloat(maxy))
+ );
+ }
return this;
}
@@ -144,7 +211,7 @@
if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
requestParams += "SRS="+mb_mapObj[i].epsg+"&";
- requestParams += "BBOX="+mb_mapObj[i].extent+"&";
+ requestParams += "BBOX="+mb_mapObj[i].extent.toString()+"&";
requestParams += "WIDTH="+mb_mapObj[i].width+"&";
requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
@@ -361,7 +428,7 @@
function mb_repaint(frameName,minx,miny,maxx,maxy){
new Mb_warning("The function mb_repaint is deprecated.");
var ind = getMapObjIndexByName(frameName);
- mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+ mb_mapObj[ind].extent = new Extent(minx, miny, maxx, maxy);
setMapRequest(frameName);
}
Modified: branches/google_dev/trunk/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/map.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -202,4 +202,4 @@
Mapbender.Modules[module].init();
}
}
-});
+});
\ No newline at end of file
Deleted: branches/google_dev/trunk/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/map_obj.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,1018 +0,0 @@
-/*
-* $Id: map_obj.js 2517 2008-06-19 16:40:00Z christoph $
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
-*/
-var mb_mapObj = [];
-
-function mb_mapObj_const(frameName, elementName, width, height, wms_index){
-
- /**
- * set the extent of the wms
- */
- this.setExtent = function(minx, miny, maxx, maxy){
- this.extent = String(minx) + "," + String(miny) + "," + String(maxx) + "," + String(maxy);
- };
-
- this.restrictedExtent = function (extent) {
- this.restrictedExtent = extent;
- };
-
- /**
- * get the width of the mapObj
- *
- * @member mb_mapObj_const
- * @return width of the mapObj
- * @type integer
- */
- this.getWidth = function(){
- return parseInt(this.width, 10);
- };
-
- /**
- * set the width of the mapObj
- *
- * @param {integer} widht the width of the mapObj
- */
- this.setWidth = function(width){
- this.width = parseInt(width, 10);
-
- //apply new width
- if(this.frameName){
- document.getElementById(this.frameName).style.width = this.width;
- }
- var domElement = this.getDomElement();
- domElement.style.width = this.width;
- };
-
- /**
- * get the height of the mapObj
- *
- * @member mb_mapObj_const
- * @return width of the mapObj
- * @type integer
- */
- this.getHeight = function(){
- return parseInt(this.height, 10);
- };
-
- this.getDomElement = function(){
- if(this.frameName){
- return window.frames[this.frameName].document.getElementById(this.elementName);
- }
- return document.getElementById(this.elementName);
- }
-
- /**
- * set the height of the mapObj
- *
- * @param {integer} height the height of the mapObj
- */
- this.setHeight = function(height){
- this.height = parseInt(height, 10);
- //apply new height
- if(this.frameName){
- document.getElementById(this.frameName).style.height = this.height;
- }
- var domElement = this.getDomElement();
- domElement.style.height = this.height;
- };
-
- this.getMousePosition = function (e) {
- var clickX, clickY;
-
- if ($.browser.msie) {
- if (window.event) {
- clickX = window.event.clientX;
- clickY = window.event.clientY;
- }
- else {
- clickX = e.clientX;
- clickY = e.clientY;
- }
- }
- else{
- clickX = e.pageX;
- clickY = e.pageY;
- }
-
- var currentPos = null;
- if (this.type == "DIV") {
- var mapDomElement = this.getDomElement();
- currentPos = new Point(
- clickX - parseInt(mapDomElement.style.left),
- clickY - parseInt(mapDomElement.style.top)
- );
- // if the mouse position is not on top of the map, return null
- if (currentPos.x < 0 || currentPos.x > this.width ||
- currentPos.y < 0 || currentPos.y > this.height) {
- return null;
- }
- }
- else {
- currentPos = new Point(
- clickX,
- clickY
- );
- }
- return currentPos;
- }
-
- /**
- * converts the extent of the mapobject so that the maximum extent will be displayed
- */
- this.calculateExtent = function(ext){
- var relation_px_x = this.getWidth() / this.getHeight();
- var relation_px_y = this.getHeight() / this.getWidth();
- var relation_bbox_x = ext.extentx / ext.extenty;
- if (relation_bbox_x <= relation_px_x) {
- ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
- ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
- }
- if (relation_bbox_x > relation_px_x) {
- ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
- ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
- }
-
- // Check if ext is within restricted extent
- // If not, calculate a new extent according
- // to restricted extent.
- /*
- if ( this.restrictedExtent ) {
- if ( ext.minx < this.restrictedExtent.minx ) {
- ext.minx = this.restrictedExtent.minx;
- ext.maxx = ext.minx + (relation_px_x * ext.extenty);
- }
- if ( ext.miny < this.restrictedExtent.miny ) {
- ext.miny = this.restrictedExtent.miny;
- ext.maxy = ext.miny + (relation_px_y * ext.extentx);
- }
- if ( ext.maxx > this.restrictedExtent.maxx ) {
- ext.maxx = this.restrictedExtent.maxx;
- ext.minx = ext.maxx - (relation_px_x * ext.extenty);
- }
- if ( ext.maxy > this.restrictedExtent.maxy ) {
- ext.maxy = this.restrictedExtent.maxy;
- ext.miny = ext.maxy - (relation_px_y * ext.extentx);
- }
- }
- */
- this.setExtent(ext.minx, ext.miny, ext.maxx, ext.maxy);
- return ext;
- };
-
-
- this.width = width;
- this.height = height;
- this.frameName = frameName;
- this.type = (frameName !== "") ? "IFRAME" : "DIV";
- this.elementName = elementName;
- this.layers = [];
- this.styles = [];
- this.querylayers = [];
- this.geom = "";
- this.gml = "";
- this.wms = [];
-
- //
- // Add pointers to WMS objects which are in this map.
- // If wms_index is set (=map is overview), only this
- // WMS is being pointed to.
- //
- var index = 0;
- for (var i = 0; i < wms.length; i++) {
- var isValidWms = (wms_index === null) || (wms_index == i);
- if (isValidWms) {
- this.wms[index] = wms[i];
- this.wms[index].mapURL = false;
- index++;
- }
- }
-
- //
- // set list of visible layers, active querylayers
- // and styles for each WMS in this map
- //
- var cnt_layers;
- var cnt_querylayers;
- var styles;
- var layers;
- var querylayers = "";
- for (i = 0; i < this.wms.length; i++) {
- cnt_layers = 0;
- cnt_querylayers = 0;
- styles = "";
- layers = "";
- querylayers = "";
-
- for (var ii = 0; ii < this.wms[i].objLayer.length; ii++) {
- // layer is visible and not root layer
- if (this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii > 0) {
- if (cnt_layers > 0) {
- layers += ",";
- styles += ",";
- }
- layers += wms[i].objLayer[ii].layer_name;
- styles += "";
- cnt_layers++;
- }
- // layer is queryable and not root layer
- if (this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii > 0) {
- if (cnt_querylayers > 0) {
- querylayers += ",";
- }
- querylayers += wms[i].objLayer[ii].layer_name;
- cnt_querylayers++;
- }
- }
- this.layers[i] = layers;
- this.styles[i] = styles;
- this.querylayers[i] = querylayers;
- }
-
- this.epsg = wms[0].gui_wms_epsg;
- var bbox_minx, bbox_miny, bbox_maxx, bbox_maxy;
-
- for (var i = 0; i < wms[0].gui_epsg.length; i++) {
- if (this.epsg == wms[0].gui_epsg[i]) {
- bbox_minx = parseFloat(wms[0].gui_minx[i]);
- bbox_miny = parseFloat(wms[0].gui_miny[i]);
- bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
- bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
- }
- }
- var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
-
- this.calculateExtent(wmsExtent);
-
- this.mapURL = [];
- var domElement = this.getDomElement();
- domElement.style.width = this.width;
- domElement.style.height = this.height;
-
-
- /**
- * get the extent of the mapObj
- *
- * @member mb_mapObj_const
- * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy
- * @type string
- */
- this.getExtent = function(){
- return this.extent;
- };
-
- /**
- * get the extent as minx, maxx, miny, maxy
- *
- * @return extent and additional informations of the mapObj
- * @type Object
- */
- this.getExtentInfos = function(){
- var c = this.getExtent().split(",");
- var ext = new Extent(c[0], c[1], c[2], c[3]);
- return ext;
- };
-
- /**
- * Sets the list of layers, styles and querylayers for a specified WMS
- */
- this.restateLayers = function(wms_id){
- for (var i = 0; i < this.wms.length; i++) {
- if (this.wms[i].wms_id == wms_id) {
- var currentWms = this.wms[i];
- var cnt_layers = 0;
- var cnt_querylayers = 0;
- var layers = "";
- var styles = "";
- var querylayers = "";
- for (var ii = 0; ii < currentWms.objLayer.length; ii++) {
- var currentLayer = currentWms.objLayer[ii];
- if (currentLayer.gui_layer_visible == 1 && !currentLayer.has_childs) {
- if (cnt_layers > 0) {
- layers += ",";
- styles += ",";
- }
- layers += currentLayer.layer_name;
- styles += "";
- cnt_layers++;
- }
- if (currentLayer.gui_layer_querylayer == 1 && !currentLayer.has_childs) {
- if (cnt_querylayers > 0) {
- querylayers += ",";
- }
- querylayers += currentLayer.layer_name;
- cnt_querylayers++;
- }
- }
- this.layers[i] = layers;
- this.querylayers[i] = querylayers;
- this.styles[i] = styles;
- }
- }
-// this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
- };
-
- /**
- *
- * @param {Object} direction
- */
- this.pan = function (direction) {
- var arrayBBox = this.extent.split(",");
- var minx = parseFloat(arrayBBox[0]);
- var miny = parseFloat(arrayBBox[1]);
- var maxx = parseFloat(arrayBBox[2]);
- var maxy = parseFloat(arrayBBox[3]);
- var xtentx = maxx - minx;
- var xtenty = maxy - miny;
- var factor = 0.5;
-
- switch (direction) {
- case "NW" :
- minx -= (xtentx * factor);
- maxx -= (xtentx * factor);
- miny += (xtenty * factor);
- maxy += (xtenty * factor);
- break;
- case "N" :
- miny += (xtenty * factor);
- maxy += (xtenty * factor);
- break;
- case "NE" :
- minx += (xtentx * factor);
- maxx += (xtentx * factor);
- miny += (xtenty * factor);
- maxy += (xtenty * factor);
- break;
- case "E" :
- minx += (xtentx * factor);
- maxx += (xtentx * factor);
- break;
- case "SE" :
- minx += (xtentx * factor);
- maxx += (xtentx * factor);
- miny -= (xtenty * factor);
- maxy -= (xtenty * factor);
- break;
- case "S" :
- miny -= (xtenty * factor);
- maxy -= (xtenty * factor);
- break;
- case "SW" :
- minx -= (xtentx * factor);
- maxx -= (xtentx * factor);
- miny -= (xtenty * factor);
- maxy -= (xtenty * factor);
- break;
- case "W" :
- minx -= (xtentx * factor);
- maxx -= (xtentx * factor);
- break;
- }
- this.extent = minx + "," + miny + "," + maxx + "," + maxy;
-
- this.restrictedExtent;
- this.setMapRequest();
-
- };
-
- this.zoomFull = function () {
-
- if (this.restrictedExtent) {
- var newExtent = this.calculateExtent(this.restrictedExtent);
- this.repaint(new Point(newExtent.minx, newExtent.miny), new Point(newExtent.maxx, newExtent.maxy));
- }
- else {
- for (var i = 0; i < this.wms[0].gui_epsg.length; i++) {
- if (this.epsg == this.wms[0].gui_epsg[i]) {
- var bbox_minx = parseFloat(this.wms[0].gui_minx[i]);
- var bbox_miny = parseFloat(this.wms[0].gui_miny[i]);
- var bbox_maxx = parseFloat(this.wms[0].gui_maxx[i]);
- var bbox_maxy = parseFloat(this.wms[0].gui_maxy[i]);
-
- var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
- var newExtent = this.calculateExtent(wmsExtent);
- this.repaint(new Point(newExtent.minx, newExtent.miny), new Point(newExtent.maxx, newExtent.maxy));
- break;
- }
- }
- }
- };
-
- /**
- * zoom the map with a zoomfactor and optional to x,y coords
- *
- * @param {boolean} in_ in = true, out = false
- * @param {float} factor the zoomfactor 1 equals 100%
- * @param {float} x center to x-position
- * @param {float} y center to y-position
- */
- this.zoom = function(in_, factor, x, y){
- factor = parseFloat(factor);
- if (!in_) {
- factor = 1 / factor;
- }
-
- var extent = this.getExtentInfos();
- var distx = extent.maxx - extent.minx;
- var disty = extent.maxy - extent.miny;
-
- if (x && y) {
- var centerx = parseFloat(x);
- var centery = parseFloat(y);
- }
- else {
- var centerx = extent.minx + distx / 2;
- var centery = extent.miny + disty / 2;
- }
-
- var new_distx = distx / factor;
- var new_disty = disty / factor;
- var minx = centerx - new_distx / 2;
- var miny = centery - new_disty / 2;
- var maxx = centerx + new_distx / 2;
- var maxy = centery + new_disty / 2;
- // Check if ext is within restricted extent
- // If not, calculate a new extent according
- // to restricted extent.
- /*
- var relation_px_x = this.getWidth() / this.getHeight();
- var relation_px_y = this.getHeight() / this.getWidth();
- if ( this.restrictedExtent ) {
- if ( minx < this.restrictedExtent.minx ) {
- minx = this.restrictedExtent.minx;
- maxx = minx + (relation_px_x * new_disty);
- }
- if ( miny < this.restrictedExtent.miny ) {
- miny = this.restrictedExtent.miny;
- maxy = miny + (relation_px_y * new_distx);
- }
- if ( maxx > this.restrictedExtent.maxx ) {
- maxx = this.restrictedExtent.maxx;
- minx = maxx - (relation_px_x * new_distx);
- }
- if ( maxy > this.restrictedExtent.maxy ) {
- maxy = this.restrictedExtent.maxy;
- miny = maxy - (relation_px_y * new_disty);
- }
- }
- */
-
- this.setExtent(minx, miny, maxx, maxy);
-
- this.setMapRequest();
- };
-
- var performUnknownCalculation = function (value) {
- return Math.pow(10,(
- Math.round(
- Math.log(value)/
- Math.log(10)
- )
- ));
- };
-
- this.convertPixelToReal = function (aPoint) {
- var arrayBBox = this.extent.split(",");
- var minX = parseFloat(arrayBBox[0]);
- var minY = parseFloat(arrayBBox[1]);
- var maxX = parseFloat(arrayBBox[2]);
- var maxY = parseFloat(arrayBBox[3]);
- var xtentx = maxX - minX;
- var xtenty = maxY - minY;
- var deltaX = xtentx/this.width;
- var deltaY = xtenty/this.height;
- var roundx, roundy;
-
- if(deltaX > 0){
- roundx = 1/performUnknownCalculation(deltaX);
- }
- else{
- roundx = performUnknownCalculation(deltaX);
- }
- if(deltaY > 0){
- roundy = 1/performUnknownCalculation(deltaY);
- }
- else{
- roundy = performUnknownCalculation(deltaY);
- }
- var posX = parseFloat(minX + (aPoint.x / this.width) * xtentx);
- var posY = parseFloat(maxY - (aPoint.y / this.height) * xtenty);
- posX = Math.round(posX * roundx) / roundx;
- posY = Math.round(posY * roundy) / roundy;
- return new Point(posX, posY);
- };
-
- /**
- * Convert real world coordinates to pixel coordinates
- */
- this.convertRealToPixel = function (aPoint) {
- var arrayBBox = this.extent.split(",");
- var minX = parseFloat(arrayBBox[0]);
- var minY = parseFloat(arrayBBox[1]);
- var maxX = parseFloat(arrayBBox[2]);
- var maxY = parseFloat(arrayBBox[3]);
- return new Point(
- Math.round((aPoint.x - minX) * this.width /(maxX - minX)),
- Math.round((maxY - aPoint.y) * this.height/(maxY - minY))
- );
- };
-
- /**
- * get the srs of the mapObj
- *
- * @return srs as epsg:number
- * @type string
- */
- this.getSRS = function(){
- return this.epsg;
- };
-
- /**
- * get all mapRequests
- *
- * @return array of mapRequests of this map object
- * @type string[]
- */
- this.getMapRequests = function(){
- var allRequests = [];
- //loop through all wms to get the mapRequests
- for (var i = 0; i < this.wms.length; i++) {
- var currentRequest = this.wms[i].getMapRequest(this);
- if (currentRequest) {
- allRequests.push(currentRequest);
- }
- }
- if (allRequests.length > 0) {
- return allRequests;
- }
- return false;
- };
-
- /**
- * Return the map URL of the WMS at index i
- * @param {Object} currentWmsIndex
- */
- this.getMapUrl = function(ii){
- var currentWms = this.wms[ii];
- var validLayers = currentWms.getLayers(this);
- if(validLayers.length === 0) {
- return false;
- }
- var layerNames = validLayers.join(",");
-
- url = currentWms.wms_getmap;
- url += mb_getConjunctionCharacter(currentWms.wms_getmap);
-
- if (currentWms.wms_version == "1.0.0") {
- url += "WMTVER=" + currentWms.wms_version + "&REQUEST=map&";
- }
- else {
- url += "VERSION=" + currentWms.wms_version + "&REQUEST=GetMap&SERVICE=WMS&";
- }
-
- url += "LAYERS=" + layerNames + "&";
- url += "STYLES=";
- var layer = layerNames.split(",");
- for (var j = 0; j < layer.length; j++) {
- if (j > 0) {
- url += ",";
- }
- if (currentWms.getCurrentStyleByLayerName(layer[j]) !== false) {
- url += currentWms.getCurrentStyleByLayerName(layer[j]);
- }
- }
- url += "&";
- url += "SRS=" + this.epsg + "&";
- url += "BBOX=" + this.extent + "&";
- url += "WIDTH=" + this.width + "&";
- url += "HEIGHT=" + this.height + "&";
- url += "FORMAT=" + currentWms.gui_wms_mapformat + "&";
- url += "BGCOLOR=0xffffff&";
-
- if (currentWms.gui_wms_mapformat.search(/gif/i) > -1 ||
- currentWms.gui_wms_mapformat.search(/png/i) > -1) {
- url += "TRANSPARENT=TRUE&";
- }
-
- url += "EXCEPTIONS=" + currentWms.gui_wms_exceptionformat + "&";
-
- // add vendor-specific
- for (var v = 0; v < mb_vendorSpecific.length; v++) {
- var vendorSpecificString = eval(mb_vendorSpecific[v]);
- // if eval doesn't evaluate a function, the result is undefined.
- // Sometimes it is necessary not to evaluate a function, for
- // example if you want to change a variable from the current
- // scope (see mod_addSLD.php)
- if (typeof(vendorSpecificString) != "undefined") {
- url += vendorSpecificString + "&";
- }
- }
- // add Filter
- if (currentWms.wms_filter !== "") {
- url += "&SLD=" + currentWms.wms_filter + "?id=" + mb_styleID + "&";
- }
- // add sld
- if (currentWms.gui_wms_sldurl !== "") {
- url += "&SLD=" + escape(currentWms.gui_wms_sldurl) + "&";
- }
- return url;
- }
-
- /**
- * get all featureInfoRequests
- *
- * @member mb_mapObj_const
- * @param float x the x-value of the click position in pixel
- * @param float y the y-value of the click position in pixel
- * @return array of all featureInfoRequests of this map object
- * @type string[]
- */
- this.getFeatureInfoRequests = function(clickPoint){
- var allRequests = [];
- //loop through all wms to get the FeatureInfoRequests
- for (var i = 0; i < this.wms.length; i++) {
- var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
- if (currentRequest) {
- allRequests.push(currentRequest);
- }
- }
- if (allRequests.length > 0) {
- return allRequests;
- }
- return false;
- };
-
- /**
- * calculation of the mapscale
- *
- * @member mb_mapObj_const
- * @return scale
- * @type integer
- */
- this.getScale = function(){
- var scale;
- var bbox = this.extent.split(",");
- var xtenty;
- if (this.epsg == "EPSG:4326") {
- var pxLenx = (parseFloat(bbox[2]) - parseFloat(bbox[0])) / this.width;
- var pxLeny = (parseFloat(bbox[3]) - parseFloat(bbox[1])) / this.height;
- var lat_from = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2) * Math.PI) / 180;
- var lat_to = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2 + pxLeny) * Math.PI) / 180;
- var lon_from = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2) * Math.PI) / 180;
- var lon_to = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2 + pxLeny) * Math.PI) / 180;
- var dist = 6371229 * Math.acos(Math.sin(lat_from) * Math.sin(lat_to) + Math.cos(lat_from) * Math.cos(lat_to) * Math.cos(lon_from - lon_to));
- scale = (dist / Math.SQRT2) * (mb_resolution * 100);
- }
- else {
- xtenty = parseFloat(bbox[3]) - parseFloat(bbox[1]);
- scale = (xtenty / this.height) * (mb_resolution * 100);
- }
- return parseInt(Math.round(scale));
- };
-
- /**
- *
- */
- this.checkScale = function(wmsIndex){
- var thisLayer = this.layers[wmsIndex].split(",");
- var thisScale = this.getScale();
- var str_layer = "";
- var cnt_layer = 0;
- for (var i = 0; i < this.wms[wmsIndex].objLayer.length; i++) {
- var currentLayer = this.wms[wmsIndex].objLayer[i];
- var myLayername = currentLayer.layer_name;
-
- var myMinscale = currentLayer.gui_layer_minscale;
- var myMaxscale = currentLayer.gui_layer_maxscale;
-
- for (var ii = 0; ii < thisLayer.length; ii++) {
- if (thisLayer[ii] == myLayername && !currentLayer.has_childs) {
- if (myMinscale !== 0 && thisScale < myMinscale) {
- continue;
- }
- if (myMaxscale !== 0 && thisScale > myMaxscale) {
- continue;
- }
- if (cnt_layer > 0) {
- str_layer += ",";
- }
- str_layer += thisLayer[ii];
- cnt_layer++;
- }
- }
- }
- var str_layerstyles = [];
- str_layerstyles[0] = str_layer;
- return str_layerstyles;
-
- };
-
- this.repaintScale = function(x, y, scale){
- if (x === null && y === null) {
- var arrayBBox = this.extent.split(",");
- x = parseFloat(arrayBBox[0]) +
- ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0])) /
- 2);
- y = parseFloat(arrayBBox[1]) +
- ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1])) /
- 2);
- }
- var minx = parseFloat(x) - (this.width / (mb_resolution * 100 * 2) * scale);
- var miny = parseFloat(y) - (this.height / (mb_resolution * 100 * 2) * scale);
- var maxx = parseFloat(x) + (this.width / (mb_resolution * 100 * 2) * scale);
- var maxy = parseFloat(y) + (this.height / (mb_resolution * 100 * 2) * scale);
- this.repaint(new Point(minx, miny), new Point(maxx, maxy));
- };
-
- this.repaint = function(min, max){
- this.extent = min.x + "," + min.y + "," + max.x + "," + max.y;
- this.setMapRequest();
- };
-
- this.setSingleMapRequest = function (wms_id) {
- eventBeforeMapRequest.trigger({map:this});
-
- var ts = mb_timestamp();
-
- for (var ii = 0; ii < this.wms.length; ii++){
- var currentWms = this.wms[ii];
- if (currentWms.wms_id != wms_id) {
- continue;
- }
- var newMapRequest = getLayerHtmlCode(ii);
-
- if (mb_log) {
- var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
- }
- var myDivId = this.elementName + "_div_" + ii;
- writeTag(this.frameName, myDivId, newMapRequest);
- var myMapId = this.elementName + "_map_" + ii;
- eventAfterMapRequest.trigger({"map":this, "myMapId":myMapId});
- return true;
- }
- return false;
-
- };
-
- this.mb_setFutureObj = function(mod_back_cnt){
- var cnt = this.mb_MapFutureObj.length;
- this.mb_MapFutureObj[cnt] = {};
- this.mb_MapFutureObj[cnt].reqCnt = mod_back_cnt;
- this.mb_MapFutureObj[cnt].width = this.width;
- this.mb_MapFutureObj[cnt].height = this.height;
- this.mb_MapFutureObj[cnt].epsg = this.epsg;
- this.mb_MapFutureObj[cnt].extent = this.extent;
- this.mb_MapFutureObj[cnt].layers = [];
-
- for(var i=0; i<this.layers.length;i++){
- this.mb_MapFutureObj[cnt].layers[i] = this.layers[i];
- }
-
- this.mb_MapFutureObj[cnt].styles = [];
-
- for(var i=0; i < this.styles.length;i++){
- this.mb_MapFutureObj[cnt].styles[i] = this.styles[i];
- }
-
- this.mb_MapFutureObj[cnt].querylayers = [];
-
- for(var i=0; i < this.querylayers.length; i++) {
- this.mb_MapFutureObj[cnt].querylayers[i] = this.querylayers[i];
- }
- }
-
- this.setMapRequest = function(){
- var functionName = 'setMapRequest';
-
- var ret = eventBeforeMapRequest.trigger({
- map: this
- }, "AND");
- if (ret === false) {
- return true;
- }
- var ts = mb_timestamp();
- var myMapId = [];
-
- var newMapRequest = "";
-
- for (var ii = 0; ii < this.wms.length; ii++) {
- var currentWms = this.wms[ii];
-
- if (!(currentWms.gui_wms_visible > 0)) {
- continue;
- }
- myMapId.push(this.elementName + "_map_" + ii);
-
- newMapRequest += getLayerHtmlCode(ii);
-
- }
- writeTag(this.frameName, this.elementName+"_maps", newMapRequest);
-
- eventAfterMapRequest.trigger({
- "map": this,
- "myMapId": myMapId.join(",")
- });
- };
-
- var that = this;
-
- var getLayerHtmlCode = function (ii) {
- var currentWms = that.wms[ii];
-
- var myDivId = that.elementName + "_div_" + ii;
- var myMapId = that.elementName + "_map_" + ii;
-
- //disable Layer which are out of scale
- var validLayers = that.checkScale(ii);
- var layerNames = validLayers.toString();
-
- var newMapURL = false;
- var opacityString = "";
-
- if (that.layers[ii] !== "" && layerNames !== ''){
- // get map URL
- newMapURL = that.getMapUrl(ii);
-
- var currentOpacity = currentWms.gui_wms_mapopacity;
- if (currentOpacity != 1) {
- opacityString += "opacity:" + currentOpacity + "; ";
- opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
- opacityString += "-moz-opacity:" + currentOpacity + " ; ";
- opacityString += "-khtml-opacity:" + currentOpacity;
- }
- }
-
- var imageString = "";
- if (newMapURL) {
- imageString = "<img id='"+myMapId+"' name='mapimage' ";
- imageString += "src='" + newMapURL + "' ";
- imageString += "width='"+that.width+"' ";
- imageString += "height='"+that.height+"' ";
- imageString += "border='0'>";
- }
-
- var newMapRequest = "<div id='"+myDivId+"' ";
- newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
- newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
- newMapRequest += imageString;
- newMapRequest += "</div>";
-
- that.mapURL[ii]= newMapURL;
- currentWms.mapURL = newMapURL;
-
- if (mb_log && currentWms.mapURL) {
- var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
- }
-
- return newMapRequest;
- }
-
- this.getWmsIdByTitle = function (title) {
- for (var i=0; i < this.wms.length; i++) {
- if (this.wms[i].wms_title == title) {
- return this.wms[i].wms_id;
- }
- }
- return null;
- };
-
- this.getWmsIndexById = function (wms_id) {
- for (var i=0; i< this.wms.length; i++){
- if(this.wms[i].wms_id == wms_id){
- return i;
- }
- }
- return null;
- };
-
- this.removeWms = function (wmsIndex) {
- var wms_ID = null;
- var i;
- var new_wmsarray = [];
- var new_layerarray = [];
- var new_querylayerarray = [];
- var new_stylesarray = [];
- var new_mapURLarray = [];
-
- for (i = 0; i < this.wms.length; i++) {
- if (i != wmsIndex) {
- new_wmsarray.push(this.wms[i]);
- new_layerarray.push(this.layers[i]);
- new_querylayerarray.push(this.querylayers[i]);
- new_stylesarray.push(this.styles[i]);
- new_mapURLarray.push(this.mapURL[i]);
- }
- else {
- wms_ID = this.wms[i].wms_id;
- }
- }
- this.wms = new_wmsarray;
- this.layers = new_layerarray;
- this.querylayers = new_querylayerarray;
- this.styles = new_stylesarray;
- this.mapURL = new_mapURLarray;
-
- var another_new_wmsarray = [];
-
- for (i = 0; i < window.wms.length; i++) {
- if (window.wms[i].wms_id != wms_ID) {
- another_new_wmsarray.push(window.wms[i]);
- }
- }
- window.wms = another_new_wmsarray;
- };
-
- /**
- * move a wms or layer
- *
- * @param int wms_id id of wms to move
- * @param int layer_id id of layer to move
- * @return true of successful
- * @type boolean
- */
- this.move = function(wms_id, layer_id, moveUp){
- var i,j;
- for(i=0;i<this.wms.length;i++){
- if (wms_id == this.wms[i].wms_id) {
- break;
- }
- }
-
- //check if only one wms is affected?
- if (layer_id && layer_id != this.wms[i].objLayer[0].layer_id) {
- return this.wms[i].moveLayer(layer_id, moveUp);
- }
-
- //else swap wms
- j = i + (moveUp?-1:1);
- if (!(i != j && i >= 0 && i < this.wms.length && j >= 0 && j < this.wms.length)) {
- return false;
- }
-
- upper = this.wms[i];
- this.wms[i] = this.wms[j];
- this.wms[j] = upper;
- var upperLayers = this.layers[i];
- var upperStyles = this.styles[i];
- var upperQuerylayers = this.querylayers[i];
- this.layers[i] = this.layers[j];
- this.styles[i] = this.styles[j];
- this.querylayers[i] = this.querylayers[j];
- this.layers[j] = upperLayers;
- this.styles[j] = upperStyles;
- this.querylayers[j] = upperQuerylayers;
-
- return true;
- };
-
- this.getMousePos = function(e){
- if(ie){
- if(this.frameName){
- clickX = window.frames[fName].event.clientX;
- clickY = window.frames[fName].event.clientY;
- }
- else{
- clickX = event.clientX;
- clickY = event.clientY;
- }
- }
- else{
- clickX = e.pageX;
- clickY = e.pageY;
- }
-
- //remove divtag offset
- clickX -= parseInt(this.getDomElement().style.left);
- clickY -= parseInt(this.getDomElement().style.top);
-
- return new Point(clickX, clickY);
- }
-
- eventAfterMapObjectConstruction.trigger();
-}
-
-mb_mapObj_const.prototype.getWfsConfIds = function (wfs_config) {
- var db_wfs_conf_id = [];
- var js_wfs_conf_id = [];
-
- //search configurations that are selected (and in scale)
- for (var i=0; i < this.wms.length; i++){
- for(var ii=0; ii < this.wms[i].objLayer.length; ii++){
- var o = this.wms[i].objLayer[ii];
- if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1'){
- if(!checkscale || o.checkScale(this))
- db_wfs_conf_id[db_wfs_conf_id.length] = o.gui_layer_wfs_featuretype;
- }
- }
- }
- for(var i=0; i < db_wfs_conf_id.length; i++){
- for(var ii=0; ii < wfs_config.length; ii++){
- if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i]){
- js_wfs_conf_id[js_wfs_conf_id.length] = ii;
- break;
- }
- }
- }
- return js_wfs_conf_id;
-};
\ No newline at end of file
Copied: branches/google_dev/trunk/http/javascripts/map_obj.js (from rev 3903, trunk/mapbender/http/javascripts/map_obj.js)
===================================================================
--- branches/google_dev/trunk/http/javascripts/map_obj.js (rev 0)
+++ branches/google_dev/trunk/http/javascripts/map_obj.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,1117 @@
+/*
+* $Id: map_obj.js 2517 2008-06-19 16:40:00Z christoph $
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
+*/
+var mb_mapObj = [];
+
+function mb_mapObj_const(frameName, elementName, width, height, wms_index){
+
+ /**
+ * set the extent of the wms
+ */
+ this.setExtent = function(minx, miny, maxx, maxy) {
+ this.extent = new Extent(
+ new Point(parseFloat(minx), parseFloat(miny)),
+ new Point(parseFloat(maxx), parseFloat(maxy))
+ );
+ };
+
+ /**
+ * Sets the center of the map
+ * @param {Point} center
+ */
+ this.setCenter = function (center) {
+ this.extent.set(center);
+ };
+
+ this.setRestrictedExtent = function (extent) {
+ this.restrictedExtent = extent;
+ };
+
+ /**
+ * get the width of the mapObj
+ *
+ * @member mb_mapObj_const
+ * @return width of the mapObj
+ * @type integer
+ */
+ this.getWidth = function(){
+ return parseInt(this.width, 10);
+ };
+
+ /**
+ * set the width of the mapObj
+ *
+ * @param {integer} widht the width of the mapObj
+ */
+ this.setWidth = function(width){
+ this.width = parseInt(width, 10);
+
+ //apply new width
+ if(this.frameName){
+ document.getElementById(this.frameName).style.width = this.width;
+ }
+ var domElement = this.getDomElement();
+ domElement.style.width = this.width;
+ };
+
+ /**
+ * get the height of the mapObj
+ *
+ * @member mb_mapObj_const
+ * @return width of the mapObj
+ * @type integer
+ */
+ this.getHeight = function(){
+ return parseInt(this.height, 10);
+ };
+
+ this.getDomElement = function(){
+ if(this.frameName){
+ return window.frames[this.frameName].document.getElementById(this.elementName);
+ }
+ return document.getElementById(this.elementName);
+ }
+
+ /**
+ * set the height of the mapObj
+ *
+ * @param {integer} height the height of the mapObj
+ */
+ this.setHeight = function(height){
+ this.height = parseInt(height, 10);
+ //apply new height
+ if(this.frameName){
+ document.getElementById(this.frameName).style.height = this.height;
+ }
+ var domElement = this.getDomElement();
+ domElement.style.height = this.height;
+ };
+
+ this.getMousePosition = function (e) {
+ var clickX, clickY;
+
+ if ($.browser.msie) {
+ if (window.event) {
+ clickX = window.event.clientX;
+ clickY = window.event.clientY;
+ }
+ else {
+ clickX = e.clientX;
+ clickY = e.clientY;
+ }
+ }
+ else{
+ clickX = e.pageX;
+ clickY = e.pageY;
+ }
+
+ var currentPos = null;
+ if (this.type == "DIV") {
+ var mapDomElement = this.getDomElement();
+ currentPos = new Point(
+ clickX - parseInt(mapDomElement.style.left),
+ clickY - parseInt(mapDomElement.style.top)
+ );
+ // if the mouse position is not on top of the map, return null
+ if (currentPos.x < 0 || currentPos.x > this.width ||
+ currentPos.y < 0 || currentPos.y > this.height) {
+ return null;
+ }
+ }
+ else {
+ currentPos = new Point(
+ clickX,
+ clickY
+ );
+ }
+ return currentPos;
+ }
+
+ /**
+ * converts the extent of the mapobject so that the maximum extent will be displayed
+ */
+ this.calculateExtent = function(ext){
+ if (typeof this.google !== "undefined") {
+ // get extent and fit Google map
+ var sw = new google.maps.LatLng(ext.min.y, ext.min.x);
+ var ne = new google.maps.LatLng(ext.maxy, ext.max.x);
+ var latLngBounds = new google.maps.LatLngBounds(sw, ne);
+ this.google.map.fitBounds(latLngBounds);
+
+ var zoomByRectangleListener = google.maps.event.addListener(this.google.map, "bounds_changed", function () {
+ google.maps.event.removeListener(zoomByRectangleListener);
+
+ var newBounds = that.google.map.get_bounds();
+ var newSw = newBounds.getSouthWest();
+ var newNe = newBounds.getNorthEast();
+
+ // set bounding box
+ that.extent.set(new Point(newSw.lng(), newSw.lat()), new Point(newNe.lng(), newNe.lat()));
+
+ // set center to center of rectangle
+ that.extent.set(ext.center);
+
+ that.setMapRequest();
+
+ });
+
+ return;
+ }
+ var relation_px_x = this.getWidth() / this.getHeight();
+ var relation_px_y = this.getHeight() / this.getWidth();
+ var relation_bbox_x = ext.extentx / ext.extenty;
+ if (relation_bbox_x <= relation_px_x) {
+ ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
+ ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
+ }
+ if (relation_bbox_x > relation_px_x) {
+ ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
+ ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
+ }
+
+ // Check if ext is within restricted extent
+ // If not, calculate a new extent according
+ // to restricted extent.
+ /*
+ if ( this.restrictedExtent ) {
+ if ( ext.minx < this.restrictedExtent.minx ) {
+ ext.minx = this.restrictedExtent.minx;
+ ext.maxx = ext.minx + (relation_px_x * ext.extenty);
+ }
+ if ( ext.miny < this.restrictedExtent.miny ) {
+ ext.miny = this.restrictedExtent.miny;
+ ext.maxy = ext.miny + (relation_px_y * ext.extentx);
+ }
+ if ( ext.maxx > this.restrictedExtent.maxx ) {
+ ext.maxx = this.restrictedExtent.maxx;
+ ext.minx = ext.maxx - (relation_px_x * ext.extenty);
+ }
+ if ( ext.maxy > this.restrictedExtent.maxy ) {
+ ext.maxy = this.restrictedExtent.maxy;
+ ext.miny = ext.maxy - (relation_px_y * ext.extentx);
+ }
+ }
+ */
+ this.setExtent(ext.minx, ext.miny, ext.maxx, ext.maxy);
+ return ext;
+ };
+
+
+ this.width = width;
+ this.height = height;
+ this.frameName = frameName;
+ this.type = (frameName !== "") ? "IFRAME" : "DIV";
+ this.elementName = elementName;
+ this.layers = [];
+ this.styles = [];
+ this.querylayers = [];
+ this.geom = "";
+ this.gml = "";
+ this.wms = [];
+
+ //
+ // Add pointers to WMS objects which are in this map.
+ // If wms_index is set (=map is overview), only this
+ // WMS is being pointed to.
+ //
+ var index = 0;
+ for (var i = 0; i < wms.length; i++) {
+ var isValidWms = (wms_index === null) || (wms_index == i);
+ if (isValidWms) {
+ this.wms[index] = wms[i];
+ this.wms[index].mapURL = false;
+ index++;
+ }
+ }
+
+ //
+ // set list of visible layers, active querylayers
+ // and styles for each WMS in this map
+ //
+ var cnt_layers;
+ var cnt_querylayers;
+ var styles;
+ var layers;
+ var querylayers = "";
+ for (i = 0; i < this.wms.length; i++) {
+ cnt_layers = 0;
+ cnt_querylayers = 0;
+ styles = "";
+ layers = "";
+ querylayers = "";
+
+ for (var ii = 0; ii < this.wms[i].objLayer.length; ii++) {
+ // layer is visible and not root layer
+ if (this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii > 0) {
+ if (cnt_layers > 0) {
+ layers += ",";
+ styles += ",";
+ }
+ layers += wms[i].objLayer[ii].layer_name;
+ styles += "";
+ cnt_layers++;
+ }
+ // layer is queryable and not root layer
+ if (this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii > 0) {
+ if (cnt_querylayers > 0) {
+ querylayers += ",";
+ }
+ querylayers += wms[i].objLayer[ii].layer_name;
+ cnt_querylayers++;
+ }
+ }
+ this.layers[i] = layers;
+ this.styles[i] = styles;
+ this.querylayers[i] = querylayers;
+ }
+
+ this.epsg = wms[0].gui_wms_epsg;
+ var bbox_minx, bbox_miny, bbox_maxx, bbox_maxy;
+
+ for (var i = 0; i < wms[0].gui_epsg.length; i++) {
+ if (this.epsg == wms[0].gui_epsg[i]) {
+ bbox_minx = parseFloat(wms[0].gui_minx[i]);
+ bbox_miny = parseFloat(wms[0].gui_miny[i]);
+ bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
+ bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
+ }
+ }
+ var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
+ this.calculateExtent(wmsExtent);
+
+ this.mapURL = [];
+ var domElement = this.getDomElement();
+ domElement.style.width = this.width;
+ domElement.style.height = this.height;
+
+ this.afterMapRequest = new MapbenderEvent();
+
+ /**
+ * get the extent of the mapObj
+ *
+ * @member mb_mapObj_const
+ * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy
+ * @type string
+ */
+ this.getExtent = function(){
+ return this.extent.toString();
+ };
+
+ /**
+ * get the extent as minx, maxx, miny, maxy
+ *
+ * @return extent and additional informations of the mapObj
+ * @type Object
+ */
+ this.getExtentInfos = function(){
+ var c = this.extent.toString().split(",");
+ var ext = new Extent(c[0], c[1], c[2], c[3]);
+ return ext;
+ };
+
+ /**
+ * Sets the list of layers, styles and querylayers for a specified WMS
+ */
+ this.restateLayers = function(wms_id){
+ for (var i = 0; i < this.wms.length; i++) {
+ if (this.wms[i].wms_id == wms_id) {
+ var currentWms = this.wms[i];
+ var cnt_layers = 0;
+ var cnt_querylayers = 0;
+ var layers = "";
+ var styles = "";
+ var querylayers = "";
+ for (var ii = 0; ii < currentWms.objLayer.length; ii++) {
+ var currentLayer = currentWms.objLayer[ii];
+ if (currentLayer.gui_layer_visible == 1 && !currentLayer.has_childs) {
+ if (cnt_layers > 0) {
+ layers += ",";
+ styles += ",";
+ }
+ layers += currentLayer.layer_name;
+ styles += "";
+ cnt_layers++;
+ }
+ if (currentLayer.gui_layer_querylayer == 1 && !currentLayer.has_childs) {
+ if (cnt_querylayers > 0) {
+ querylayers += ",";
+ }
+ querylayers += currentLayer.layer_name;
+ cnt_querylayers++;
+ }
+ }
+ this.layers[i] = layers;
+ this.querylayers[i] = querylayers;
+ this.styles[i] = styles;
+ }
+ }
+// this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
+ };
+
+ /**
+ *
+ * @param {Object} direction
+ */
+ this.pan = function (direction) {
+ var arrayBBox = this.extent.toString().split(",");
+ var minx = parseFloat(arrayBBox[0]);
+ var miny = parseFloat(arrayBBox[1]);
+ var maxx = parseFloat(arrayBBox[2]);
+ var maxy = parseFloat(arrayBBox[3]);
+ var xtentx = maxx - minx;
+ var xtenty = maxy - miny;
+ var factor = 0.5;
+
+ switch (direction) {
+ case "NW" :
+ minx -= (xtentx * factor);
+ maxx -= (xtentx * factor);
+ miny += (xtenty * factor);
+ maxy += (xtenty * factor);
+ break;
+ case "N" :
+ miny += (xtenty * factor);
+ maxy += (xtenty * factor);
+ break;
+ case "NE" :
+ minx += (xtentx * factor);
+ maxx += (xtentx * factor);
+ miny += (xtenty * factor);
+ maxy += (xtenty * factor);
+ break;
+ case "E" :
+ minx += (xtentx * factor);
+ maxx += (xtentx * factor);
+ break;
+ case "SE" :
+ minx += (xtentx * factor);
+ maxx += (xtentx * factor);
+ miny -= (xtenty * factor);
+ maxy -= (xtenty * factor);
+ break;
+ case "S" :
+ miny -= (xtenty * factor);
+ maxy -= (xtenty * factor);
+ break;
+ case "SW" :
+ minx -= (xtentx * factor);
+ maxx -= (xtentx * factor);
+ miny -= (xtenty * factor);
+ maxy -= (xtenty * factor);
+ break;
+ case "W" :
+ minx -= (xtentx * factor);
+ maxx -= (xtentx * factor);
+ break;
+ }
+ this.setExtent(minx, miny, maxx, maxy);
+// this.restrictedExtent;
+ this.setMapRequest();
+
+ };
+
+ this.zoomFull = function () {
+ if (typeof this.google !== undefined) {
+ this.zoomToLevel(this.google.MIN_ZOOM_LEVEL);
+ return;
+ }
+
+/*
+ if (this.restrictedExtent) {
+ var newExtent = this.calculateExtent(this.restrictedExtent);
+ this.repaint(new Point(newExtent.minx, newExtent.miny), new Point(newExtent.maxx, newExtent.maxy));
+ }
+ else {
+*/
+ for (var i = 0; i < this.wms[0].gui_epsg.length; i++) {
+ if (this.epsg == this.wms[0].gui_epsg[i]) {
+ var bbox_minx = parseFloat(this.wms[0].gui_minx[i]);
+ var bbox_miny = parseFloat(this.wms[0].gui_miny[i]);
+ var bbox_maxx = parseFloat(this.wms[0].gui_maxx[i]);
+ var bbox_maxy = parseFloat(this.wms[0].gui_maxy[i]);
+
+ var wmsExtent = new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
+ var newExtent = this.calculateExtent(wmsExtent);
+ this.repaint(newExtent.min, newExtent.max);
+ break;
+ }
+ }
+// }
+ };
+
+ /**
+ * zoom the map with a zoomfactor and optional to x,y coords
+ *
+ * @param {boolean} in_ in = true, out = false
+ * @param {float} factor the zoomfactor 1 equals 100%
+ * @param {float} x center to x-position
+ * @param {float} y center to y-position
+ */
+ this.zoom = function(in_, factor, x, y){
+ factor = parseFloat(factor);
+ if (!in_) {
+ factor = 1 / factor;
+ }
+
+ // When a Google Map is included,
+ // * update the zoom level
+ // * calculate the extent
+ // * repaint with new extent
+ if (typeof this.google !== undefined) {
+ var currentZoomLevel = this.google.map.get_zoom();
+ if (factor > 1 && currentZoomLevel < this.google.MAX_ZOOM_LEVEL) {
+ currentZoomLevel++;
+ }
+ else if (factor < 1 && currentZoomLevel > this.google.MIN_ZOOM_LEVEL) {
+ currentZoomLevel--;
+ }
+ else {
+ if (typeof x !== "undefined" && typeof y !== "undefined") {
+ this.setCenter(new Point(x, y));
+ this.setMapRequest();
+ }
+ return;
+ }
+ this.zoomToLevel(currentZoomLevel);
+ }
+ else {
+ var extent = this.getExtentInfos();
+ var distx = extent.maxx - extent.minx;
+ var disty = extent.maxy - extent.miny;
+
+ if (x && y) {
+ var centerx = parseFloat(x);
+ var centery = parseFloat(y);
+ }
+ else {
+ var centerx = extent.minx + distx / 2;
+ var centery = extent.miny + disty / 2;
+ }
+
+ var new_distx = distx / factor;
+ var new_disty = disty / factor;
+ var minx = centerx - new_distx / 2;
+ var miny = centery - new_disty / 2;
+ var maxx = centerx + new_distx / 2;
+ var maxy = centery + new_disty / 2;
+ // Check if ext is within restricted extent
+ // If not, calculate a new extent according
+ // to restricted extent.
+ /*
+ var relation_px_x = this.getWidth() / this.getHeight();
+ var relation_px_y = this.getHeight() / this.getWidth();
+ if ( this.restrictedExtent ) {
+ if ( minx < this.restrictedExtent.minx ) {
+ minx = this.restrictedExtent.minx;
+ maxx = minx + (relation_px_x * new_disty);
+ }
+ if ( miny < this.restrictedExtent.miny ) {
+ miny = this.restrictedExtent.miny;
+ maxy = miny + (relation_px_y * new_distx);
+ }
+ if ( maxx > this.restrictedExtent.maxx ) {
+ maxx = this.restrictedExtent.maxx;
+ minx = maxx - (relation_px_x * new_distx);
+ }
+ if ( maxy > this.restrictedExtent.maxy ) {
+ maxy = this.restrictedExtent.maxy;
+ miny = maxy - (relation_px_y * new_disty);
+ }
+ }
+ */
+
+ this.setExtent(minx, miny, maxx, maxy);
+ this.setMapRequest();
+ }
+ };
+
+ var performUnknownCalculation = function (value) {
+ return Math.pow(10,(
+ Math.round(
+ Math.log(value)/
+ Math.log(10)
+ )
+ ));
+ };
+
+ this.convertPixelToReal = function (aPoint) {
+ var arrayBBox = this.extent.toString().split(",");
+ var minX = parseFloat(arrayBBox[0]);
+ var minY = parseFloat(arrayBBox[1]);
+ var maxX = parseFloat(arrayBBox[2]);
+ var maxY = parseFloat(arrayBBox[3]);
+ var xtentx = maxX - minX;
+ var xtenty = maxY - minY;
+ var deltaX = xtentx/this.width;
+ var deltaY = xtenty/this.height;
+ var roundx, roundy;
+
+ if(deltaX > 0){
+ roundx = 1/performUnknownCalculation(deltaX);
+ }
+ else{
+ roundx = performUnknownCalculation(deltaX);
+ }
+ if(deltaY > 0){
+ roundy = 1/performUnknownCalculation(deltaY);
+ }
+ else{
+ roundy = performUnknownCalculation(deltaY);
+ }
+ var posX = parseFloat(minX + (aPoint.x / this.width) * xtentx);
+ var posY = parseFloat(maxY - (aPoint.y / this.height) * xtenty);
+ posX = Math.round(posX * roundx) / roundx;
+ posY = Math.round(posY * roundy) / roundy;
+ return new Point(posX, posY);
+ };
+
+ /**
+ * Convert real world coordinates to pixel coordinates
+ */
+ this.convertRealToPixel = function (aPoint) {
+ var arrayBBox = this.extent.toString().split(",");
+ var minX = parseFloat(arrayBBox[0]);
+ var minY = parseFloat(arrayBBox[1]);
+ var maxX = parseFloat(arrayBBox[2]);
+ var maxY = parseFloat(arrayBBox[3]);
+ return new Point(
+ Math.round((aPoint.x - minX) * this.width /(maxX - minX)),
+ Math.round((maxY - aPoint.y) * this.height/(maxY - minY))
+ );
+ };
+
+ /**
+ * get the srs of the mapObj
+ *
+ * @return srs as epsg:number
+ * @type string
+ */
+ this.getSRS = function(){
+ return this.epsg;
+ };
+
+ /**
+ * get all mapRequests
+ *
+ * @return array of mapRequests of this map object
+ * @type string[]
+ */
+ this.getMapRequests = function(){
+ var allRequests = [];
+ //loop through all wms to get the mapRequests
+ for (var i = 0; i < this.wms.length; i++) {
+ var currentRequest = this.wms[i].getMapRequest(this);
+ if (currentRequest) {
+ allRequests.push(currentRequest);
+ }
+ }
+ if (allRequests.length > 0) {
+ return allRequests;
+ }
+ return false;
+ };
+
+ /**
+ * Return the map URL of the WMS at index i
+ * @param {Object} currentWmsIndex
+ */
+ this.getMapUrl = function(ii){
+ var currentWms = this.wms[ii];
+ var validLayers = currentWms.getLayers(this);
+ if(validLayers.length === 0) {
+ return false;
+ }
+ var layerNames = validLayers.join(",");
+
+ url = currentWms.wms_getmap;
+ url += mb_getConjunctionCharacter(currentWms.wms_getmap);
+
+ if (currentWms.wms_version == "1.0.0") {
+ url += "WMTVER=" + currentWms.wms_version + "&REQUEST=map&";
+ }
+ else {
+ url += "VERSION=" + currentWms.wms_version + "&REQUEST=GetMap&SERVICE=WMS&";
+ }
+
+ url += "LAYERS=" + layerNames + "&";
+ url += "STYLES=";
+ var layer = layerNames.split(",");
+ for (var j = 0; j < layer.length; j++) {
+ if (j > 0) {
+ url += ",";
+ }
+ if (currentWms.getCurrentStyleByLayerName(layer[j]) !== false) {
+ url += currentWms.getCurrentStyleByLayerName(layer[j]);
+ }
+ }
+ url += "&";
+ url += "SRS=" + this.epsg + "&";
+ url += "BBOX=" + this.extent.toString() + "&";
+ url += "WIDTH=" + this.width + "&";
+ url += "HEIGHT=" + this.height + "&";
+ url += "FORMAT=" + currentWms.gui_wms_mapformat + "&";
+ url += "BGCOLOR=0xffffff&";
+
+ if (currentWms.gui_wms_mapformat.search(/gif/i) > -1 ||
+ currentWms.gui_wms_mapformat.search(/png/i) > -1) {
+ url += "TRANSPARENT=TRUE&";
+ }
+
+ url += "EXCEPTIONS=" + currentWms.gui_wms_exceptionformat + "&";
+
+ // add vendor-specific
+ for (var v = 0; v < mb_vendorSpecific.length; v++) {
+ var vendorSpecificString = eval(mb_vendorSpecific[v]);
+ // if eval doesn't evaluate a function, the result is undefined.
+ // Sometimes it is necessary not to evaluate a function, for
+ // example if you want to change a variable from the current
+ // scope (see mod_addSLD.php)
+ if (typeof(vendorSpecificString) != "undefined") {
+ url += vendorSpecificString + "&";
+ }
+ }
+ // add Filter
+ if (currentWms.wms_filter !== "") {
+ url += "&SLD=" + currentWms.wms_filter + "?id=" + mb_styleID + "&";
+ }
+ // add sld
+ if (currentWms.gui_wms_sldurl !== "") {
+ url += "&SLD=" + escape(currentWms.gui_wms_sldurl) + "&";
+ }
+ return url;
+ }
+
+ /**
+ * get all featureInfoRequests
+ *
+ * @member mb_mapObj_const
+ * @param float x the x-value of the click position in pixel
+ * @param float y the y-value of the click position in pixel
+ * @return array of all featureInfoRequests of this map object
+ * @type string[]
+ */
+ this.getFeatureInfoRequests = function(clickPoint, ignoreWms){
+ var allRequests = [];
+ //loop through all wms to get the FeatureInfoRequests
+ for (var i = 0; i < this.wms.length; i++) {
+ var ignoreThisWms = false;
+ if (ignoreWms.constructor === Array) {
+ for (var j = 0; j < ignoreWms.length; j++) {
+ if (ignoreWms[j] == this.wms[i].wms_id) {
+ ignoreThisWms = true;
+ break;
+ }
+ }
+ }
+ if (!ignoreThisWms) {
+ var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
+ if (currentRequest) {
+ allRequests.push(currentRequest);
+ }
+ }
+ }
+ if (allRequests.length > 0) {
+ return allRequests;
+ }
+ return false;
+ };
+
+ /**
+ * calculation of the mapscale
+ *
+ * @member mb_mapObj_const
+ * @return scale
+ * @type integer
+ */
+ this.getScale = function(){
+ var scale;
+ var bbox = this.extent.toString().split(",");
+ var xtenty;
+ if (this.epsg == "EPSG:4326") {
+ var pxLenx = (parseFloat(bbox[2]) - parseFloat(bbox[0])) / this.width;
+ var pxLeny = (parseFloat(bbox[3]) - parseFloat(bbox[1])) / this.height;
+ var lat_from = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2) * Math.PI) / 180;
+ var lat_to = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2 + pxLeny) * Math.PI) / 180;
+ var lon_from = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2) * Math.PI) / 180;
+ var lon_to = ((parseFloat(bbox[2]) - parseFloat(bbox[0]) / 2 + pxLeny) * Math.PI) / 180;
+ var dist = 6371229 * Math.acos(Math.sin(lat_from) * Math.sin(lat_to) + Math.cos(lat_from) * Math.cos(lat_to) * Math.cos(lon_from - lon_to));
+ scale = (dist / Math.SQRT2) * (mb_resolution * 100);
+ }
+ else {
+ xtenty = parseFloat(bbox[3]) - parseFloat(bbox[1]);
+ scale = (xtenty / this.height) * (mb_resolution * 100);
+ }
+ return parseInt(Math.round(scale));
+ };
+
+ /**
+ *
+ */
+ this.checkScale = function(wmsIndex){
+ var thisLayer = this.layers[wmsIndex].split(",");
+ var thisScale = this.getScale();
+ var str_layer = "";
+ var cnt_layer = 0;
+ for (var i = 0; i < this.wms[wmsIndex].objLayer.length; i++) {
+ var currentLayer = this.wms[wmsIndex].objLayer[i];
+ var myLayername = currentLayer.layer_name;
+
+ var myMinscale = currentLayer.gui_layer_minscale;
+ var myMaxscale = currentLayer.gui_layer_maxscale;
+
+ for (var ii = 0; ii < thisLayer.length; ii++) {
+ if (thisLayer[ii] == myLayername && !currentLayer.has_childs) {
+ if (myMinscale !== 0 && thisScale < myMinscale) {
+ continue;
+ }
+ if (myMaxscale !== 0 && thisScale > myMaxscale) {
+ continue;
+ }
+ if (cnt_layer > 0) {
+ str_layer += ",";
+ }
+ str_layer += thisLayer[ii];
+ cnt_layer++;
+ }
+ }
+ }
+ var str_layerstyles = [];
+ str_layerstyles[0] = str_layer;
+ return str_layerstyles;
+
+ };
+
+ this.repaintScale = function(x, y, scale){
+ if (x === null && y === null) {
+ var arrayBBox = this.extent.toString().split(",");
+ x = parseFloat(arrayBBox[0]) +
+ ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0])) /
+ 2);
+ y = parseFloat(arrayBBox[1]) +
+ ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1])) /
+ 2);
+ }
+ var minx = parseFloat(x) - (this.width / (mb_resolution * 100 * 2) * scale);
+ var miny = parseFloat(y) - (this.height / (mb_resolution * 100 * 2) * scale);
+ var maxx = parseFloat(x) + (this.width / (mb_resolution * 100 * 2) * scale);
+ var maxy = parseFloat(y) + (this.height / (mb_resolution * 100 * 2) * scale);
+ this.repaint(new Point(minx, miny), new Point(maxx, maxy));
+ };
+
+ this.repaint = function(min, max){
+ if (typeof min !== "undefined" && typeof max !== "undefined") {
+ this.extent = new Extent(min, max);
+ }
+ this.setMapRequest();
+ };
+
+ this.setSingleMapRequest = function (wms_id) {
+ eventBeforeMapRequest.trigger({map:this});
+
+ var ts = mb_timestamp();
+
+ for (var ii = 0; ii < this.wms.length; ii++){
+ var currentWms = this.wms[ii];
+ if (currentWms.wms_id != wms_id) {
+ continue;
+ }
+ var newMapRequest = getLayerHtmlCode(ii);
+
+ if (mb_log) {
+ var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
+ }
+ var myDivId = this.elementName + "_div_" + ii;
+ writeTag(this.frameName, myDivId, newMapRequest);
+ var myMapId = this.elementName + "_map_" + ii;
+ eventAfterMapRequest.trigger({"map":this, "myMapId":myMapId});
+ return true;
+ }
+ return false;
+
+ };
+
+ this.mb_setFutureObj = function(mod_back_cnt){
+ var cnt = this.mb_MapFutureObj.length;
+ this.mb_MapFutureObj[cnt] = {};
+ this.mb_MapFutureObj[cnt].reqCnt = mod_back_cnt;
+ this.mb_MapFutureObj[cnt].width = this.width;
+ this.mb_MapFutureObj[cnt].height = this.height;
+ this.mb_MapFutureObj[cnt].epsg = this.epsg;
+ this.mb_MapFutureObj[cnt].extent = this.extent.toString();
+ this.mb_MapFutureObj[cnt].layers = [];
+
+ for(var i=0; i<this.layers.length;i++){
+ this.mb_MapFutureObj[cnt].layers[i] = this.layers[i];
+ }
+
+ this.mb_MapFutureObj[cnt].styles = [];
+
+ for(var i=0; i < this.styles.length;i++){
+ this.mb_MapFutureObj[cnt].styles[i] = this.styles[i];
+ }
+
+ this.mb_MapFutureObj[cnt].querylayers = [];
+
+ for(var i=0; i < this.querylayers.length; i++) {
+ this.mb_MapFutureObj[cnt].querylayers[i] = this.querylayers[i];
+ }
+ }
+
+ this.setMapRequest = function(){
+ // optionally, paint a Google map
+ if (this.google !== undefined && !this.google.skipRequest) {
+ if (this.google.map.isInitialised === true) {
+ var latLng = new google.maps.LatLng(this.extent.center.y, this.extent.center.x);
+ this.google.map.set_center(latLng);
+ }
+ else {
+ setTimeout(function(){
+ that.setMapRequest();
+ }, 100);
+ return;
+ }
+ }
+
+ var functionName = 'setMapRequest';
+
+ var ret = eventBeforeMapRequest.trigger({
+ map: this
+ }, "AND");
+ if (ret === false) {
+ return true;
+ }
+ var ts = mb_timestamp();
+ var myMapId = [];
+
+ var newMapRequest = "";
+
+ for (var ii = 0; ii < this.wms.length; ii++) {
+ var currentWms = this.wms[ii];
+
+ if (!(currentWms.gui_wms_visible > 0)) {
+ continue;
+ }
+ myMapId.push(this.elementName + "_map_" + ii);
+
+ newMapRequest += getLayerHtmlCode(ii);
+
+ }
+ writeTag(this.frameName, this.elementName+"_maps", newMapRequest);
+
+ eventAfterMapRequest.trigger({
+ "map": this,
+ "myMapId": myMapId.join(",")
+ });
+ this.afterMapRequest.trigger();
+ };
+
+ var that = this;
+
+ var getLayerHtmlCode = function (ii) {
+ var currentWms = that.wms[ii];
+
+ var myDivId = that.elementName + "_div_" + ii;
+ var myMapId = that.elementName + "_map_" + ii;
+
+ //disable Layer which are out of scale
+ var validLayers = that.checkScale(ii);
+ var layerNames = validLayers.toString();
+
+ var newMapURL = false;
+ var opacityString = "";
+
+ if (that.layers[ii] !== "" && layerNames !== ''){
+ // get map URL
+ newMapURL = that.getMapUrl(ii);
+
+ var currentOpacity = currentWms.gui_wms_mapopacity;
+ if (currentOpacity != 1) {
+ opacityString += "opacity:" + currentOpacity + "; ";
+ opacityString += "Filter: Alpha(Opacity=" + currentOpacity*100 + "); ";
+ opacityString += "-moz-opacity:" + currentOpacity + " ; ";
+ opacityString += "-khtml-opacity:" + currentOpacity;
+ }
+ }
+
+ var imageString = "";
+ if (newMapURL) {
+ imageString = "<img id='"+myMapId+"' name='mapimage' ";
+ imageString += "src='" + newMapURL + "' ";
+ imageString += "width='"+that.width+"' ";
+ imageString += "height='"+that.height+"' ";
+ imageString += "border='0'>";
+ }
+
+ var newMapRequest = "<div id='"+myDivId+"' ";
+ newMapRequest += "style=\"position:absolute; top:0px; left:0px; ";
+ newMapRequest += "z-index:" + ii + ";" + opacityString + "\">";
+ newMapRequest += imageString;
+ newMapRequest += "</div>";
+
+ that.mapURL[ii]= newMapURL;
+ currentWms.mapURL = newMapURL;
+
+ if (mb_log && currentWms.mapURL) {
+ var tmp = eval(mb_log + "('" +newMapURL + "','" + ts + "')");
+ }
+
+ return newMapRequest;
+ }
+
+ this.getWmsIdByTitle = function (title) {
+ for (var i=0; i < this.wms.length; i++) {
+ if (this.wms[i].wms_title == title) {
+ return this.wms[i].wms_id;
+ }
+ }
+ return null;
+ };
+
+ this.getWmsIndexById = function (wms_id) {
+ for (var i=0; i< this.wms.length; i++){
+ if(this.wms[i].wms_id == wms_id){
+ return i;
+ }
+ }
+ return null;
+ };
+
+ this.removeWms = function (wmsIndex) {
+ var wms_ID = null;
+ var i;
+ var new_wmsarray = [];
+ var new_layerarray = [];
+ var new_querylayerarray = [];
+ var new_stylesarray = [];
+ var new_mapURLarray = [];
+
+ for (i = 0; i < this.wms.length; i++) {
+ if (i != wmsIndex) {
+ new_wmsarray.push(this.wms[i]);
+ new_layerarray.push(this.layers[i]);
+ new_querylayerarray.push(this.querylayers[i]);
+ new_stylesarray.push(this.styles[i]);
+ new_mapURLarray.push(this.mapURL[i]);
+ }
+ else {
+ wms_ID = this.wms[i].wms_id;
+ }
+ }
+ this.wms = new_wmsarray;
+ this.layers = new_layerarray;
+ this.querylayers = new_querylayerarray;
+ this.styles = new_stylesarray;
+ this.mapURL = new_mapURLarray;
+
+ var another_new_wmsarray = [];
+
+ for (i = 0; i < window.wms.length; i++) {
+ if (window.wms[i].wms_id != wms_ID) {
+ another_new_wmsarray.push(window.wms[i]);
+ }
+ }
+ window.wms = another_new_wmsarray;
+ };
+
+ /**
+ * move a wms or layer
+ *
+ * @param int wms_id id of wms to move
+ * @param int layer_id id of layer to move
+ * @return true of successful
+ * @type boolean
+ */
+ this.move = function(wms_id, layer_id, moveUp){
+ var i,j;
+ for(i=0;i<this.wms.length;i++){
+ if (wms_id == this.wms[i].wms_id) {
+ break;
+ }
+ }
+
+ //check if only one wms is affected?
+ if (layer_id && layer_id != this.wms[i].objLayer[0].layer_id) {
+ return this.wms[i].moveLayer(layer_id, moveUp);
+ }
+
+ //else swap wms
+ j = i + (moveUp?-1:1);
+ if (!(i != j && i >= 0 && i < this.wms.length && j >= 0 && j < this.wms.length)) {
+ return false;
+ }
+
+ upper = this.wms[i];
+ this.wms[i] = this.wms[j];
+ this.wms[j] = upper;
+ var upperLayers = this.layers[i];
+ var upperStyles = this.styles[i];
+ var upperQuerylayers = this.querylayers[i];
+ this.layers[i] = this.layers[j];
+ this.styles[i] = this.styles[j];
+ this.querylayers[i] = this.querylayers[j];
+ this.layers[j] = upperLayers;
+ this.styles[j] = upperStyles;
+ this.querylayers[j] = upperQuerylayers;
+
+ return true;
+ };
+
+ this.getMousePos = function(e){
+ if(ie){
+ if(this.frameName){
+ clickX = window.frames[fName].event.clientX;
+ clickY = window.frames[fName].event.clientY;
+ }
+ else{
+ clickX = event.clientX;
+ clickY = event.clientY;
+ }
+ }
+ else{
+ clickX = e.pageX;
+ clickY = e.pageY;
+ }
+
+ //remove divtag offset
+ clickX -= parseInt(this.getDomElement().style.left);
+ clickY -= parseInt(this.getDomElement().style.top);
+
+ return new Point(clickX, clickY);
+ }
+
+ /**
+ * Triggered after the map has been resized
+ */
+ this.eventResizeMap = new MapbenderEvent();
+
+
+
+ eventAfterMapObjectConstruction.trigger();
+}
+
+mb_mapObj_const.prototype.getWfsConfIds = function (wfs_config) {
+ var db_wfs_conf_id = [];
+ var js_wfs_conf_id = [];
+
+ //search configurations that are selected (and in scale)
+ for (var i=0; i < this.wms.length; i++){
+ for(var ii=0; ii < this.wms[i].objLayer.length; ii++){
+ var o = this.wms[i].objLayer[ii];
+ if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1'){
+ if(!checkscale || o.checkScale(this))
+ db_wfs_conf_id[db_wfs_conf_id.length] = o.gui_layer_wfs_featuretype;
+ }
+ }
+ }
+ for(var i=0; i < db_wfs_conf_id.length; i++){
+ for(var ii=0; ii < wfs_config.length; ii++){
+ if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i]){
+ js_wfs_conf_id[js_wfs_conf_id.length] = ii;
+ break;
+ }
+ }
+ }
+ return js_wfs_conf_id;
+};
\ No newline at end of file
Modified: branches/google_dev/trunk/http/javascripts/mod_changeEPSG.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_changeEPSG.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_changeEPSG.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -49,7 +49,7 @@
var currentSrs = {
"frameName" : mb_mapObj[i].elementName,
"epsg" : mb_mapObj[i].epsg,
- "extent" : mb_mapObj[i].extent,
+ "extent" : mb_mapObj[i].extent.toString(),
"width" : mb_mapObj[i].width,
"height" : mb_mapObj[i].height
};
@@ -90,16 +90,24 @@
}
else{
mb_mapObj[ind].epsg = newExtent[i].newSrs;
- mb_mapObj[ind].extent = parseFloat(newExtent[i].minx) + "," + parseFloat(newExtent[i].miny) + "," +
- parseFloat(newExtent[i].maxx) + "," + parseFloat(newExtent[i].maxy);
+ mb_mapObj[ind].extent = new Extent(
+ parseFloat(newExtent[i].minx),
+ parseFloat(newExtent[i].miny),
+ parseFloat(newExtent[i].maxx),
+ parseFloat(newExtent[i].maxy)
+ );
setMapRequest(newExtent[i].frameName);
}
}
else {
var ind = getMapObjIndexByName(newExtent[i].frameName);
mb_mapObj[ind].epsg = newExtent[i].newSrs;
- mb_mapObj[ind].extent = parseFloat(newExtent[i].minx) + "," + parseFloat(newExtent[i].miny) + "," +
- parseFloat(newExtent[i].maxx) + "," + parseFloat(newExtent[i].maxy);
+ mb_mapObj[ind].extent = new Extent(
+ parseFloat(newExtent[i].minx),
+ parseFloat(newExtent[i].miny),
+ parseFloat(newExtent[i].maxx),
+ parseFloat(newExtent[i].maxy)
+ );
setMapRequest(newExtent[i].frameName);
}
}
Modified: branches/google_dev/trunk/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_digitize_tab.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -998,7 +998,7 @@
var mapObj = parent.mb_mapObj[parent.getMapObjIndexByName(mod_digitize_target)];
var width = mapObj.width;
var height = mapObj.height;
- var arrayBBox = mapObj.extent.split(",")
+ var arrayBBox = mapObj.extent.toString().split(",")
var minX = parseFloat(arrayBBox[0]);
var minY = parseFloat(arrayBBox[1]);
var maxX = parseFloat(arrayBBox[2]);
Modified: branches/google_dev/trunk/http/javascripts/mod_dragMapSize.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_dragMapSize.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_dragMapSize.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -108,10 +108,18 @@
targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
- var mybbox = targetObject.extent.split(",");
+ var mybbox = targetObject.extent.toString().split(",");
targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
+ targetObject.eventResizeMap.trigger();
+
+ // google maps automatically draws the map after the canvas is resized
+ if (typeof targetObject.google !== "undefined") {
+ targetObject.google.skipRequest = true;
+ }
targetObject.setMapRequest();
- eventResizeMap.trigger();
+ if (typeof targetObject.google !== "undefined") {
+ targetObject.google.skipRequest = false;
+ }
}
function mod_dragMapSize_drag(e){
Modified: branches/google_dev/trunk/http/javascripts/mod_dynamicOverview.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_dynamicOverview.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_dynamicOverview.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -84,7 +84,7 @@
if (map.elementName == map0.elementName) {
// get center in coords:
- var coords = map0.extent.split(",");
+ var coords = map0.extent.toString().split(",");
var minx = parseFloat(coords[0]);
var miny = parseFloat(coords[1]);
var maxx = parseFloat(coords[2]);
Modified: branches/google_dev/trunk/http/javascripts/mod_export_image.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_export_image.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_export_image.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -111,7 +111,7 @@
if(ind_size != 0 && ind_format != 0){
var ind = window.opener.getMapObjIndexByName(mod_print1_target);
- var coord = window.opener.mb_mapObj[ind].extent.split(",");
+ var coord = window.opener.mb_mapObj[ind].extent.toString().split(",");
var centerX = parseInt(coord[0]) + (parseInt(coord[2]) - parseInt(coord[0]))/2
var centerY = parseInt(coord[1]) + (parseInt(coord[3]) - parseInt(coord[1]))/2
if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "portrait"){
@@ -158,7 +158,9 @@
window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.width = document.form1.map_width.value;
window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.height = document.form1.map_height.value;
- window.opener.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," + coord[3];
+ window.opener.mb_mapObj[ind].extent.set(
+ new Point(coord[0], pos[1]), new Point(pos[0], coord[3])
+ );
window.opener.setMapRequest(mod_print1_target);
}
}
@@ -180,7 +182,7 @@
cnt_urls++;
}
}
- document.form1.map_extent.value = window.opener.mb_mapObj[ind].extent;
+ document.form1.map_extent.value = window.opener.mb_mapObj[ind].extent.toString();
document.form1.map_scale.value = window.opener.mb_getScale(mod_print1_target);
}
function printMap(){
Deleted: branches/google_dev/trunk/http/javascripts/mod_featureInfo.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfo.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_featureInfo.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,95 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_featureInfo.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include '../include/dyn_js.php';
-//defaults for element vars
-?>
-if(typeof(featureInfoLayerPopup)==='undefined')
- var featureInfoLayerPopup = 'false';
-if(typeof(featureInfoPopupHeight)==='undefined')
- var featureInfoPopupHeight = '200';
-if(typeof(featureInfoPopupWidth)==='undefined')
- var featureInfoPopupWidth = '270';
-
-var mod_featureInfo_elName = "featureInfo1";
-var mod_featureInfo_frameName = "";
-var mod_featureInfo_target = "<?php echo $e_target[0]; ?>";
-var mod_featureInfo_mapObj = null;
-
-var mod_featureInfo_img_on = new Image(); mod_featureInfo_img_on.src = "<?php echo preg_replace("/_off/","_on",$e_src); ?>";
-var mod_featureInfo_img_off = new Image(); mod_featureInfo_img_off.src ="<?php echo $e_src; ?>";
-var mod_featureInfo_img_over = new Image(); mod_featureInfo_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
-
-function init_featureInfo1(ind){
- mod_featureInfo_mapObj = getMapObjByName(mod_featureInfo_target);
-
- mb_button[ind] = document.getElementById(mod_featureInfo_elName);
- mb_button[ind].img_over = mod_featureInfo_img_over.src;
- mb_button[ind].img_on = mod_featureInfo_img_on.src;
- mb_button[ind].img_off = mod_featureInfo_img_off.src;
- mb_button[ind].status = 0;
- mb_button[ind].elName = mod_featureInfo_elName;
- mb_button[ind].fName = mod_featureInfo_frameName;
- mb_button[ind].go = new Function ("mod_featureInfo_click()");
- mb_button[ind].stop = new Function ("mod_featureInfo_disable()");
-}
-function mod_featureInfo_click(){
- mod_featureInfo_mapObj.getDomElement().onclick = mod_featureInfo_event;
-}
-function mod_featureInfo_disable(){
- mod_featureInfo_mapObj.getDomElement().onclick = null;
-}
-function mod_featureInfo_event(e){
- var point = mod_featureInfo_mapObj.getMousePos(e);
-
- eventBeforeFeatureInfo.trigger({"fName":mod_featureInfo_target});
-
-//TODO that code should go to featureInfo Redirect module
- if(document.getElementById("FeatureInfoRedirect")){
- //fill the frames
- for(var i=0; i<mod_featureInfo_mapObj.wms.length; i++){
- var req = mod_featureInfo_mapObj.wms[i].getFeatureInfoRequest(mod_featureInfo_mapObj, point);
- if(req)
- window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfo_mapObj.wms[i].wms_id).src = req;
- }
- }
- else{
- urls = mod_featureInfo_mapObj.getFeatureInfoRequests(point);
- if(urls){
- for(var i=0;i<urls.length;i++){
- if(featureInfoLayerPopup == 'true'){
- var p = new mb_popup({
- title:<?php echo _mb("Informations");?>,
- url:urls[i],
- width:parseInt(featureInfoPopupWidth, 10),
- height:parseInt(featureInfoPopupHeight, 10),
- top:200,
- left:600
- });
- }
- else
- window.open(urls[i], "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
- }
- }
- else
- alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
- }
- setFeatureInfoRequest(mod_featureInfo_target,clickX,clickY);
-}
Copied: branches/google_dev/trunk/http/javascripts/mod_featureInfo.php (from rev 3904, trunk/mapbender/http/javascripts/mod_featureInfo.php)
===================================================================
--- branches/google_dev/trunk/http/javascripts/mod_featureInfo.php (rev 0)
+++ branches/google_dev/trunk/http/javascripts/mod_featureInfo.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,109 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_featureInfo.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
+?>
+try {
+ if (ignoreWms) {
+ }
+}
+catch (e) {
+ ignoreWms = [];
+}
+
+if(typeof(featureInfoLayerPopup)==='undefined')
+ var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+ var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+ var featureInfoPopupWidth = '270';
+
+var mod_featureInfo_elName = "<?php echo $e_id;?>";
+var mod_featureInfo_frameName = "";
+var mod_featureInfo_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfo_mapObj = null;
+
+var mod_featureInfo_img_on = new Image(); mod_featureInfo_img_on.src = "<?php echo preg_replace("/_off/","_on",$e_src); ?>";
+var mod_featureInfo_img_off = new Image(); mod_featureInfo_img_off.src ="<?php echo $e_src; ?>";
+var mod_featureInfo_img_over = new Image(); mod_featureInfo_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
+
+eventInit.register(function () {
+ mb_regButton(function init_featureInfo1(ind){
+ mod_featureInfo_mapObj = getMapObjByName(mod_featureInfo_target);
+
+ mb_button[ind] = document.getElementById(mod_featureInfo_elName);
+ mb_button[ind].img_over = mod_featureInfo_img_over.src;
+ mb_button[ind].img_on = mod_featureInfo_img_on.src;
+ mb_button[ind].img_off = mod_featureInfo_img_off.src;
+ mb_button[ind].status = 0;
+ mb_button[ind].elName = mod_featureInfo_elName;
+ mb_button[ind].fName = mod_featureInfo_frameName;
+ mb_button[ind].go = function () {
+ mod_featureInfo_click();
+ };
+ mb_button[ind].stop = function () {
+ mod_featureInfo_disable();
+ };
+ });
+});
+function mod_featureInfo_click(){
+ mod_featureInfo_mapObj.getDomElement().onclick = mod_featureInfo_event;
+}
+function mod_featureInfo_disable(){
+ mod_featureInfo_mapObj.getDomElement().onclick = null;
+}
+function mod_featureInfo_event(e){
+ var point = mod_featureInfo_mapObj.getMousePos(e);
+
+ eventBeforeFeatureInfo.trigger({"fName":mod_featureInfo_target});
+
+//TODO that code should go to featureInfo Redirect module
+ if(document.getElementById("FeatureInfoRedirect")){
+ //fill the frames
+ for(var i=0; i<mod_featureInfo_mapObj.wms.length; i++){
+ var req = mod_featureInfo_mapObj.wms[i].getFeatureInfoRequest(mod_featureInfo_mapObj, point);
+ if(req)
+ window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfo_mapObj.wms[i].wms_id).src = req;
+ }
+ }
+ else{
+ urls = mod_featureInfo_mapObj.getFeatureInfoRequests(point, ignoreWms);
+ if(urls){
+ for(var i=0;i<urls.length;i++){
+ if(featureInfoLayerPopup == 'true'){
+ var p = new mb_popup({
+ title:<?php echo _mb("Informations");?>,
+ url:urls[i],
+ width:parseInt(featureInfoPopupWidth, 10),
+ height:parseInt(featureInfoPopupHeight, 10),
+ top:200,
+ left:600
+ });
+ }
+ else
+ window.open(urls[i], "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+ }
+ }
+ else
+ alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+ }
+ setFeatureInfoRequest(mod_featureInfo_target,clickX,clickY);
+}
Modified: branches/google_dev/trunk/http/javascripts/mod_print1.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_print1.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_print1.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -110,7 +110,7 @@
if(ind_size != 0 && ind_format != 0){
var ind = window.opener.getMapObjIndexByName(mod_print1_target);
- var coord = window.opener.mb_mapObj[ind].extent.split(",");
+ var coord = window.opener.mb_mapObj[ind].extent.toString().split(",");
var centerX = parseInt(coord[0]) + (parseInt(coord[2]) - parseInt(coord[0]))/2
var centerY = parseInt(coord[1]) + (parseInt(coord[3]) - parseInt(coord[1]))/2
if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "portrait"){
@@ -157,7 +157,10 @@
window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.width = document.form1.map_width.value;
window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.height = document.form1.map_height.value;
- window.opener.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," + coord[3];
+ window.opener.mb_mapObj[ind].extent.set(
+ new window.opener.Point(coord[0], pos[1]),
+ new window.opener.Point(pos[0], coord[3])
+ );
window.opener.setMapRequest(mod_print1_target);
}
}
Modified: branches/google_dev/trunk/http/javascripts/mod_resize_mapsize.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_resize_mapsize.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_resize_mapsize.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -90,7 +90,7 @@
var ind = getMapObjIndexByName("<?php echo $e_target; ?>");
var mapheight = frameHeight() - <?php echo $e_top ?> + parseInt(adjust_height);
var mapwidth = frameWidth() - map_frame_left - legend_width + parseInt(adjust_width) ;
- var coords = mb_mapObj[ind].extent.split(",");
+ var coords = mb_mapObj[ind].extent.toString().split(",");
midcoordx=parseFloat((parseFloat(coords[2])-parseFloat(coords[0]))/2)+parseFloat(coords[0]);
midcoordy=parseFloat((parseFloat(coords[3])-parseFloat(coords[1]))/2)+parseFloat(coords[1]);
mb_mapObj[ind].setWidth(mapwidth);
Deleted: branches/google_dev/trunk/http/javascripts/mod_sandclock.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_sandclock.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_sandclock.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,81 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_sandclock.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-echo "var mod_sandclock_target = '".$e_target[0]."';";
-include '../include/dyn_js.php';
-?>
-try{
- if (mod_sandclock_image){}
-}
-catch(e){
- mod_sandclock_image = "../img/sandclock.gif";
-}
-
-var mod_sandclock_img = new Image();
-mod_sandclock_img.src = mod_sandclock_image;
-
-eventAfterMapRequest.register(function (obj) {
- mod_sandclock(true,obj.myMapId);
-});
-
-function mod_sandclock(start,myMapId){
- var ind = getMapObjIndexByName(mod_sandclock_target);
- if(start){
- var temp = "<img src='"+mod_sandclock_img.src+"'>";
-
- var map_el = mb_mapObj[ind].getDomElement();
- if(!map_el.ownerDocument.getElementById(mb_mapObj[ind].elementName+"_sandclock")){
- //create Box Elements
- el_top = map_el.ownerDocument.createElement("div");
- el_top.style.position = "absolute";
- el_top.style.top = "0px";
- el_top.style.left = "0px";
- el_top.style.width = "0px";
- el_top.style.height = "0px";
- el_top.style.overflow = "hidden";
- el_top.style.zIndex = "10";
- el_top.style.visibility = "hidden";
- el_top.style.cursor = "crosshair";
- el_top.style.backgroundColor = "#ff0000";
- el_top.id = mb_mapObj[ind].elementName+"_sandclock";
- map_el.appendChild(el_top);
- }
- writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_sandclock", temp);
- mb_arrangeElement("", mod_sandclock_target+"_sandclock", (mb_mapObj[ind].width/2 - 16), (mb_mapObj[ind].height/2 - 16));
- }
- aktiv = setTimeout(function () {
- mod_sandclock('',myMapId);
- },10);
- var myMapIdArray = myMapId.split(",");
- var complete = true;
- var myMapId;
- for (var i = 0; i < myMapIdArray.length && complete; i++) {
- myMapId = myMapIdArray[i];
- var myDoc = mb_mapObj[ind].getDomElement().ownerDocument;
- if(myDoc.getElementById(myMapId) &&
- !myDoc.getElementById(myMapId).complete) {
- complete = false;
- }
- }
- if (complete) {
- clearTimeout(aktiv);
- writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_sandclock", "");
- }
-}
Copied: branches/google_dev/trunk/http/javascripts/mod_sandclock.php (from rev 3912, trunk/mapbender/http/javascripts/mod_sandclock.php)
===================================================================
--- branches/google_dev/trunk/http/javascripts/mod_sandclock.php (rev 0)
+++ branches/google_dev/trunk/http/javascripts/mod_sandclock.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,91 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_sandclock.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+echo "var mod_sandclock_target = '".$e_target[0]."';";
+include '../include/dyn_js.php';
+?>
+try{
+ if (mod_sandclock_image){}
+}
+catch(e){
+ mod_sandclock_image = "../img/sandclock.gif";
+}
+
+var mod_sandclock_img = new Image();
+mod_sandclock_img.src = mod_sandclock_image;
+
+eventAfterMapRequest.register(function (obj) {
+ mod_sandclock(true,obj.myMapId);
+});
+
+function mod_sandclock(start,myMapId){
+ var ind = getMapObjIndexByName(mod_sandclock_target);
+ if(start){
+ var temp = "<img src='"+mod_sandclock_img.src+"'>";
+
+ var map_el = mb_mapObj[ind].getDomElement();
+ if(!map_el.ownerDocument.getElementById(mb_mapObj[ind].elementName+"_sandclock")){
+ //create Box Elements
+ el_top = map_el.ownerDocument.createElement("div");
+ el_top.style.position = "absolute";
+ el_top.style.top = "0px";
+ el_top.style.left = "0px";
+ el_top.style.overflow = "hidden";
+ el_top.style.zIndex = "10";
+ el_top.style.visibility = "visible";
+ el_top.style.cursor = "crosshair";
+ el_top.id = mb_mapObj[ind].elementName+"_sandclock";
+ map_el.appendChild(el_top);
+ }
+ writeTag(mb_mapObj[ind].frameName, mb_mapObj[ind].elementName+"_sandclock", temp);
+ mb_arrangeElement("", mod_sandclock_target+"_sandclock", (mb_mapObj[ind].width/2 - 16), (mb_mapObj[ind].height/2 - 16));
+ }
+
+ //
+ // if myMapId is nopt given, the sandclock has to be turned off manually
+ // by calling mod_sandclock_off. Usually this is done in a callback
+ // function.
+ //
+ if (typeof myMapId !== "undefined") {
+ aktiv = setTimeout(function () {
+ mod_sandclock('',myMapId);
+ },10);
+ var myMapIdArray = myMapId.split(",");
+ var complete = true;
+ var myMapId;
+ for (var i = 0; i < myMapIdArray.length && complete; i++) {
+ myMapId = myMapIdArray[i];
+ var myDoc = mb_mapObj[ind].getDomElement().ownerDocument;
+ if(myDoc.getElementById(myMapId) &&
+ !myDoc.getElementById(myMapId).complete) {
+ complete = false;
+ }
+ }
+ if (complete) {
+ clearTimeout(aktiv);
+ mod_sandclock_off(mb_mapObj[ind]);
+ }
+ }
+}
+
+function mod_sandclock_off() {
+ var mapObj = getMapObjByName(mod_sandclock_target);
+ writeTag(mapObj.frameName, mapObj.elementName+"_sandclock", "");
+}
Modified: branches/google_dev/trunk/http/javascripts/mod_scaleHint.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_scaleHint.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_scaleHint.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -41,14 +41,14 @@
var newScale = mod_scaleHint_max;
}
var ind = getMapObjIndexByName(frameName);
- var arrayBBox = mb_mapObj[ind].extent.split(",");
+ var arrayBBox = mb_mapObj[ind].extent.toString().split(",");
var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
var miny = parseFloat(y) - (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * newScale);
var maxy = parseFloat(y) + (mb_mapObj[ind].height / (mb_resolution * 100 *2) * newScale);
- mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+ mb_mapObj[ind].extent = new Extent(minx, miny, maxx, maxy);
}
}
return true;
Modified: branches/google_dev/trunk/http/javascripts/mod_scaleText.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_scaleText.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_scaleText.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -31,7 +31,7 @@
return;
}
var ind = getMapObjIndexByName(frameName);
- var arrayBBox = mb_mapObj[ind].extent.split(",");
+ var arrayBBox = mb_mapObj[ind].extent.toString().split(",");
var x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
var y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
@@ -39,7 +39,7 @@
var miny = parseFloat(y) - (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);
var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale.value);
var maxy = parseFloat(y) + (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale.value);
- mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+ mb_mapObj[ind].extent = new Extent(minx, miny, maxx, maxy);
setMapRequest(frameName);
scale.value = "";
}
Modified: branches/google_dev/trunk/http/javascripts/mod_selectMapsize.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_selectMapsize.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_selectMapsize.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -27,8 +27,8 @@
var w = parseInt(p[0]) ;
var h = parseInt(p[1]);
var pos = makeClickPos2RealWorldPos(mod_selectMapsize_target,w,h);
- var coords = mb_mapObj[ind].extent.split(",");
- mb_mapObj[ind].extent = coords[0] + "," + pos[1] + "," + pos[0] + "," + coords[3];
+ var coords = mb_mapObj[ind].extent.toString().split(",");
+ mb_mapObj[ind].extent = new Extent(coords[0], pos[1], pos[0], coords[3]);
mb_mapObj[ind].width = w;
mb_mapObj[ind].height = h;
document.getElementById(mod_selectMapsize_target).style.width = mb_mapObj[ind].width;
Modified: branches/google_dev/trunk/http/javascripts/mod_usemap.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_usemap.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_usemap.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -28,7 +28,7 @@
function mod_usemap_init(){
var ind = getMapObjIndexByName(mod_usemap_target);
- var extent = mb_mapObj[ind].extent;
+ var extent = mb_mapObj[ind].extent.toString();
var url = "../php/mod_usemap.php?url="
url += escape(mod_usemap_wfs + "&BBOX=" + extent);
url += "&extent=" + extent;
Modified: branches/google_dev/trunk/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_wfs_SpatialRequest.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -117,24 +117,23 @@
});
}
else {
- if (buttonWfs_toDigitize_on == 1) {
- mb_registerWfsReadSubFunctions(function(geom){
- if (buttonWfs_toDigitize_target && window.frames[buttonWfs_toDigitize_target]) {
- try {
- tab_open(buttonWfs_toDigitize_target);
- }
- catch (exc) {
- new Mb_warning("Tab open failed, pssibly because you do not have tabs in your application.");
- }
- appendGeometryArrayToDigitize(geom);
+ buttonWfs_toDigitize_on = 1;
+ mb_registerWfsReadSubFunctions(function(geom){
+ if (buttonWfs_toDigitize_target && window.frames[buttonWfs_toDigitize_target]) {
+ try {
+ tab_open(buttonWfs_toDigitize_target);
}
- else {
- var msg = "No digitizing module available. " +
- "Check you WFS spatial request configuration.";
- var e = new Mb_warning(msg);
+ catch (exc) {
+ new Mb_warning("Tab open failed, pssibly because you do not have tabs in your application.");
}
- });
- }
+ appendGeometryArrayToDigitize(geom);
+ }
+ else {
+ var msg = "No digitizing module available. " +
+ "Check you WFS spatial request configuration.";
+ var e = new Mb_warning(msg);
+ }
+ });
}
var msgObj;
Modified: branches/google_dev/trunk/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/mod_wfs_gazetteer_client.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -34,10 +34,28 @@
<?php
include '../include/dyn_css.php';
?>
+
+<style type="text/css">
+ #feedback { font-size: 1.4em; }
+ #ui-sortable-result-list .ui-selecting { background: #4473C4; color: white; }
+ #ui-sortable-result-list .ui-selected { background: #4473C4; color: white; }
+ #ui-sortable-result-list { list-style-type: none; margin: 0; padding: 0; width: 100%; }
+ #ui-sortable-result-list li { margin: 3px; padding: 0.4em; height: 18px; cursor: move}
+ .contextMenu
+ {
+ display:none;
+ }
+</style>
+
<script type="text/javascript">
<?php
include '../include/dyn_js.php';
include '../include/dyn_php.php';
+ include '../extensions/jquery-1.3.2.min.js';
+ include '../extensions/jquery-ui-selectable.min.js';
+ include '../extensions/jquery.contextmenu.r2.js';
+// include '../extensions/ui.core.js';
+// include '../extensions/ui.selectable.js';
include(dirname(__FILE__) . "/../../conf/" . $wfs_spatial_request_conf_filename);
echo "var targetString = '" . $target . "';";
@@ -45,6 +63,13 @@
echo "var e_id_css = '" . $e_id_css . "';";
?>
+parent.eventAfterMapRequest.register(function () {
+ if (typeof global_resultHighlight !== "undefined") {
+ global_resultHighlight.paint();
+ }
+});
+
+
// Element var maxHighlightedPoints
try{
if (maxHighlightedPoints){
@@ -70,6 +95,36 @@
openLinkFromSearch =0;
}
+function clickPdf (flstkArray) {
+ new parent.Mb_notice(flstkArray);
+}
+
+function clickBild (flstkArray) {
+ new parent.Mb_notice(flstkArray);
+}
+
+function clickAlkisbuch (flstkArray) {
+ new parent.Mb_notice(flstkArray);
+}
+
+var global_flstkElementName = "fsk";
+
+function parameterizedSearch (confId, featuretypeElementName, valueArray) {
+ try {
+ parent.tab_open(this.name);
+ }
+ catch (e) {
+ new parent.Mb_notice("tab_open() failed...maybe '" + this.name + "' is not in a tab.");
+ }
+ clearFilter();
+ selectWfsConfId(confId);
+ document.getElementById(featuretypeElementName).value = valueArray.join(" ");
+ if (validate()) {
+ document.getElementById("wfsForm").submit();
+ }
+ var global_flstkElementName = featuretypeElementName;
+}
+
var targetArray = targetString.split(",");
var global_wfsConfObj;
var global_selectedWfsConfId;
@@ -363,6 +418,7 @@
geomArray = new parent.GeometryArray();
parent.mb_ajax_json("../php/mod_wfs_gazetteer_server.php", {command:"getWfsConf",wfsConfIdString:wfsConfIdString}, function(json, status) {
+// parent.mb_ajax_json("../php/mod_wfs_gazetteer_server.php", {command:"getWfsConfsForThisApplication",wfsConfIdString:wfsConfIdString}, function(json, status) {
global_wfsConfObj = json;
var wfsCount = 0;
for (var wfsConfId in global_wfsConfObj) {
@@ -465,27 +521,31 @@
wfsConfIdString = str.join(",");
}
+function selectWfsConfId (confId) {
+ global_selectedWfsConfId = confId;
+ if(typeof(resultGeometryPopup)!="undefined"){
+ resultGeometryPopup.destroy();
+ }
+ if(typeof(wfsPopup)!="undefined"){
+ wfsPopup.destroy();
+ }
+ setWfsInfo();
+ appendStyles();
+ appendWfsForm();
+}
+
function appendWfsConfSelectBox() {
var selectNode = document.createElement("select");
selectNode.name = "wfs_conf_sel";
var wfsFormNode = document.getElementById("selectWfsConfForm");
- if (parent.ie) {
+// if (parent.ie) {
selectNode.onchange = function() {
- global_selectedWfsConfId = this.value;
- if(typeof(resultGeometryPopup)!="undefined"){
- resultGeometryPopup.destroy();
- }
- if(typeof(wfsPopup)!="undefined"){
- wfsPopup.destroy();
- }
- setWfsInfo();
- appendStyles();
- appendWfsForm();
+ selectWfsConfId(parseInt(this.value, 10));
};
- }
- else{
- selectNode.setAttribute("onchange", "if(typeof(resultGeometryPopup)!='undefined'){resultGeometryPopup.destroy();}if(typeof(wfsPopup)!='undefined'){wfsPopup.destroy();};global_selectedWfsConfId = this.value;setWfsInfo();appendStyles();appendWfsForm();");
- }
+// }
+// else{
+// selectNode.setAttribute("onchange", "if(typeof(resultGeometryPopup)!='undefined'){resultGeometryPopup.destroy();}if(typeof(wfsPopup)!='undefined'){wfsPopup.destroy();};global_selectedWfsConfId = this.value;setWfsInfo();appendStyles();appendWfsForm();");
+// }
var isSelected = false;
for (var wfsConfId in global_wfsConfObj) {
var optionNode = document.createElement("option");
@@ -614,6 +674,8 @@
}
function clearFilter(){
+ createGlobalResultHighlight(targetArray);
+
var wfsConfElementArray = global_wfsConfObj[global_selectedWfsConfId].element;
for (var i = 0; i < wfsConfElementArray.length; i++){
if (parseInt(wfsConfElementArray[i].f_search)) {
@@ -698,6 +760,11 @@
return cnt;
}
+
+function createGlobalResultHighlight (targetArray) {
+ global_resultHighlight = new parent.Highlight(targetArray, "wfs_gazetteer_highlight", {"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 2);
+}
+
function validate(){
if(geomArray.count()>0){
geomArray.empty();
@@ -708,8 +775,7 @@
if(typeof(wfsPopup)!="undefined"){
wfsPopup.destroy();
}
- global_resultHighlight = new parent.Highlight(targetArray, "wfs_gazetteer_highlight", {"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 2);
-
+ createGlobalResultHighlight(targetArray);
var filterParameterCount = getNumberOfFilterParameters();
if(filterParameterCount == 0 && spatialRequestGeom == null){
@@ -719,7 +785,7 @@
}
else{
if(inputNotEnough.length==0){
- var andConditions = "";
+ var andConditions = [];
var el = global_wfsConfObj[global_selectedWfsConfId].element;
var srs = global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
@@ -740,7 +806,7 @@
var elementValue = selectedVal.join(",");
}
else{
- var elementValue = document.getElementById(el[i]['element_name']).value;
+ var elementValue = document.getElementById(el[i]['element_name']).value.toString().split(" ").join(",");
}
}
@@ -855,49 +921,50 @@
}
}
if(a.length > 1){
- andConditions += "<Or>" + orConditions + "</Or>";
+ andConditions.push("<Or>" + orConditions + "</Or>");
}
else {
- andConditions += orConditions;
+ andConditions.push(orConditions);
}
}
}
if(spatialRequestGeom!=null){
+ var currentAndCondition = "";
if(spatialRequestGeom.geomType == "polygon"){
if(buttonPolygon.filteroption=='within'){
- andConditions += "<Within><ogc:PropertyName>";
+ currentAndCondition = "<Within><ogc:PropertyName>";
for (var j=0; j < el.length; j++) {
if(el[j]['f_geom']==1){
var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
+ currentAndCondition += el[j]['element_name'];
}
}
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+ currentAndCondition += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
for(var k=0; k<spatialRequestGeom.count(); k++){
- if(k>0) andConditions += " ";
- andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
+ if(k>0) currentAndCondition += " ";
+ currentAndCondition += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
}
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Within>";
+ currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ currentAndCondition += "</gml:Polygon></Within>";
}
else if(buttonPolygon.filteroption=='intersects'){
- andConditions += "<Intersects><ogc:PropertyName>";
+ currentAndCondition = "<Intersects><ogc:PropertyName>";
for (var j=0; j < el.length; j++) {
if(el[j]['f_geom']==1){
var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
+ currentAndCondition += el[j]['element_name'];
}
}
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+ currentAndCondition += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
for(var k=0; k<spatialRequestGeom.count(); k++){
- if(k>0) andConditions += " ";
- andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
+ if(k>0) currentAndCondition += " ";
+ currentAndCondition += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
}
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Intersects>";
+ currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ currentAndCondition += "</gml:Polygon></Intersects>";
}
}
else if(spatialRequestGeom.geomType == "line"){
@@ -905,48 +972,48 @@
rectangle = spatialRequestGeom.getBBox();
if(buttonRectangle.filteroption=='within'){
- andConditions += "<Within><ogc:PropertyName>";
+ currentAndCondition = "<Within><ogc:PropertyName>";
for (var j=0; j < el.length; j++) {
if(el[j]['f_geom']==1){
var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
+ currentAndCondition += el[j]['element_name'];
}
}
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Within>";
+ currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+ currentAndCondition += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ currentAndCondition += rectangle[0].x+","+rectangle[0].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[0].x+","+rectangle[1].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[1].x+","+rectangle[1].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[1].x+","+rectangle[0].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[0].x+","+rectangle[0].y;
+ currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ currentAndCondition += "</gml:Polygon></Within>";
}
else if(buttonRectangle.filteroption=='intersects'){
- andConditions += "<Intersects><ogc:PropertyName>";
+ currentAndCondition = "<Intersects><ogc:PropertyName>";
for (var j=0; j < el.length; j++) {
if(el[j]['f_geom']==1){
var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
+ currentAndCondition += el[j]['element_name'];
}
}
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Intersects>";
+ currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
+ currentAndCondition += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ currentAndCondition += rectangle[0].x+","+rectangle[0].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[0].x+","+rectangle[1].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[1].x+","+rectangle[1].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[1].x+","+rectangle[0].y;
+ currentAndCondition += " ";
+ currentAndCondition += rectangle[0].x+","+rectangle[0].y;
+ currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ currentAndCondition += "</gml:Polygon></Intersects>";
}
}
else if(spatialRequestGeom.geomType == "point"){
@@ -961,28 +1028,33 @@
var realWorld2 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
var realWorld3 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYAddPix);
var realWorld4 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
- andConditions += "<Intersects><ogc:PropertyName>";
+ currentAndCondition = "<Intersects><ogc:PropertyName>";
for (var j=0; j < el.length; j++) {
if(el[j]['f_geom']==1){
var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
+ currentAndCondition += el[j]['element_name'];
}
}
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] + " ";
- andConditions += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1];
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects>";
+ currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ currentAndCondition += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] + " ";
+ currentAndCondition += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1];
+ currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects>";
}
//andConditions += "<ogc:Not><ogc:PropertyIsNull>";
//andConditions += "<ogc:PropertyName>" + elementName + "</ogc:PropertyName>";
//andConditions += "</ogc:PropertyIsNull></ogc:Not>";
+ if (currentAndCondition !== "") {
+ andConditions.push(currentAndCondition);
+ }
+
}
- if (filterParameterCount > 1 || spatialRequestGeom != null) {
- andConditions = "<And>" + andConditions + "</And>";
+ var andConditionString = andConditions.join("");
+ if (andConditions.length > 1) {
+ andConditionString = "<And>" + andConditionString + "</And>";
}
- var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>"+andConditions+"</ogc:Filter>";
+ var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>"+andConditionString+"</ogc:Filter>";
document.getElementById("res").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
var parameters = {
@@ -1035,10 +1107,38 @@
return false;
}
+function flstkNrBeautifier (flstkNr) {
+ var pattern = /^\d{2}(\d{4})(\d{3})(\d{5})(\d{4})?/;
+ var regExpSegments = pattern.exec(flstkNr);
+ var beautified = "";
+ beautified += regExpSegments[1] + "-" + regExpSegments[2] + "-" +
+ String(parseInt(regExpSegments[3], 10));
+
+ if (regExpSegments[4]) {
+ beautified += "/" + String(parseInt(regExpSegments[4], 10));
+ }
+ return beautified;
+}
+
+function getFlstkFromSelection ($selection) {
+ var flstkArray = [];
+
+ var geomIndices = getSelectedResultGeometries($selection);
+ var attributeName = getTitleAttribute();
+ if (attributeName !== null) {
+ for (var i = 0; i < geomIndices.length; i++) {
+ var flstkNr = geomArray.get(geomIndices[i]).e.getElementValueByName(attributeName);
+ flstkArray.push(flstkNr);
+ }
+ }
+ return flstkArray;
+}
+
function displayResult(geom){
geomArray = geom;
if(geomArray!=null && geomArray.count()>0){
- var contentHtml = createListOfGeometries();
+// var contentHtml = createListOfGeometries();
+ var contentHtml = createUiResultList();
}
else{
var contentHtml = "No results.";
@@ -1058,10 +1158,112 @@
});
}
else{
- document.getElementById("res").innerHTML = contentHtml;
+ $("#res").html(contentHtml);
+ $("#ui-sortable-result-list").children().contextMenu('folderMenu', {
+ "shadow" : false,
+ onContextMenu: function(e){
+ $("#resultgeometry_zoom").css("display", "block");
+
+ if (!$(e.target).hasClass('ui-selected')) {
+ $('.ui-selected').removeClass('ui-selected');
+ $(e.target).addClass('ui-selected');
+ }
+ if ($('.ui-selected').size() > 1) {
+ $("#resultgeometry_zoom").css("display", "none");
+ }
+ return true;
+ },
+ onShowMenu: function(e, menu){
+ showContextMenu();
+ return menu;
+ },
+ bindings: {
+ 'resultgeometry_pdf': function (item) {
+ var flstkArray = getFlstkFromSelection($(".ui-selected"));
+ clickPdf(flstkArray);
+ },
+ 'resultgeometry_bild': function () {
+ var flstkArray = getFlstkFromSelection($(".ui-selected"));
+ clickBild(flstkArray);
+ },
+ 'resultgeometry_alkisbuch': function () {
+ var flstkArray = getFlstkFromSelection($(".ui-selected"));
+ clickAlkisbuch(flstkArray);
+ },
+ 'resultgeometry_zoom': function (item) {
+ var geomIndices = getSelectedResultGeometries($(".ui-selected"));
+ if (geomIndices.length !== 1) {
+ geomIndices = getSelectedResultGeometries($(item));
+ }
+ setResult('click', geomIndices[0]);
+ }
+ }
+ });
+
+ $("#ui-sortable-result-list").selectable({
+ "selecting" : function () {
+ },
+ "selected" : function (event, ui) {
+ var geomIds = getSelectedResultGeometries($(ui.selected));
+ setResult('over', geomIds[0]);
+ },
+ "unselected" : function(event, ui){
+ var geomIds = getSelectedResultGeometries($(ui.unselected));
+ setResult('out', geomIds[0]);
+ },
+ "start" : function () {
+ hideContextMenu();
+ createGlobalResultHighlight(targetArray);
+ },
+ "stop" : function (event, ui) {
+ }
+ });
}
}
+function clearUiGeometryList () {
+}
+
+function getSelectedResultGeometries ($nodes) {
+ var indexArray = [];
+ $nodes.each(function () {
+ var elementId = this.id;
+ var geometryId = parseInt(elementId.substr(15), 10);
+ indexArray.push(geometryId);
+ });
+ return indexArray;
+}
+
+function showContextMenu () {
+ $("#jqContextMenu").css("display", "block");
+}
+
+function hideContextMenu () {
+ $("#jqContextMenu").css("display", "none");
+}
+
+function createUiResultList () {
+ var listItemArray = [];
+ if (geomArray.count() > 0) {
+ for (var i = 0 ; i < geomArray.count(); i ++) {
+ if (geomArray.get(i).get(-1).isComplete()) {
+ var currentHtml = "<li class='ui-widget-content'";
+ currentHtml += " id='resultgeometry_" + i + "'>";
+ var resultElObj = getListValues(geomArray.get(i));
+ for (var l = 1 ; l < resultElObj.length; l ++) {
+ if(resultElObj[l]!=''){
+ currentHtml += resultElObj[l];
+ }
+ }
+ currentHtml += "</li>";
+ listItemArray.push(currentHtml);
+ }
+ }
+ }
+ return "<ul id='ui-sortable-result-list'>" + listItemArray.join("") + "</ul>";
+
+}
+
function createListOfGeometries(){
if(showResultInPopup==1){
var domPath = "window.frames['"+frameName+"'].";
@@ -1122,6 +1324,16 @@
return listOfGeom;
}
+function getTitleAttribute () {
+ var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
+ for (var j = 0 ; j < wfsConf.element.length ; j++) {
+ if(wfsConf.element[j].f_show == 1){
+ return wfsConf.element[j].element_name;
+ }
+ }
+ return null;
+}
+
function getListTitle(){
var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
var labelArray = [];
@@ -1141,7 +1353,12 @@
if (wfsConf.element[i].f_show == 1 && geom.e.getElementValueByName(wfsConf.element[i].element_name) !=false) {
var pos = wfsConf.element[i].f_respos;
if(pos>0){
- resultArray[pos] = geom.e.getElementValueByName(wfsConf.element[i].element_name);
+ if (global_flstkElementName !== null && wfsConf.element[i].element_name == global_flstkElementName) {
+ resultArray[pos] = flstkNrBeautifier(geom.e.getElementValueByName(wfsConf.element[i].element_name));
+ }
+ else {
+ resultArray[pos] = geom.e.getElementValueByName(wfsConf.element[i].element_name);
+ }
}
}
}
@@ -1277,5 +1494,14 @@
<img src = "" name='wfsGeomType' id='wfsGeomType'>
<form name='wfsForm' id='wfsForm' onsubmit='return validate()'></form>
<div name='res' id='res' style='width:180px'></div>
+ <div class="contextMenu" id="folderMenu">
+ <ul>
+ <li id="resultgeometry_pdf">PDF</li>
+ <li id="resultgeometry_bild">Bild</li>
+ <li id="resultgeometry_alkisbuch">Alkisbuch</li>
+ <li id="resultgeometry_zoom">Zoom</li>
+ </ul>
+ </div>
+ <br><br><br><br>
</body>
</html>
Modified: branches/google_dev/trunk/http/javascripts/ovnf.php
===================================================================
--- trunk/mapbender/http/javascripts/ovnf.php 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/ovnf.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -57,7 +57,7 @@
if (!targetMapObj) {
return;
}
- var arrayBBox = targetMapObj.extent.split(",");
+ var arrayBBox = targetMapObj.extent.toString().split(",");
var minX = parseFloat(arrayBBox[0]);
var minY = parseFloat(arrayBBox[1]);
var maxX = parseFloat(arrayBBox[2]);
Deleted: branches/google_dev/trunk/http/javascripts/popup.js
===================================================================
--- trunk/mapbender/http/javascripts/popup.js 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/popup.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,560 +0,0 @@
-/*
-* $Id$
-* COPYRIGHT: (C) 2002 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
-*/
-//http://www.mapbender.org/index.php/popup
-var popup_count = 1;
-var popup_top = 150;
-
-/**
- * @class A class representing a popup window
- *
- * @constructor
- * @param {String/Object} title the title text of the popup or Options object
- * Elelemts of the options object (all optional):
- * left: position left
- * top: position top
- * width: popup width
- * height: popup height
- * title: popup title
- * frameName: name of the popups iframe if it loads a frame (recommended to set destroy to false)
- * opacity: opacity of the frame default:1
- * moveOpacity: opacity while the user moves or resizes the frame default:0.8
- * html:content html of the frame (not parsed if url not false)
- * url:content url of the frame
- * minWidth: minimum width of the popup if the user resizes it
- * maxWidth: maximum width of the popup if the user resizes it
- * minHeight: minimum height of the popup if the user resizes it
- * maxHeight: maximum height of the popup if the user resizes it
- * minTop: minimum top position if the user moves the popup default:"document"
- * minLeft: minimum left position if the user moves the popup default:"document"
- * maxRight: maximum right position if the user moves/resizes the popup
- * maxBottom: maximum bottom position if the user moves/resized the popup
- * style: additional styles for the popup window
- * destroy: remove dom of popup if user closes it (don't use it for iframes with framename) default:true
- * closeCallback: function that is called if the user closes the window
- * resizeable: allow user to change the size default:true
- * dragable: allow user to move the window default:true
- * balloon: balloon popup from top, left (disables resizeable and dragable)
- * modal: create modal popup default:false
- *
- * @param {String} html the "body" of the popup, can also be "url:http://foo.de" to display a website
- * @param {Number} width width of the popup
- * @param {Number} height hight of the popup
- * @param {Number} posx left position of the popup
- * @param {Number} popy top posision of the popup
- *
- */
-function mb_popup(title,html,width,height,posx,posy,fName,opacity) {
- //get first free place
- var create_pos=popup_count;
- for(var i = 0; i < popup_count;i++)
- if(!document.getElementById("popup"+String(i))){
- create_pos=i;
- break;
- }
-
- this.id="popup"+String(++popup_top);
-
- //Set defaults
- defaults = {
- left:25*create_pos,
- top:25*create_pos,
- width:300,height:250,
- title:"Title",
- frameName:this.id,
- id:this.id
- };
-
- if(typeof(title)!='object'){
- this.options = defaults;
-
- //Set vars
- if(posx)this.options.left=posx;
- if(posy)this.options.top=posy;
- if(width)this.options.width=width;
- if(height)this.options.height=height;
- if(title)this.options.title=title;
- if(fName)this.options.frameName=fName;
- if(opacity)this.options.opacity;
- if(html){
- if(html.indexOf("url:")==0)
- this.options.url=html.substr(4);
- else
- this.options.html=html;
- }
- }
- else
- this.options=$.extend(defaults, title);
-
- this.id = this.options.id;
-
- popup_count++;
-
- //create dom popup
- $("body").append("<div style=\"display:none;z-index:"+popup_top+"\" id=\""+this.id+"\"></div>");
- this.div = $("#"+this.id).mbPopup(this.options);
-}
-
-/**
- * Shows the popup
- */
-mb_popup.prototype.show = function(){
- if(!document.getElementById(this.id)){
- //(re)create dom popup
- $("body").append("<div style=\"display:none;z-index:"+popup_top+"\" id=\""+this.id+"\"></div>");
- this.div = $("#"+this.id).mbPopup(this.options);
- }
- if(!this.isVisible())
- $("#"+this.id).show();
-}
-
-/**
- * Hides the popup
- */
-mb_popup.prototype.hide = function(){
- $("#"+this.id).hide();
- $("#balloon_"+this.id).hide();
- $("#modal_mouse_catcher").remove();
-}
-
-/**
- * Hides the popup
- */
-mb_popup.prototype.destroy = function(){
- $("#"+this.id).remove();
- $("#balloon_"+this.id).remove();
- $("#modal_mouse_catcher").remove();
-}
-
-/**
- * sets the width of the popup window
- *
- * @param {Number} width new width of the popup
- */
-mb_popup.prototype.setWidth = function(width){
- var div=document.getElementById(this.id);
- if(div)div.style.width=width;
-}
-
-/**
- * sets the height of the popup window
- *
- * @param {Number} height new height of the popup
- */
-mb_popup.prototype.setHeight = function(height){
- var div=document.getElementById(this.id);
- if(div)div.style.height=height;
-}
-
-/**
- * sets the left position of the popup window
- *
- * @param {Number} left new left position of the popup
- */
-mb_popup.prototype.setLeft = function(left){
- var div=document.getElementById(this.id);
- if(div)div.style.left=left;
-}
-
-/**
- * sets the top position of the popup window
- *
- * @param {Number} top new top position of the popup
- */
-mb_popup.prototype.setTop = function(topp){
- var div=document.getElementById(this.id);
- if(div)div.style.top=topp;
-}
-
-/**
- * sets the opacity of the popup window
- *
- * @param {Number} opacity new opacity value of the popup
- */
-mb_popup.prototype.setOpacity = function(opacityy){
- var div=document.getElementById(this.id);
- if(div)div.style.opacity=opacityy;
-}
-
-/**
- * sets the title of the popup window
- *
- * @param {String} title new title text of the popup
- */
-mb_popup.prototype.setTitle = function(title){
- $("#"+this.id+" h1").text(title);
-}
-
-/**
- * sets the html content of the popup window
- *
- * @param {String} html new html "body" of the popup
- */
-mb_popup.prototype.setHtml = function(htmll){
- this.options.url=null;
- this.options.html=htmll;
- $("#"+this.id+" .Content").html('<div class="scrollDiv">'+htmll+'</div>');
-}
-/**
- * behaves like document.open(); (clear popup)
- */
-mb_popup.prototype.open = function(){
- oDoc = this.getDocument();
- if(oDoc!=null){
- return oDoc.open();
- }
- this.setHtml("");
-}
-
-/**
- * behaves like document.write(); (appends content to the popup)
- *
- * @param {String} text or html to write into the document
- */
-mb_popup.prototype.write = function(str){
- oDoc = this.getDocument();
- if(oDoc!=null){
- return oDoc.write(str);
- }
- this.setHtml(this.options.html+str);
-}
-
-/**
- * behaves like document.close(); (finish loading state if popup is an iframe)
- */
-mb_popup.prototype.close = function(){
- oDoc = this.getDocument();
- if(oDoc!=null){
- return oDoc.close();
- }
-}
-
-/**
- * sets the url of the content
- *
- * @param {String} url new url of the popup
- */
-mb_popup.prototype.setUrl = function(url){
- this.options.url=url;
- this.options.html=null;
-
- oDoc = this.getDocument();
- if(oDoc){
- oDoc.location.href = url;
- }
- else{
- $("#"+this.id+" .Content").html('<iframe src="'+url+'"></iframe>');
- }
-}
-
-/**
- * reposition
- */
-mb_popup.prototype.reposition =function(){
-//TODO
-}
-
-/**
- * gets the visible state of the popup window
- * @return visible state of the popup
- * @type Boolean
- */
-mb_popup.prototype.isVisible = function(){
- return $("#"+this.id+":visible").length>0?true:false;
-}
-
-/**
- * (re) set Some Options of the popup Window and rerender it
- * @param options object that contains the new options
- */
-mb_popup.prototype.set = function(options){
- this.destroy();
- this.options=$.extend(this.options, options);
- this.show();
-}
-
-/**
- * get the DOM document of the client iframe
- * @return DOM document or null if the popup doesn't contain an iframe
- */
-mb_popup.prototype.getDocument = function(){
- iFrame = $("#"+this.id+" iframe")[0];
- try{
- //try to load contentWindow first since not every browser
- //supports contentDocument (or gives the window instead)
- oDoc = iFrame.contentWindow || iFrame.contentDocument;
- if (oDoc.document) {
- oDoc = oDoc.document;
- }
- return oDoc;
- }
- catch(e){return null;}
-}
-
-/**
- * get Scroll position
- */
-function getScrollPos() {
- var scrOf ={X:0,Y:0,wW:$(window).width(),dW:$().width(),wH:$(window).height(),dH:$().height()};
-
- if( typeof( window.pageYOffset ) == 'number' ) {
- //Netscape compliant
- scrOf.Y = window.pageYOffset;
- scrOf.X = window.pageXOffset;
- } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
- //DOM compliant
- scrOf.Y = document.body.scrollTop;
- scrOf.X = document.body.scrollLeft;
- } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
- //IE6 standards compliant mode
- scrOf.Y = document.documentElement.scrollTop;
- scrOf.X = document.documentElement.scrollLeft;
- }
- return scrOf;
-}
-
-
-
-(function($){
- $.fn.mbPopup = function(options){
- //default settings
- defaults = {
- left:0,top:0,width:300,height:250,
- title:"",frameName:"",
- opacity:1.0,moveOpacity:0.8,html:false,url:false,
- minWidth:false,maxWidth:false,
- minHeight:false,maxHeight:false,
- minTop:"document",minLeft:"document",
- maxRight:false,maxBottom:false,
- dragable:true,resizeable:true,balloon:false,
- style:null,destroy:true,modal:false,
- closeCallback:null
- };
- //override defaults
- settings=$.extend(defaults,options)
- this.settings = settings;
-
- //add Styles
- this.addClass("mbPopup");
-
- //append additions styles
- if(settings.style)
- this.css(settings.style);
-
- //automated settings for balloon popup
- if(settings.balloon){
- $("body").append("<div id='balloon_"+settings.id+"' class='balloonBL' style='visibility:hidden;'>");
- settings.resizeable = false;
- settings.dragable = false;
- }
-
- //calculate positioning (mainly needed for balloon style)
- pos = $.mbPopupFn.calcPositioning(settings, this);
-
- //set balloon arm position
- if(settings.balloon){
- $("#balloon_"+settings.id).attr("class", "balloon"+(pos.position>=2?"B":"T")+(pos.position%2?"R":"L"))
- .css({"z-index":(popup_top),visibility:"visible",left:String(pos.bX)+"px",top:String(pos.bY)+"px"});
- settings.left = pos.pX;
- settings.top = pos.pY;
- }
-
- //fix IE width and height by adding the padding values
- if($.browser.msie){
- settings.width = pos.pW;
- settings.height = pos.pH;
- }
-
- //Set dimensions
- this.css({top:String(settings.top)+"px",
- left:String(settings.left)+"px",
- width:String(settings.width)+"px",
- height:String(settings.height)+"px",
- opacity:settings.opacity
- });
-
- //Insert content
- if(settings.url)
- html = ('<iframe name="'+settings.frameName+'" src="'+settings.url+'"></iframe>');
- else
- html = ('<div class="scrollDiv">'+settings.html+'</div>');
-
- this.html('<div class="Title Drag"><h1>'+settings.title+'</h1></div><div class="Content">'+html+'</div><img src="../img/close_icon.png" class="Close" alt="close" />'+(settings.resizeable?'<div class="Resize" />':''));
-
- var data = {El:this,fY:settings.minTop,fX:settings.minLeft,tX:settings.maxRight,tY:settings.maxBottom,
- fW:settings.minWidth,tW:settings.maxWidth,fH:settings.minHeight,tH:settings.maxHeight,
- destroy:settings.destroy,opacity:settings.opacity,moveOpacity:settings.moveOpacity,close:settings.closeCallback}
-
- //Make window Dragable
- if(settings.dragable)
- $(".Drag", this).bind('mousedown',data,function(event){
- //set to top
- event.data.El.css("z-index",popup_top++);
- event.data.El.css('opacity',event.data.moveOpacity)
- //create helper div to steal mouse events
- $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top+2)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"mouse_catcher\"></div>");
- $("iframe", event.data.El).hide();
-
- //Parse setiings of min and max position
- var data = $.mbPopupFn.parseDimensions(event);
-
- //bind mouse events to popup
- $().bind("mousemove",$.extend(data,{drag:true}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
- });
-
- //Make Window resizable
- if(settings.resizeable)
- $(".Resize", this).bind('mousedown',data,function(event){
- //set to top
- event.data.El.css("z-index",popup_top++);
- event.data.El.css('opacity',event.data.moveOpacity)
- //create helper div to steal mouse events
- $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top+2)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"mouse_catcher\"></div>");
- $("iframe", event.data.El).hide();
-
- //Parse setiings of min and max position
- var data = $.mbPopupFn.parseDimensions(event);
-
- //bind mouse events to popup
- $().bind("mousemove",$.extend(data,{drag:false}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
- });
-
- //closeButton
- this.closePopup = function(event){
- if(event.data.close)
- event.data.close();
- $("#modal_mouse_catcher").remove();
- if(event.data.destroy){
- event.data.El.slideUp('slow', function(){$(this).remove();});
- $("#balloon_"+event.data.El.attr("id")).remove();
- }
- else{
- event.data.El.slideUp('slow');
- $("#balloon_"+event.data.El.attr("id")).fadeOut();
- }
- };
- $(".Close", this).bind('click',data, this.closePopup);
-
- //create div to make window modal
- if(settings.modal){
- $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top-1)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"modal_mouse_catcher\"></div>");
- $("#modal_mouse_catcher").bind('click',data, this.closePopup);
- }
-
- //raise on click
- this.click(function(){this.style.zIndex=popup_top++;$("#balloon_"+this.id).css("z-index", popup_top++);});
- $("#balloon_"+settings.id).click(function(){$("#"+this.id.substr(8)).css("z-index", popup_top++);this.style.zIndex=popup_top++;});
-
- //raise top postition
- popup_top++;
- };
- //helper functions
- $.mbPopupFn = {
- //on mouse action
- move:function(event){
- //drag
- if(event.data.drag){
- var newPos = {X:event.data.X+event.pageX-event.data.pX,
- Y:event.data.Y+event.pageY-event.data.pY};
- if(event.data.fX!==false&&newPos.X<event.data.fX)
- newPos.X=event.data.fX;
- if(event.data.fY!==false&&newPos.Y<event.data.fY)
- newPos.Y=event.data.fY;
- if(event.data.tX!==false&&newPos.X>event.data.tX-event.data.W)
- newPos.X=event.data.tX-event.data.W;
- if(event.data.tY!==false&&newPos.Y>event.data.tY-event.data.H)
- newPos.Y=event.data.tY-event.data.H;
-
- event.data.El.css({left:newPos.X,top:newPos.Y});
- return;
- }
- //resize
- var newDim = {W:Math.max(event.pageX-event.data.pX+event.data.W,0),
- H:Math.max(event.pageY-event.data.pY+event.data.H,0)};
- if(event.data.fW!==false&&newDim.W<event.data.fW)
- newDim.W=event.data.fW;
- if(event.data.fH!==false&&newDim.H<event.data.fH)
- newDim.H=event.data.fH;
- if(event.data.tW!==false&&newDim.W>event.data.tW)
- newDim.W=event.data.tW;
- if(event.data.tH!==false&&newDim.H>event.data.tH)
- newDim.H=event.data.tH;
- if(event.data.tX!==false&&newDim.W+event.data.X>event.data.tX)
- newDim.W=event.data.tX-event.data.X;
- if(event.data.tY!==false&&newDim.H+event.data.Y>event.data.tY)
- newDim.H=event.data.tY-event.data.Y;
-
- event.data.El.css({width:newDim.W,height:newDim.H});
-
- },
- stop:function(event){
- event.data.El.css('opacity',event.data.opacity)
- $("iframe", event.data.El).show();
- $().unbind('mousemove',$.mbPopupFn.move).unbind('mouseup',$.mbPopupFn.stop);
- $("#mouse_catcher").remove();
- },
- //parse move and resize dimensions
- parseDimensions:function(d){
- var dim = getScrollPos();
- var bd = {X:parseInt($(d.data.El).css("border-left-width"))+parseInt($(d.data.El).css("border-right-width")),
- Y:parseInt($(d.data.El).css("border-top-width"))+parseInt($(d.data.El).css("border-bottom-width"))};
- ret = {El:d.data.El,
- fX:(d.data.fX=="window"?dim.X:(d.data.fX=="document"?0:(d.data.fX<0?dim.dW-d.data.fX:d.data.fX))),
- fY:(d.data.fX=="window"?dim.Y:(d.data.fY=="document"?0:(d.data.fY<0?dim.dH-d.data.fY:d.data.fY))),
- tX:(d.data.tX=="window"?dim.X+dim.wW:(d.data.tX=="document"?dim.dW:(d.data.tX<0?dim.dW-d.data.tX:d.data.tX))),
- tY:(d.data.tY=="window"?dim.Y+dim.wH:(d.data.tY=="document"?dim.dH:(d.data.tH<0?dim.dH-d.data.tH:d.data.tY))),
- fW:(d.data.fW=="window"?dim.wW:(d.data.fW=="document"?dim.dW:(d.data.fW<0?dim.dW-d.data.fW:d.data.fW))),
- fH:(d.data.fH=="window"?dim.wH:(d.data.fH=="document"?dim.dH:(d.data.fH<0?dim.dH-d.data.fH:d.data.fH))),
- tW:(d.data.tW=="window"?dim.wW:(d.data.tW=="document"?dim.dW:(d.data.tW<0?dim.dW-d.data.tW:d.data.tW))),
- tH:(d.data.tH=="window"?dim.wH:(d.data.tH=="document"?dim.dH:(d.data.tH<0?dim.dH-d.data.tH:d.data.tH))),
- X:parseInt(d.data.El.css("left")),
- Y:parseInt(d.data.El.css("top")),
- W:parseInt(d.data.El.css("width")),
- H:parseInt(d.data.El.css("height")),
- pX:d.pageX,pY:d.pageY
- };
- if(ret.tX)ret.tX-=bd.X;
- if(ret.tY)ret.tY-=bd.Y;
- return ret;
- },
- calcPositioning:function(settings, el){
- var dim = getScrollPos();
-
- pos = {};
- pos.pH = settings.height + (parseInt(el.css("padding-top"))+parseInt(el.css("padding-bottom")));
- pos.pW = settings.width + (parseInt(el.css("padding-left"))+parseInt(el.css("padding-right")));
- if(settings.balloon){
- pos.bH = $("#balloon_"+settings.id).height();
- pos.bW = $("#balloon_"+settings.id).width();
-
- pos.position = 0;
-
- if(settings.top-pos.pH-pos.bH-parseInt(el.css("border-top-width"))<dim.Y){
- //bubble on top
- pos.pY = settings.top+pos.bH-parseInt(el.css("border-top-width"));
- }
- else{
- //bubble on bottom
- pos.pY = settings.top-pos.pH-pos.bH+($.browser.msie?parseInt(el.css("border-bottom-width")):-parseInt(el.css("border-top-width")));
- pos.position+=2;
- }
- if(settings.left+pos.pW+parseInt(el.css("border-left-width"))+parseInt(el.css("border-right-width"))>(dim.X+dim.wW)){
- //bubble on right
- pos.pX = settings.left-parseInt(el.css("border-left-width"))-parseInt(el.css("border-right-width"))-pos.pW;
- pos.position++;
- }
- else{
- //bubble on left
- pos.pX = settings.left-parseInt(el.css("border-left-width"));
- }
-
- pos.bX=(settings.left-(pos.position%2?pos.bW:0));
- pos.bY=(settings.top-(pos.position>=2?pos.bH:0));
- }
- return pos;
- }
- };
- })
-(jQuery);
Copied: branches/google_dev/trunk/http/javascripts/popup.js (from rev 3910, trunk/mapbender/http/javascripts/popup.js)
===================================================================
--- branches/google_dev/trunk/http/javascripts/popup.js (rev 0)
+++ branches/google_dev/trunk/http/javascripts/popup.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,560 @@
+/*
+* $Id$
+* COPYRIGHT: (C) 2002 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
+*/
+//http://www.mapbender.org/index.php/popup
+var popup_count = 1;
+var popup_top = 150;
+
+/**
+ * @class A class representing a popup window
+ *
+ * @constructor
+ * @param {String/Object} title the title text of the popup or Options object
+ * Elelemts of the options object (all optional):
+ * left: position left
+ * top: position top
+ * width: popup width
+ * height: popup height
+ * title: popup title
+ * frameName: name of the popups iframe if it loads a frame (recommended to set destroy to false)
+ * opacity: opacity of the frame default:1
+ * moveOpacity: opacity while the user moves or resizes the frame default:0.8
+ * html:content html of the frame (not parsed if url not false)
+ * url:content url of the frame
+ * minWidth: minimum width of the popup if the user resizes it
+ * maxWidth: maximum width of the popup if the user resizes it
+ * minHeight: minimum height of the popup if the user resizes it
+ * maxHeight: maximum height of the popup if the user resizes it
+ * minTop: minimum top position if the user moves the popup default:"document"
+ * minLeft: minimum left position if the user moves the popup default:"document"
+ * maxRight: maximum right position if the user moves/resizes the popup
+ * maxBottom: maximum bottom position if the user moves/resized the popup
+ * style: additional styles for the popup window
+ * destroy: remove dom of popup if user closes it (don't use it for iframes with framename) default:true
+ * closeCallback: function that is called if the user closes the window
+ * resizeable: allow user to change the size default:true
+ * dragable: allow user to move the window default:true
+ * balloon: balloon popup from top, left (disables resizeable and dragable)
+ * modal: create modal popup default:false
+ *
+ * @param {String} html the "body" of the popup, can also be "url:http://foo.de" to display a website
+ * @param {Number} width width of the popup
+ * @param {Number} height hight of the popup
+ * @param {Number} posx left position of the popup
+ * @param {Number} popy top posision of the popup
+ *
+ */
+function mb_popup(title,html,width,height,posx,posy,fName,opacity) {
+ //get first free place
+ var create_pos=popup_count;
+ for(var i = 0; i < popup_count;i++)
+ if(!document.getElementById("popup"+String(i))){
+ create_pos=i;
+ break;
+ }
+
+ this.id="popup"+String(++popup_top);
+
+ //Set defaults
+ defaults = {
+ left:25*create_pos,
+ top:25*create_pos,
+ width:300,height:250,
+ title:"Title",
+ frameName:this.id,
+ id:this.id
+ };
+
+ if(typeof(title)!='object'){
+ this.options = defaults;
+
+ //Set vars
+ if(posx)this.options.left=posx;
+ if(posy)this.options.top=posy;
+ if(width)this.options.width=width;
+ if(height)this.options.height=height;
+ if(title)this.options.title=title;
+ if(fName)this.options.frameName=fName;
+ if(opacity)this.options.opacity;
+ if(html){
+ if(html.indexOf("url:")==0)
+ this.options.url=html.substr(4);
+ else
+ this.options.html=html;
+ }
+ }
+ else
+ this.options=$.extend(defaults, title);
+
+ this.id = this.options.id;
+
+ popup_count++;
+
+ //create dom popup
+ $("body").append("<div style=\"display:none;z-index:"+popup_top+"\" id=\""+this.id+"\"></div>");
+ this.div = $("#"+this.id).mbPopup(this.options);
+}
+
+/**
+ * Shows the popup
+ */
+mb_popup.prototype.show = function(){
+ if(!document.getElementById(this.id)){
+ //(re)create dom popup
+ $("body").append("<div style=\"display:none;z-index:"+popup_top+"\" id=\""+this.id+"\"></div>");
+ this.div = $("#"+this.id).mbPopup(this.options);
+ }
+ if(!this.isVisible())
+ $("#"+this.id).show();
+}
+
+/**
+ * Hides the popup
+ */
+mb_popup.prototype.hide = function(){
+ $("#"+this.id).hide();
+ $("#balloon_"+this.id).hide();
+ $("#modal_mouse_catcher").remove();
+}
+
+/**
+ * Hides the popup
+ */
+mb_popup.prototype.destroy = function(){
+ $("#"+this.id).remove();
+ $("#balloon_"+this.id).remove();
+ $("#modal_mouse_catcher").remove();
+}
+
+/**
+ * sets the width of the popup window
+ *
+ * @param {Number} width new width of the popup
+ */
+mb_popup.prototype.setWidth = function(width){
+ var div=document.getElementById(this.id);
+ if(div)div.style.width=width;
+}
+
+/**
+ * sets the height of the popup window
+ *
+ * @param {Number} height new height of the popup
+ */
+mb_popup.prototype.setHeight = function(height){
+ var div=document.getElementById(this.id);
+ if(div)div.style.height=height;
+}
+
+/**
+ * sets the left position of the popup window
+ *
+ * @param {Number} left new left position of the popup
+ */
+mb_popup.prototype.setLeft = function(left){
+ var div=document.getElementById(this.id);
+ if(div)div.style.left=left;
+}
+
+/**
+ * sets the top position of the popup window
+ *
+ * @param {Number} top new top position of the popup
+ */
+mb_popup.prototype.setTop = function(topp){
+ var div=document.getElementById(this.id);
+ if(div)div.style.top=topp;
+}
+
+/**
+ * sets the opacity of the popup window
+ *
+ * @param {Number} opacity new opacity value of the popup
+ */
+mb_popup.prototype.setOpacity = function(opacityy){
+ var div=document.getElementById(this.id);
+ if(div)div.style.opacity=opacityy;
+}
+
+/**
+ * sets the title of the popup window
+ *
+ * @param {String} title new title text of the popup
+ */
+mb_popup.prototype.setTitle = function(title){
+ $("#"+this.id+" h1").text(title);
+}
+
+/**
+ * sets the html content of the popup window
+ *
+ * @param {String} html new html "body" of the popup
+ */
+mb_popup.prototype.setHtml = function(htmll){
+ this.options.url=null;
+ this.options.html=htmll;
+ $("#"+this.id+" .Content").html('<div class="scrollDiv">'+htmll+'</div>');
+}
+/**
+ * behaves like document.open(); (clear popup)
+ */
+mb_popup.prototype.open = function(){
+ oDoc = this.getDocument();
+ if(oDoc!=null){
+ return oDoc.open();
+ }
+ this.setHtml("");
+}
+
+/**
+ * behaves like document.write(); (appends content to the popup)
+ *
+ * @param {String} text or html to write into the document
+ */
+mb_popup.prototype.write = function(str){
+ oDoc = this.getDocument();
+ if(oDoc!=null){
+ return oDoc.write(str);
+ }
+ this.setHtml(this.options.html+str);
+}
+
+/**
+ * behaves like document.close(); (finish loading state if popup is an iframe)
+ */
+mb_popup.prototype.close = function(){
+ oDoc = this.getDocument();
+ if(oDoc!=null){
+ return oDoc.close();
+ }
+}
+
+/**
+ * sets the url of the content
+ *
+ * @param {String} url new url of the popup
+ */
+mb_popup.prototype.setUrl = function(url){
+ this.options.url=url;
+ this.options.html=null;
+
+ oDoc = this.getDocument();
+ if(oDoc){
+ oDoc.location.href = url;
+ }
+ else{
+ $("#"+this.id+" .Content").html('<iframe src="'+url+'"></iframe>');
+ }
+}
+
+/**
+ * reposition
+ */
+mb_popup.prototype.reposition =function(){
+//TODO
+}
+
+/**
+ * gets the visible state of the popup window
+ * @return visible state of the popup
+ * @type Boolean
+ */
+mb_popup.prototype.isVisible = function(){
+ return $("#"+this.id+":visible").length>0?true:false;
+}
+
+/**
+ * (re) set Some Options of the popup Window and rerender it
+ * @param options object that contains the new options
+ */
+mb_popup.prototype.set = function(options){
+ this.destroy();
+ this.options=$.extend(this.options, options);
+ this.show();
+}
+
+/**
+ * get the DOM document of the client iframe
+ * @return DOM document or null if the popup doesn't contain an iframe
+ */
+mb_popup.prototype.getDocument = function(){
+ iFrame = $("#"+this.id+" iframe")[0];
+ try{
+ //try to load contentWindow first since not every browser
+ //supports contentDocument (or gives the window instead)
+ oDoc = iFrame.contentWindow || iFrame.contentDocument;
+ if (oDoc.document) {
+ oDoc = oDoc.document;
+ }
+ return oDoc;
+ }
+ catch(e){return null;}
+}
+
+/**
+ * get Scroll position
+ */
+function getScrollPos() {
+ var scrOf ={X:0,Y:0,wW:$(window).width(),dW:$().width(),wH:$(window).height(),dH:$().height()};
+
+ if( typeof( window.pageYOffset ) == 'number' ) {
+ //Netscape compliant
+ scrOf.Y = window.pageYOffset;
+ scrOf.X = window.pageXOffset;
+ } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
+ //DOM compliant
+ scrOf.Y = document.body.scrollTop;
+ scrOf.X = document.body.scrollLeft;
+ } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
+ //IE6 standards compliant mode
+ scrOf.Y = document.documentElement.scrollTop;
+ scrOf.X = document.documentElement.scrollLeft;
+ }
+ return scrOf;
+}
+
+
+
+(function($){
+ $.fn.mbPopup = function(options){
+ //default settings
+ defaults = {
+ left:0,top:0,width:300,height:250,
+ title:"",frameName:"",
+ opacity:1.0,moveOpacity:0.8,html:false,url:false,
+ minWidth:false,maxWidth:false,
+ minHeight:false,maxHeight:false,
+ minTop:"document",minLeft:"document",
+ maxRight:false,maxBottom:false,
+ dragable:true,resizeable:true,balloon:false,
+ style:null,destroy:true,modal:false,
+ closeCallback:null
+ };
+ //override defaults
+ settings=$.extend(defaults,options)
+ this.settings = settings;
+
+ //add Styles
+ this.addClass("mbPopup");
+
+ //append additions styles
+ if(settings.style)
+ this.css(settings.style);
+
+ //automated settings for balloon popup
+ if(settings.balloon){
+ $("body").append("<div id='balloon_"+settings.id+"' class='balloonBL' style='visibility:hidden;'>");
+ settings.resizeable = false;
+ settings.dragable = false;
+ }
+
+ //calculate positioning (mainly needed for balloon style)
+ pos = $.mbPopupFn.calcPositioning(settings, this);
+
+ //set balloon arm position
+ if(settings.balloon){
+ $("#balloon_"+settings.id).attr("class", "balloon"+(pos.position>=2?"B":"T")+(pos.position%2?"R":"L"))
+ .css({"z-index":(popup_top),visibility:"visible",left:String(pos.bX)+"px",top:String(pos.bY)+"px"});
+ settings.left = pos.pX;
+ settings.top = pos.pY;
+ }
+
+ //fix IE width and height by adding the padding values
+ if($.browser.msie){
+ settings.width = pos.pW;
+ settings.height = pos.pH;
+ }
+
+ //Set dimensions
+ this.css({top:String(settings.top)+"px",
+ left:String(settings.left)+"px",
+ width:String(settings.width)+"px",
+ height:String(settings.height)+"px",
+ opacity:settings.opacity
+ });
+
+ //Insert content
+ if(settings.url)
+ html = ('<iframe name="'+settings.frameName+'" width="' + settings.width + '" height="' +settings.height + '" src="'+settings.url+'"></iframe>');
+ else
+ html = ('<div class="scrollDiv">'+settings.html+'</div>');
+
+ this.html('<div class="Title Drag"><h1>'+settings.title+'</h1></div><div class="Content">'+html+'</div><img src="../img/close_icon.png" class="Close" alt="close" />'+(settings.resizeable?'<div class="Resize" />':''));
+
+ var data = {El:this,fY:settings.minTop,fX:settings.minLeft,tX:settings.maxRight,tY:settings.maxBottom,
+ fW:settings.minWidth,tW:settings.maxWidth,fH:settings.minHeight,tH:settings.maxHeight,
+ destroy:settings.destroy,opacity:settings.opacity,moveOpacity:settings.moveOpacity,close:settings.closeCallback}
+
+ //Make window Dragable
+ if(settings.dragable)
+ $(".Drag", this).bind('mousedown',data,function(event){
+ //set to top
+ event.data.El.css("z-index",popup_top++);
+ event.data.El.css('opacity',event.data.moveOpacity)
+ //create helper div to steal mouse events
+ $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top+2)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"mouse_catcher\"></div>");
+ $("iframe", event.data.El).hide();
+
+ //Parse setiings of min and max position
+ var data = $.mbPopupFn.parseDimensions(event);
+
+ //bind mouse events to popup
+ $().bind("mousemove",$.extend(data,{drag:true}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
+ });
+
+ //Make Window resizable
+ if(settings.resizeable)
+ $(".Resize", this).bind('mousedown',data,function(event){
+ //set to top
+ event.data.El.css("z-index",popup_top++);
+ event.data.El.css('opacity',event.data.moveOpacity)
+ //create helper div to steal mouse events
+ $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top+2)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"mouse_catcher\"></div>");
+ $("iframe", event.data.El).hide();
+
+ //Parse setiings of min and max position
+ var data = $.mbPopupFn.parseDimensions(event);
+
+ //bind mouse events to popup
+ $().bind("mousemove",$.extend(data,{drag:false}),$.mbPopupFn.move).bind('mouseup',event.data,$.mbPopupFn.stop);
+ });
+
+ //closeButton
+ this.closePopup = function(event){
+ if(event.data.close)
+ event.data.close();
+ $("#modal_mouse_catcher").remove();
+ if(event.data.destroy){
+ event.data.El.slideUp('slow', function(){$(this).remove();});
+ $("#balloon_"+event.data.El.attr("id")).remove();
+ }
+ else{
+ event.data.El.slideUp('slow');
+ $("#balloon_"+event.data.El.attr("id")).fadeOut();
+ }
+ };
+ $(".Close", this).bind('click',data, this.closePopup);
+
+ //create div to make window modal
+ if(settings.modal){
+ $("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top-1)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"modal_mouse_catcher\"></div>");
+ $("#modal_mouse_catcher").bind('click',data, this.closePopup);
+ }
+
+ //raise on click
+ this.click(function(){this.style.zIndex=popup_top++;$("#balloon_"+this.id).css("z-index", popup_top++);});
+ $("#balloon_"+settings.id).click(function(){$("#"+this.id.substr(8)).css("z-index", popup_top++);this.style.zIndex=popup_top++;});
+
+ //raise top postition
+ popup_top++;
+ };
+ //helper functions
+ $.mbPopupFn = {
+ //on mouse action
+ move:function(event){
+ //drag
+ if(event.data.drag){
+ var newPos = {X:event.data.X+event.pageX-event.data.pX,
+ Y:event.data.Y+event.pageY-event.data.pY};
+ if(event.data.fX!==false&&newPos.X<event.data.fX)
+ newPos.X=event.data.fX;
+ if(event.data.fY!==false&&newPos.Y<event.data.fY)
+ newPos.Y=event.data.fY;
+ if(event.data.tX!==false&&newPos.X>event.data.tX-event.data.W)
+ newPos.X=event.data.tX-event.data.W;
+ if(event.data.tY!==false&&newPos.Y>event.data.tY-event.data.H)
+ newPos.Y=event.data.tY-event.data.H;
+
+ event.data.El.css({left:newPos.X,top:newPos.Y});
+ return;
+ }
+ //resize
+ var newDim = {W:Math.max(event.pageX-event.data.pX+event.data.W,0),
+ H:Math.max(event.pageY-event.data.pY+event.data.H,0)};
+ if(event.data.fW!==false&&newDim.W<event.data.fW)
+ newDim.W=event.data.fW;
+ if(event.data.fH!==false&&newDim.H<event.data.fH)
+ newDim.H=event.data.fH;
+ if(event.data.tW!==false&&newDim.W>event.data.tW)
+ newDim.W=event.data.tW;
+ if(event.data.tH!==false&&newDim.H>event.data.tH)
+ newDim.H=event.data.tH;
+ if(event.data.tX!==false&&newDim.W+event.data.X>event.data.tX)
+ newDim.W=event.data.tX-event.data.X;
+ if(event.data.tY!==false&&newDim.H+event.data.Y>event.data.tY)
+ newDim.H=event.data.tY-event.data.Y;
+
+ event.data.El.css({width:newDim.W,height:newDim.H});
+
+ },
+ stop:function(event){
+ event.data.El.css('opacity',event.data.opacity)
+ $("iframe", event.data.El).show();
+ $().unbind('mousemove',$.mbPopupFn.move).unbind('mouseup',$.mbPopupFn.stop);
+ $("#mouse_catcher").remove();
+ },
+ //parse move and resize dimensions
+ parseDimensions:function(d){
+ var dim = getScrollPos();
+ var bd = {X:parseInt($(d.data.El).css("border-left-width"))+parseInt($(d.data.El).css("border-right-width")),
+ Y:parseInt($(d.data.El).css("border-top-width"))+parseInt($(d.data.El).css("border-bottom-width"))};
+ ret = {El:d.data.El,
+ fX:(d.data.fX=="window"?dim.X:(d.data.fX=="document"?0:(d.data.fX<0?dim.dW-d.data.fX:d.data.fX))),
+ fY:(d.data.fX=="window"?dim.Y:(d.data.fY=="document"?0:(d.data.fY<0?dim.dH-d.data.fY:d.data.fY))),
+ tX:(d.data.tX=="window"?dim.X+dim.wW:(d.data.tX=="document"?dim.dW:(d.data.tX<0?dim.dW-d.data.tX:d.data.tX))),
+ tY:(d.data.tY=="window"?dim.Y+dim.wH:(d.data.tY=="document"?dim.dH:(d.data.tH<0?dim.dH-d.data.tH:d.data.tY))),
+ fW:(d.data.fW=="window"?dim.wW:(d.data.fW=="document"?dim.dW:(d.data.fW<0?dim.dW-d.data.fW:d.data.fW))),
+ fH:(d.data.fH=="window"?dim.wH:(d.data.fH=="document"?dim.dH:(d.data.fH<0?dim.dH-d.data.fH:d.data.fH))),
+ tW:(d.data.tW=="window"?dim.wW:(d.data.tW=="document"?dim.dW:(d.data.tW<0?dim.dW-d.data.tW:d.data.tW))),
+ tH:(d.data.tH=="window"?dim.wH:(d.data.tH=="document"?dim.dH:(d.data.tH<0?dim.dH-d.data.tH:d.data.tH))),
+ X:parseInt(d.data.El.css("left")),
+ Y:parseInt(d.data.El.css("top")),
+ W:parseInt(d.data.El.css("width")),
+ H:parseInt(d.data.El.css("height")),
+ pX:d.pageX,pY:d.pageY
+ };
+ if(ret.tX)ret.tX-=bd.X;
+ if(ret.tY)ret.tY-=bd.Y;
+ return ret;
+ },
+ calcPositioning:function(settings, el){
+ var dim = getScrollPos();
+
+ pos = {};
+ pos.pH = settings.height + (parseInt(el.css("padding-top"))+parseInt(el.css("padding-bottom")));
+ pos.pW = settings.width + (parseInt(el.css("padding-left"))+parseInt(el.css("padding-right")));
+ if(settings.balloon){
+ pos.bH = $("#balloon_"+settings.id).height();
+ pos.bW = $("#balloon_"+settings.id).width();
+
+ pos.position = 0;
+
+ if(settings.top-pos.pH-pos.bH-parseInt(el.css("border-top-width"))<dim.Y){
+ //bubble on top
+ pos.pY = settings.top+pos.bH-parseInt(el.css("border-top-width"));
+ }
+ else{
+ //bubble on bottom
+ pos.pY = settings.top-pos.pH-pos.bH+($.browser.msie?parseInt(el.css("border-bottom-width")):-parseInt(el.css("border-top-width")));
+ pos.position+=2;
+ }
+ if(settings.left+pos.pW+parseInt(el.css("border-left-width"))+parseInt(el.css("border-right-width"))>(dim.X+dim.wW)){
+ //bubble on right
+ pos.pX = settings.left-parseInt(el.css("border-left-width"))-parseInt(el.css("border-right-width"))-pos.pW;
+ pos.position++;
+ }
+ else{
+ //bubble on left
+ pos.pX = settings.left-parseInt(el.css("border-left-width"));
+ }
+
+ pos.bX=(settings.left-(pos.position%2?pos.bW:0));
+ pos.bY=(settings.top-(pos.position>=2?pos.bH:0));
+ }
+ return pos;
+ }
+ };
+ })
+(jQuery);
Modified: branches/google_dev/trunk/http/javascripts/wms.js
===================================================================
--- trunk/mapbender/http/javascripts/wms.js 2009-04-16 08:29:50 UTC (rev 3887)
+++ branches/google_dev/trunk/http/javascripts/wms.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -167,7 +167,7 @@
rq += "&WIDTH=" + mapObj.getWidth();
rq += "&HEIGHT=" + mapObj.getHeight();
rq += "&SRS=" + mapObj.getSRS();
- rq += "&BBOX=" + mapObj.getExtent();
+ rq += "&BBOX=" + mapObj.extent.toString();
rq += "&STYLES=" + this.getLayerstyles(mapObj).join(",");
rq += "&FORMAT=" + this.gui_wms_mapformat;
rq += "&EXCEPTIONS=" + this.gui_wms_exceptionformat;
@@ -209,7 +209,7 @@
rq += "&WIDTH=" + mapObj.getWidth();
rq += "&HEIGHT=" + mapObj.getHeight();
rq += "&SRS=" + mapObj.getSRS();
- rq += "&BBOX=" + mapObj.getExtent();
+ rq += "&BBOX=" + mapObj.extent.toString();
rq += "&STYLES=" + this.getLayerstyles(mapObj).join(",");
rq += "&FORMAT=" + this.gui_wms_mapformat;
rq += "&INFO_FORMAT=" + this.gui_wms_featureinfoformat;
Copied: branches/google_dev/trunk/http/php (from rev 3883, trunk/mapbender/http/php)
Modified: branches/google_dev/trunk/http/php/mb_validateSession.php
===================================================================
--- trunk/mapbender/http/php/mb_validateSession.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mb_validateSession.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -19,7 +19,6 @@
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
$e = new mb_notice("mb_validateSession.php: checking file " . $_SERVER["PHP_SELF"]);
//
@@ -27,7 +26,7 @@
//
if (!isset($_SESSION["mb_user_id"]) ||
!isset($_SESSION["mb_user_ip"]) ||
- $_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']) {
+ $_SESSION['mb_user_ip'] != getRealIpAddr()) {
$e = new mb_exception("mb_validateSession.php: Invalid user: " . $_SESSION["mb_user_id"]);
header("Location: " . LOGIN);
Modified: branches/google_dev/trunk/http/php/mod_changeEPSG_dynamic.php
===================================================================
--- trunk/mapbender/http/php/mod_changeEPSG_dynamic.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_changeEPSG_dynamic.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -188,14 +188,24 @@
}
else{
parent.mb_mapObj[ind].epsg = temp[1];
- parent.mb_mapObj[ind].extent = parseFloat(temp[2]) + "," + parseFloat(temp[3]) + "," + parseFloat(temp[4]) + "," + parseFloat(temp[5]);
+ parent.mb_mapObj[ind].extent = new parent.Extent(
+ parseFloat(temp[2]),
+ parseFloat(temp[3]),
+ parseFloat(temp[4]),
+ parseFloat(temp[5])
+ );
parent.setMapRequest(temp[0]);
}
}
if(temp[0] != myTarget){
var ind = parent.getMapObjIndexByName(temp[0]);
parent.mb_mapObj[ind].epsg = temp[1];
- parent.mb_mapObj[ind].extent = parseFloat(temp[2]) + "," + parseFloat(temp[3]) + "," + parseFloat(temp[4]) + "," + parseFloat(temp[5]);
+ parent.mb_mapObj[ind].extent = new parent.Extent(
+ parseFloat(temp[2]),
+ parseFloat(temp[3]),
+ parseFloat(temp[4]),
+ parseFloat(temp[5])
+ );
parent.setMapRequest(temp[0]);
}
}
@@ -215,7 +225,7 @@
str_srs = "";
for(var i=0; i<parent.mb_mapObj.length; i++){
if(i>0){str_srs += "###";}
- str_srs += parent.mb_mapObj[i].frameName + "," + parent.mb_mapObj[i].epsg + "," + parent.mb_mapObj[i].extent + ","+parent.mb_mapObj[i].width+","+parent.mb_mapObj[i].height;
+ str_srs += parent.mb_mapObj[i].frameName + "," + parent.mb_mapObj[i].epsg + "," + parent.mb_mapObj[i].extent.toString() + ","+parent.mb_mapObj[i].width+","+parent.mb_mapObj[i].height;
}
document.forms[0].srs.value = str_srs;
var ind = document.forms[0].epsg.selectedIndex;
Deleted: branches/google_dev/trunk/http/php/mod_loadwmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_loadwmc_server.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_loadwmc_server.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,178 +0,0 @@
-<?php
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_user.php");
-require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-require_once(dirname(__FILE__) . "/../classes/class_json.php");
-require_once(dirname(__FILE__) . "/../classes/class_administration.php");
-
-/**
- * encodes and delivers the data
- *
- * @param object the un-encoded object
- */
-function sendOutput($out){
- global $json;
- $output = $json->encode($out);
- if (CHARSET == "ISO-8859-1") {
- $output = utf8_decode($output);
- }
- header("Content-Type: text/x-json");
- echo $output;
-}
-
-/**
- * Get all available WMC documents from the database
- *
- * @return mixed[] an array of wmcs
- * (wmc = assoc. array of "id", "title", "timestamp")
- */
-function getWmc(){
- global $con;
- global $userId;
-
- $wmcArray = array();
-
- // get WMC ids
- $currentUser = new User($userId);
- $wmcIdArray = $currentUser->getWmcByOwner();
-
- // get WMC data
- $v = array();
- $t = array();
- $wmcIdList = "";
-
- for ($i = 0; $i < count($wmcIdArray); $i++) {
- if ($i > 0) {
- $wmcIdList .= ",";
- }
- $wmcIdList .= "$".($i+1);
- array_push($v, $wmcIdArray[$i]);
- array_push($t, 's');
- }
-
- $sql = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp " .
- "FROM mb_user_wmc WHERE wmc_id IN (" . $wmcIdList . ") " .
- "ORDER BY wmc_timestamp DESC";
-
- $res = db_prep_query($sql, $v, $t);
- while($row = db_fetch_array($res)){
- $currentResult = array();
- $currentResult["id"] = $row["wmc_id"];
- $currentResult["title"] = administration::convertIncomingString($row["wmc_title"]);
- $currentResult["timestamp"] = date("M d Y H:i:s", $row["wmc_timestamp"]);
- array_push($wmcArray, $currentResult);
- }
- return $wmcArray;
-}
-
-$json = new Mapbender_JSON();
-$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
-$resultObj = array();
-
-$e = new mb_exception("command: " . $queryObj->command);
-
-$wmc = new wmc();
-$userId = $_SESSION[mb_user_id];
-
-switch($queryObj->command){
-
- // gets available WMCs
- case 'getWmc':
- $resultObj["wmc"] = getWmc();
- break;
-
- // gets XML document of a WMC
- case 'getWmcDocument':
- $wmcId = $queryObj->parameters->id;
- $doc = $wmc->getDocument($wmcId);
- if (!$doc) {
- $resultObj["error"] = "The WMC document could not be found.";
- }
- else {
- $resultObj["wmc"] = array("document" => $doc);
- }
- break;
-
- // deletes a WMC
- case 'deleteWmc':
- $wmcId = $queryObj->parameters->id;
- if ($wmc->delete($wmcId)) {
- $resultObj["success"] = "WMC has been deleted from the database.";
- }
- else {
- $resultObj["error"] = "WMC could not be deleted.";
- }
- break;
-
- // loads a WMC (returns array of JS code)
- case 'loadWmc':
- $wmcId = $queryObj->parameters->id;
- $wmc->createFromDb($wmcId);
- $jsArray = $wmc->toJavaScript();
- if ($jsArray) {
- $resultObj["javascript"] = $jsArray;
- }
- else {
- $resultObj["error"] = "WMC could not be loaded.";
- }
- break;
-
- // merges data with WMC and loads it (returns array of JS code)
- case 'mergeWmc':
- $params = $queryObj->parameters;
-
- // generate a WMC for the current client state
- $currentWmc = new wmc();
- $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
-
- // get the desired WMC from the database
- $wmcId = $queryObj->parameters->id;
- $wmcXml = wmc::getDocument($wmcId);
-
- // merge the two WMCs
- $currentWmc->merge($wmcXml);
-
- // load the merged WMC
- $jsArray = $currentWmc->toJavaScript();
-
- if (is_array($jsArray) && count($jsArray) > 0) {
- $resultObj["javascript"] = $jsArray;
- }
- else {
- $resultObj["error"] = "WMC could not be loaded.";
- }
- break;
-
- // appends a WMC (returns JS code)
- case 'appendWmc':
- $params = $queryObj->parameters;
- // generate a WMC for the current client state
- $currentWmc = new wmc();
- $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
-
- // get the desired WMC from the database
- $wmcId = $queryObj->parameters->id;
- $wmcXml = wmc::getDocument($wmcId);
-
- // merge the two WMCs
- $currentWmc->append($wmcXml);
-
- // load the merged WMC
- $jsArray = $currentWmc->toJavaScript();
-
- if (is_array($jsArray) && count($jsArray) > 0) {
- $resultObj["javascript"] = $jsArray;
- }
- else {
- $resultObj["error"] = "WMC could not be appended.";
- }
- break;
-
-
- // Invalid command
- default:
- $resultObj["error"] = "no action specified...";
-}
-
-sendOutput($resultObj);
-?>
Copied: branches/google_dev/trunk/http/php/mod_loadwmc_server.php (from rev 3914, trunk/mapbender/http/php/mod_loadwmc_server.php)
===================================================================
--- branches/google_dev/trunk/http/php/mod_loadwmc_server.php (rev 0)
+++ branches/google_dev/trunk/http/php/mod_loadwmc_server.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,180 @@
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+
+/**
+ * encodes and delivers the data
+ *
+ * @param object the un-encoded object
+ */
+function sendOutput($out){
+ global $json;
+ $output = $json->encode($out);
+ if (CHARSET == "ISO-8859-1") {
+ $output = utf8_decode($output);
+ }
+ header("Content-Type: text/x-json");
+ echo $output;
+}
+
+/**
+ * Get all available WMC documents from the database
+ *
+ * @return mixed[] an array of wmcs
+ * (wmc = assoc. array of "id", "title", "timestamp")
+ */
+function getWmc(){
+ global $con;
+ global $userId;
+
+ $wmcArray = array();
+
+ // get WMC ids
+ $currentUser = new User($userId);
+ $wmcIdArray = $currentUser->getWmcByOwner();
+
+ // get WMC data
+ $v = array();
+ $t = array();
+ $wmcIdList = "";
+
+ for ($i = 0; $i < count($wmcIdArray); $i++) {
+ if ($i > 0) {
+ $wmcIdList .= ",";
+ }
+ $wmcIdList .= "$".($i+1);
+ array_push($v, $wmcIdArray[$i]);
+ array_push($t, 's');
+ }
+
+ if ($wmcIdList !== "") {
+ $sql = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp FROM mb_user_wmc ";
+ $sql .= "WHERE wmc_id IN (" . $wmcIdList . ") ";
+ $sql .= "ORDER BY wmc_timestamp DESC";
+
+ $res = db_prep_query($sql, $v, $t);
+ while($row = db_fetch_array($res)){
+ $currentResult = array();
+ $currentResult["id"] = $row["wmc_id"];
+ $currentResult["title"] = administration::convertIncomingString($row["wmc_title"]);
+ $currentResult["timestamp"] = date("M d Y H:i:s", $row["wmc_timestamp"]);
+ array_push($wmcArray, $currentResult);
+ }
+ }
+ return $wmcArray;
+}
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$wmc = new wmc();
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+ // gets available WMCs
+ case 'getWmc':
+ $resultObj["wmc"] = getWmc();
+ break;
+
+ // gets XML document of a WMC
+ case 'getWmcDocument':
+ $wmcId = $queryObj->parameters->id;
+ $doc = $wmc->getDocument($wmcId);
+ if (!$doc) {
+ $resultObj["error"] = "The WMC document could not be found.";
+ }
+ else {
+ $resultObj["wmc"] = array("document" => $doc);
+ }
+ break;
+
+ // deletes a WMC
+ case 'deleteWmc':
+ $wmcId = $queryObj->parameters->id;
+ if ($wmc->delete($wmcId)) {
+ $resultObj["success"] = "WMC has been deleted from the database.";
+ }
+ else {
+ $resultObj["error"] = "WMC could not be deleted.";
+ }
+ break;
+
+ // loads a WMC (returns array of JS code)
+ case 'loadWmc':
+ $wmcId = $queryObj->parameters->id;
+ $wmc->createFromDb($wmcId);
+ $jsArray = $wmc->toJavaScript();
+ if ($jsArray) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be loaded.";
+ }
+ break;
+
+ // merges data with WMC and loads it (returns array of JS code)
+ case 'mergeWmc':
+ $params = $queryObj->parameters;
+
+ // generate a WMC for the current client state
+ $currentWmc = new wmc();
+ $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+ // get the desired WMC from the database
+ $wmcId = $queryObj->parameters->id;
+ $wmcXml = wmc::getDocument($wmcId);
+
+ // merge the two WMCs
+ $currentWmc->merge($wmcXml);
+
+ // load the merged WMC
+ $jsArray = $currentWmc->toJavaScript();
+
+ if (is_array($jsArray) && count($jsArray) > 0) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be loaded.";
+ }
+ break;
+
+ // appends a WMC (returns JS code)
+ case 'appendWmc':
+ $params = $queryObj->parameters;
+ // generate a WMC for the current client state
+ $currentWmc = new wmc();
+ $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+ // get the desired WMC from the database
+ $wmcId = $queryObj->parameters->id;
+ $wmcXml = wmc::getDocument($wmcId);
+
+ // merge the two WMCs
+ $currentWmc->append($wmcXml);
+
+ // load the merged WMC
+ $jsArray = $currentWmc->toJavaScript();
+
+ if (is_array($jsArray) && count($jsArray) > 0) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be appended.";
+ }
+ break;
+
+
+ // Invalid command
+ default:
+ $resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
+?>
Modified: branches/google_dev/trunk/http/php/mod_mapOV.php
===================================================================
--- trunk/mapbender/http/php/mod_mapOV.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_mapOV.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -85,7 +85,7 @@
function mod_ov_showMapExtent(){
for(var i=0; i<parent.mb_mapObj.length; i++){
if(parent.mb_mapObj[i].frameName == mod_overview_target){
- var arrayBBox = parent.mb_mapObj[i].extent.split(",");
+ var arrayBBox = parent.mb_mapObj[i].extent.toString().split(",");
var minX = parseFloat(arrayBBox[0]);
var minY = parseFloat(arrayBBox[1]);
var maxX = parseFloat(arrayBBox[2]);
Modified: branches/google_dev/trunk/http/php/mod_meetingPoint.php
===================================================================
--- trunk/mapbender/http/php/mod_meetingPoint.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_meetingPoint.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -264,7 +264,7 @@
my_meetingPoint += "&mb_user_myGui=" + encodeURIComponent(document.forms[0].mygui.value);
var ind = parent.getMapObjIndexByName('mapframe1');
- var coord = parent.mb_mapObj[ind].extent.split(",");
+ var coord = parent.mb_mapObj[ind].extent.toString().split(",");
my_meetingPoint += "&mb_myBBOX=" + parseFloat(coord[0]) + ",";
my_meetingPoint += parseFloat(coord[1]) + ",";
Deleted: branches/google_dev/trunk/http/php/mod_savewmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_savewmc_server.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_savewmc_server.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,50 +0,0 @@
-<?php
-#$Id: mod_insertWmcIntoDb.php 1198 2007-10-18 14:37:52Z baudson $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_wmc.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-$json = new Mapbender_JSON();
-
-// get data from POST and SESSION
-$mapObject = $json->decode(stripslashes($_POST["mapObject"]));
-$userId = $_SESSION["mb_user_id"];
-$saveInSession = intval($_POST["saveInSession"]);
-$generalTitle = $_POST["generalTitle"];
-$extensionData = $json->decode(stripslashes($_POST["extensionData"]));
-
-// create WMC object
-$wmc = new wmc();
-$wmc->createFromJs($mapObject, $generalTitle, $extensionData);
-
-if ($saveInSession === 1) {
- // store XML in session
- $_SESSION["mb_wmc"] = $wmc->xml;
- $_SESSION["epsg"] = $mapObject->epsg;
- $_SESSION["previous_gui"] = $_SESSION["mb_user_gui"];
- $e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
-}
-else {
- // insert WMC into database
- $result = $wmc->insert();
- echo $result["message"];
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/http/php/mod_savewmc_server.php (from rev 3913, trunk/mapbender/http/php/mod_savewmc_server.php)
===================================================================
--- branches/google_dev/trunk/http/php/mod_savewmc_server.php (rev 0)
+++ branches/google_dev/trunk/http/php/mod_savewmc_server.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,52 @@
+<?php
+#$Id: mod_insertWmcIntoDb.php 1198 2007-10-18 14:37:52Z baudson $
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_wmc.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$json = new Mapbender_JSON();
+
+// get data from POST and SESSION
+$mapObject = $json->decode(stripslashes($_POST["mapObject"]));
+$userId = $_SESSION["mb_user_id"];
+$saveInSession = intval($_POST["saveInSession"]);
+$generalTitle = $_POST["generalTitle"];
+$extensionData = $json->decode(stripslashes($_POST["extensionData"]));
+
+// create WMC object
+$wmc = new wmc();
+$wmc->createFromJs($mapObject, $generalTitle, $extensionData);
+
+header("Content-Type: text/x-json");
+
+if ($saveInSession === 1) {
+ // store XML in session
+ $_SESSION["mb_wmc"] = $wmc->xml;
+ $_SESSION["epsg"] = $mapObject->epsg;
+ $_SESSION["previous_gui"] = $_SESSION["mb_user_gui"];
+ $e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
+}
+else {
+ // insert WMC into database
+ $result = $wmc->insert();
+ echo $result["message"];
+}
+?>
Modified: branches/google_dev/trunk/http/php/mod_wfs.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_wfs.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -25,6 +25,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title>mod_wfs</title>
<script language='JavaScript' type='text/javascript'>
+
var wfs_conf = new Array();
/*
function register(){
Modified: branches/google_dev/trunk/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs_gazetteer_server.php 2009-04-16 08:08:54 UTC (rev 3883)
+++ branches/google_dev/trunk/http/php/mod_wfs_gazetteer_server.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -100,6 +100,19 @@
$output = $json->encode($obj->confArray);
echo $output;
}
+elseif ($command == "getWfsConfsForThisApplication") {
+
+ $user = new User($_SESSION["mb_user_id"]);
+
+ // get all WFS conf IDs for this application
+ $availableWfsConfIds = $user->getWfsConfByPermission($_SESSION["gui_id"]);
+
+ $obj = new WfsConf();
+ $obj->load($availableWfsConfIds);
+ $json = new Mapbender_JSON();
+ $output = $json->encode($obj->confArray);
+ echo $output;
+}
else if ($command == "getSearchResults") {
$wfs_conf_id = $_REQUEST["wfs_conf_id"];
$backlink = $_REQUEST["backlink"];
Deleted: branches/google_dev/trunk/http/print/mod_printPDF.php
===================================================================
--- trunk/mapbender/http/print/mod_printPDF.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/print/mod_printPDF.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,401 +0,0 @@
-<?php
-# $Id: mod_printPDF.php
-# http://www.mapbender.org/index.php/mod_printPDF.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="pragma" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <?php printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />",CHARSET); ?>
- <title>Print PDF</title>
-
- <?php
- //FIXME:
- //setlocale(LC_ALL, "de_DE.utf8");
-
- require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-
- printf("
- <script type=\"text/javascript\">
- var target = '%s';
- var comment1 = '%s';
- var comment1_length = %s;
- var comment2 = '%s';
- var comment2_length = %s;
- var label_button = '%s';
- var type = '%s';
- </script>",
- $_REQUEST["target"],$label_comment1,$comment1_length,$label_comment2,$comment2_length,$label_button,$type
- );
- ?>
-
- <script type="text/javascript">
- <!--
- var size;
- var format;
- var map_width;
- var map_height;
-
- if(type=='window'){
- var pt = window.opener;
- }
- else if(type == 'iframe'){
- var pt = parent;
- }
-
- function mod_legend_print(){
- var mod_legend_target = target;
- var ind = pt.getMapObjIndexByName(mod_legend_target);
- var layers;
-
- document.forms[0].layers.value = "";
- document.forms[0].wms_id.value = "";
- document.forms[0].wms_title.value = "";
- document.forms[0].legendurl.value = "";
-
- for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
- layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
- if(layers != "" && layers){
-
- if(i>0 && document.forms[0].wms_id.value!=''){
- document.forms[0].layers.value += "___";
- document.forms[0].wms_id.value += "___";
- document.forms[0].wms_title.value += "___";
- document.forms[0].legendurl.value += "___";
- }
-
- document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;
- document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
-
- for(var j=0; j<layers.length; j++){
- var layer = layers[j];
- var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
- var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
- if(layerStyle==false){
- var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");
- }
- else{
- var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
- }
-
- //---------- legendurl ----------
- tmp_name = "";
- if(j>0){
- document.forms[0].layers.value += ",";
- }
- document.forms[0].layers.value += title;
- if(j>0){
- document.forms[0].legendurl.value += ",";
- }
- if (temp_legendurl!= '' || !temp_legendurl == 'true'){
- document.forms[0].legendurl.value += temp_legendurl;
- }else{
- document.forms[0].legendurl.value +='0';
- }
- }
- }
- else{
- if(i>0 && document.forms[0].wms_id.value!=''){
- document.forms[0].layers.value += "___";
- document.forms[0].wms_id.value += "___";
- document.forms[0].wms_title.value += "___";
- document.forms[0].legendurl.value += "___";
- }
-
- document.forms[0].layers.value += "0";
- document.forms[0].wms_id.value += "0";
- document.forms[0].wms_title.value += "0";
- document.forms[0].legendurl.value += "0";
- }
- }//for
- //alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);
-
- }
-
- function validate(){
- size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
- format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
-
- if(size != "false" && format != "false"){
- var ind = pt.getMapObjIndexByName(target);
- var map_el = pt.mb_mapObj[ind].getDomElement();
- var coord = pt.mb_mapObj[ind].extent.split(",");
- var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
- var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
- if(size == "A4" && format == "portrait"){
- map_width = <?php echo $a4p_map_width; ?>;
- map_height = <?php echo $a4p_map_height; ?>;
- }
- if(size == "A4" && format == "landscape"){
- map_width = <?php echo $a4l_map_width; ?>;
- map_height = <?php echo $a4l_map_height; ?>;
- }
- if(size == "A3" && format == "portrait"){
- map_width = <?php echo $a3p_map_width; ?>;
- map_height = <?php echo $a3p_map_height; ?>;
- }
- if(size == "A3" && format == "landscape"){
- map_width = <?php echo $a3l_map_width; ?>;
- map_height = <?php echo $a3l_map_height; ?>;
- }
- if(size == "A2" && format == "portrait"){
- map_width = <?php echo $a2p_map_width; ?>;
- map_height = <?php echo $a2p_map_height; ?>;
- }
- if(size == "A2" && format == "landscape"){
- map_width = <?php echo $a2l_map_width; ?>;
- map_height = <?php echo $a2l_map_height; ?>;
- }
- if(size == "A1" && format == "portrait"){
- map_width = <?php echo $a1p_map_width; ?>;
- map_height = <?php echo $a1p_map_height; ?>;
- }
- if(size == "A1" && format == "landscape"){
- map_width = <?php echo $a1l_map_width; ?>;
- map_height = <?php echo $a1l_map_height; ?>;
- }
- if(size == "A0" && format == "portrait"){
- map_width = <?php echo $a0p_map_width; ?>;
- map_height = <?php echo $a0p_map_height; ?>;
- }
- if(size == "A0" && format == "landscape"){
- map_width = <?php echo $a0l_map_width; ?>;
- map_height = <?php echo $a0l_map_height; ?>;
- }
- var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
- var prevscale= pt.mb_getScale(target);
- console.log(prevscale);
- pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," + coord[3];
-
- pt.mb_mapObj[ind].width = Math.round(map_width);
- pt.mb_mapObj[ind].height = Math.round(map_height);
- map_el.style.width = Math.round(map_width);
- map_el.style.height = Math.round(map_height);
-
- //pt.setMapRequest(target);
-// pt.mb_repaintScale(target, null, null, prevscale);
- pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
- document.form1.map_url.value = '';
- for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
- if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
- if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
- if(document.form1.map_url.value != ""){
- document.form1.map_url.value += "___";
- }
- document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
- }
- }
- }
-
- //overview_url
- var ind_overview = pt.getMapObjIndexByName('overview');
-
- //alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
- if(pt.mb_mapObj[ind_overview].mapURL != false ){
- document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
- }
- }
- }
- function refreshParams(){
- var f = document.forms[0];
- size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
- format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
-
- if(size != "" && format != ""){
- var ind = pt.getMapObjIndexByName(target);
- var map_el = pt.mb_mapObj[ind].getDomElement();
- var coord = pt.mb_mapObj[ind].extent.split(",");
- var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
- var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
-
- var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
- pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," + coord[3];
-
- pt.mb_mapObj[ind].width = Math.round(map_width);
- pt.mb_mapObj[ind].height = Math.round(map_height);
- map_el.style.width = Math.round(map_width);
- map_el.style.height = Math.round(map_height);
-
- //pt.setMapRequest(target);
-// pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
- pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
- f.map_url.value = '';
- for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
- if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
- if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
- if(f.map_url.value != ""){
- f.map_url.value += "___";
- }
- f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
- }
- }
- }
-
- //overview_url
- var ind_overview = pt.getMapObjIndexByName('overview');
-
- //alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
- if(pt.mb_mapObj[ind_overview].mapURL != false ){
- f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
- }
- }
-
- f.map_scale.value = pt.mb_getScale(target);
- f.epsg.value = pt.mb_mapObj[ind].epsg;
-
- mod_legend_print();
- }
- function printMap(){
- if(size != "false" && (format == "portrait" || format == "landscape")){
- refreshParams();
- if(document.form1.c1.value != comment1){
- document.form1.comment1.value = document.form1.c1.value;
- }
- if(document.form1.c2.value != comment2){
- document.form1.comment2.value = document.form1.c2.value;
- }
- if(document.form1.mylegendcheckbox.checked == 0){
- document.form1.mylegend.value = 'false';
- }else{
- document.form1.mylegend.value = 'true';
- }
-
- // write the measured coordinates
-
- if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
- var tmp_x = '';
- var tmp_y = '';
- for(i = 0; i<pt.mod_measure_RX.length; i++) {
- if(tmp_x != '') {
- tmp_x += ','
- }
- tmp_x += pt.mod_measure_RX[i];
- }
- for(i = 0; i<pt.mod_measure_RY.length; i++) {
- if(tmp_y != '') {
- tmp_y += ','
- }
- tmp_y += pt.mod_measure_RY[i];
- }
- document.forms['form1'].elements['measured_x_values'].value = tmp_x;
- document.forms['form1'].elements['measured_y_values'].value = tmp_y;
- }
-
- document.form1.submit();
- }
- else{
- alert('<?php echo _mb("No format selected")."!"?>');
- }
- }
-
- function checkCommentLength(obj,maxLength){
- if(obj.value.length > maxLength){
- obj.value = obj.value.substr(0,maxLength);
- }
- }
- -->
- </script>
- <?php include("../include/dyn_css.php"); ?>
-</head>
-
-<body>
-<form name="form1" method="post" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
-<p id="container_size">
- <label for="size"><?php echo $label_format ?></label>
- <select id="size" name="size" onchange="validate();">
- <option value="false">-</option>
- <?php
- for($i = 4; $i >= 0; $i--) {
- if(${"a".$i}) {
- printf("<option value=\"A%s\">%s</option>",$i,${"label_format_a".$i});
- }
- }
- ?>
- </select>
-</p>
-
-<p id="container_orientation">
- <label for="format"><?php echo $label_orientation; ?></label>
- <select id="format" name="format" onchange="validate();">
- <option value="portrait"><?php echo $label_portrait; ?></option>
- <option value="landscape"><?php echo $label_landscape; ?></option>
- </select>
-</p>
-
-<?php if($highquality === TRUE): ?>
- <p id="container_quality">
- <label for="quality"><?php echo $label_quality; ?></label>
- <input type="radio" id="quality" name="quality" value="1" checked="checked" /> <?php echo $label_72dpi; ?>
- <input type="radio" id="quality" name="quality" value="2" /> <?php echo $label_288dpi; ?>
- </p>
-<?php endif; ?>
-
-<?php
-ini_set("error_reporting",E_ALL);
-ini_set("display_errors","on");
- for($i = 1; $i <= 2; $i++) {
- $max_comment_length = ${"comment".$i."_length"};
- $label_hint = ($max_comment_length > -1) ? sprintf(" <em>"._mb("max.")." %s)</em>",$max_comment_length) : NULL;
- $javascript = ($max_comment_length > -1) ? sprintf(" onblur=\"checkCommentLength(this,%s)\"",$max_comment_length) : NULL;
-
- $html = sprintf("<p id=\"container_comment%s\">",$i);
- $html .= sprintf("<label for=\"c%s\">%s%s</label> ",$i,${"label_comment".$i},$label_hint);
- $html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ",$i,$i,$javascript);
- $html .= "</p>";
-
- echo $html;
- }
-?>
-
-<?php if($legend === TRUE): ?>
- <p id="container_legend">
- <label for="mylegendcheckbox"><?php echo $label_legend; ?></label>
- <input type="checkbox" id="mylegendcheckbox" name="mylegendcheckbox" value="false" />
- </p>
-<?php else: ?>
- <input type="hidden" name="mylegendcheckbox" value="false" />
-<?php endif; ?>
-
-<input type="hidden" name="map_url" />
-<input type="hidden" name="overview_url" />
-<input type="hidden" name="wms_title" />
-<input type="hidden" name="wms_id" />
-<input type="hidden" name="layers" />
-<input type="hidden" name="legendurl" />
-<input type="hidden" name="map_scale" />
-<input type="hidden" name="epsg" />
-<input type="hidden" name="conf" value="<?php echo $_REQUEST["conf"]; ?>" />
-<input type="hidden" name="comment1" />
-<input type="hidden" name="comment2" />
-<input type="hidden" name="mylegend" value="true" >
-<input type="hidden" name="measured_x_values" />
-<input type="hidden" name="measured_y_values" />
-
-<p>
- <input type="button" id="print" name="print" value="<?php echo $label_button; ?>" onclick="printMap();" />
-</p>
-</form>
-</body>
-
-</html>
Copied: branches/google_dev/trunk/http/print/mod_printPDF.php (from rev 3740, trunk/mapbender/http/print/mod_printPDF.php)
===================================================================
--- branches/google_dev/trunk/http/print/mod_printPDF.php (rev 0)
+++ branches/google_dev/trunk/http/print/mod_printPDF.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,410 @@
+<?php
+# $Id: mod_printPDF.php
+# http://www.mapbender.org/index.php/mod_printPDF.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="pragma" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <?php printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />",CHARSET); ?>
+ <title>Print PDF</title>
+
+ <?php
+ //FIXME:
+ //setlocale(LC_ALL, "de_DE.utf8");
+
+ require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+
+ printf("
+ <script type=\"text/javascript\">
+ var target = '%s';
+ var comment1 = '%s';
+ var comment1_length = %s;
+ var comment2 = '%s';
+ var comment2_length = %s;
+ var label_button = '%s';
+ var type = '%s';
+ </script>",
+ $_REQUEST["target"],$label_comment1,$comment1_length,$label_comment2,$comment2_length,$label_button,$type
+ );
+ ?>
+
+ <script type="text/javascript">
+ <!--
+ var size;
+ var format;
+ var map_width;
+ var map_height;
+
+ if(type=='window'){
+ var pt = window.opener;
+ }
+ else if(type == 'iframe'){
+ var pt = parent;
+ }
+
+ function mod_legend_print(){
+ var mod_legend_target = target;
+ var ind = pt.getMapObjIndexByName(mod_legend_target);
+ var layers;
+
+ document.forms[0].layers.value = "";
+ document.forms[0].wms_id.value = "";
+ document.forms[0].wms_title.value = "";
+ document.forms[0].legendurl.value = "";
+
+ for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+ layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
+ if(layers != "" && layers){
+
+ if(i>0 && document.forms[0].wms_id.value!=''){
+ document.forms[0].layers.value += "___";
+ document.forms[0].wms_id.value += "___";
+ document.forms[0].wms_title.value += "___";
+ document.forms[0].legendurl.value += "___";
+ }
+
+ document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;
+ document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
+
+ for(var j=0; j<layers.length; j++){
+ var layer = layers[j];
+ var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
+ var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
+ if(layerStyle==false){
+ var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");
+ }
+ else{
+ var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
+ }
+
+ //---------- legendurl ----------
+ tmp_name = "";
+ if(j>0){
+ document.forms[0].layers.value += ",";
+ }
+ document.forms[0].layers.value += title;
+ if(j>0){
+ document.forms[0].legendurl.value += ",";
+ }
+ if (temp_legendurl!= '' || !temp_legendurl == 'true'){
+ document.forms[0].legendurl.value += temp_legendurl;
+ }else{
+ document.forms[0].legendurl.value +='0';
+ }
+ }
+ }
+ else{
+ if(i>0 && document.forms[0].wms_id.value!=''){
+ document.forms[0].layers.value += "___";
+ document.forms[0].wms_id.value += "___";
+ document.forms[0].wms_title.value += "___";
+ document.forms[0].legendurl.value += "___";
+ }
+
+ document.forms[0].layers.value += "0";
+ document.forms[0].wms_id.value += "0";
+ document.forms[0].wms_title.value += "0";
+ document.forms[0].legendurl.value += "0";
+ }
+ }//for
+ //alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);
+
+ }
+
+ function validate(){
+ size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+ format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+
+ if(size != "false" && format != "false"){
+ var ind = pt.getMapObjIndexByName(target);
+ var map_el = pt.mb_mapObj[ind].getDomElement();
+ var coord = pt.mb_mapObj[ind].extent.toString().split(",");
+ var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+ var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+ if(size == "A4" && format == "portrait"){
+ map_width = <?php echo $a4p_map_width; ?>;
+ map_height = <?php echo $a4p_map_height; ?>;
+ }
+ if(size == "A4" && format == "landscape"){
+ map_width = <?php echo $a4l_map_width; ?>;
+ map_height = <?php echo $a4l_map_height; ?>;
+ }
+ if(size == "A3" && format == "portrait"){
+ map_width = <?php echo $a3p_map_width; ?>;
+ map_height = <?php echo $a3p_map_height; ?>;
+ }
+ if(size == "A3" && format == "landscape"){
+ map_width = <?php echo $a3l_map_width; ?>;
+ map_height = <?php echo $a3l_map_height; ?>;
+ }
+ if(size == "A2" && format == "portrait"){
+ map_width = <?php echo $a2p_map_width; ?>;
+ map_height = <?php echo $a2p_map_height; ?>;
+ }
+ if(size == "A2" && format == "landscape"){
+ map_width = <?php echo $a2l_map_width; ?>;
+ map_height = <?php echo $a2l_map_height; ?>;
+ }
+ if(size == "A1" && format == "portrait"){
+ map_width = <?php echo $a1p_map_width; ?>;
+ map_height = <?php echo $a1p_map_height; ?>;
+ }
+ if(size == "A1" && format == "landscape"){
+ map_width = <?php echo $a1l_map_width; ?>;
+ map_height = <?php echo $a1l_map_height; ?>;
+ }
+ if(size == "A0" && format == "portrait"){
+ map_width = <?php echo $a0p_map_width; ?>;
+ map_height = <?php echo $a0p_map_height; ?>;
+ }
+ if(size == "A0" && format == "landscape"){
+ map_width = <?php echo $a0l_map_width; ?>;
+ map_height = <?php echo $a0l_map_height; ?>;
+ }
+ var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+ var prevscale= pt.mb_getScale(target);
+ pt.mb_mapObj[ind].extent = new Extent(
+ parseFloat(coord[0]),
+ parseFloat(pos[1]),
+ parseFloat(pos[0]),
+ parseFloat(coord[3])
+ );
+
+ pt.mb_mapObj[ind].width = Math.round(map_width);
+ pt.mb_mapObj[ind].height = Math.round(map_height);
+ map_el.style.width = Math.round(map_width);
+ map_el.style.height = Math.round(map_height);
+
+ //pt.setMapRequest(target);
+// pt.mb_repaintScale(target, null, null, prevscale);
+ pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
+ document.form1.map_url.value = '';
+ for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+ if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+ if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
+ if(document.form1.map_url.value != ""){
+ document.form1.map_url.value += "___";
+ }
+ document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+ }
+ }
+ }
+
+ //overview_url
+ var ind_overview = pt.getMapObjIndexByName('overview');
+
+ //alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+ if(pt.mb_mapObj[ind_overview].mapURL != false ){
+ document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+ }
+ }
+ }
+ function refreshParams(){
+ var f = document.forms[0];
+ size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+ format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+
+ if(size != "" && format != ""){
+ var ind = pt.getMapObjIndexByName(target);
+ var map_el = pt.mb_mapObj[ind].getDomElement();
+ var coord = pt.mb_mapObj[ind].extent.toString().split(",");
+ var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+ var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+
+ var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+ pt.mb_mapObj[ind].extent = new pt.Extent(
+ parseFloat(coord[0]),
+ parseFloat(pos[1]),
+ parseFloat(pos[0]),
+ parseFloat(coord[3])
+ );
+
+ pt.mb_mapObj[ind].width = Math.round(map_width);
+ pt.mb_mapObj[ind].height = Math.round(map_height);
+ map_el.style.width = Math.round(map_width);
+ map_el.style.height = Math.round(map_height);
+
+ //pt.setMapRequest(target);
+// pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+ pt.mb_repaint(target, parseFloat(coord[0]), pos[1], pos[0], parseFloat(coord[3]));
+ f.map_url.value = '';
+ for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+ if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+ if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
+ if(f.map_url.value != ""){
+ f.map_url.value += "___";
+ }
+ f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+ }
+ }
+ }
+
+ //overview_url
+ var ind_overview = pt.getMapObjIndexByName('overview');
+
+ //alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+ if(pt.mb_mapObj[ind_overview].mapURL != false ){
+ f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+ }
+ }
+
+ f.map_scale.value = pt.mb_getScale(target);
+ f.epsg.value = pt.mb_mapObj[ind].epsg;
+
+ mod_legend_print();
+ }
+ function printMap(){
+ if(size != "false" && (format == "portrait" || format == "landscape")){
+ refreshParams();
+ if(document.form1.c1.value != comment1){
+ document.form1.comment1.value = document.form1.c1.value;
+ }
+ if(document.form1.c2.value != comment2){
+ document.form1.comment2.value = document.form1.c2.value;
+ }
+ if(document.form1.mylegendcheckbox.checked == 0){
+ document.form1.mylegend.value = 'false';
+ }else{
+ document.form1.mylegend.value = 'true';
+ }
+
+ // write the measured coordinates
+
+ if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
+ var tmp_x = '';
+ var tmp_y = '';
+ for(i = 0; i<pt.mod_measure_RX.length; i++) {
+ if(tmp_x != '') {
+ tmp_x += ','
+ }
+ tmp_x += pt.mod_measure_RX[i];
+ }
+ for(i = 0; i<pt.mod_measure_RY.length; i++) {
+ if(tmp_y != '') {
+ tmp_y += ','
+ }
+ tmp_y += pt.mod_measure_RY[i];
+ }
+ document.forms['form1'].elements['measured_x_values'].value = tmp_x;
+ document.forms['form1'].elements['measured_y_values'].value = tmp_y;
+ }
+
+ document.form1.submit();
+ }
+ else{
+ alert('<?php echo _mb("No format selected")."!"?>');
+ }
+ }
+
+ function checkCommentLength(obj,maxLength){
+ if(obj.value.length > maxLength){
+ obj.value = obj.value.substr(0,maxLength);
+ }
+ }
+ -->
+ </script>
+ <?php include("../include/dyn_css.php"); ?>
+</head>
+
+<body>
+<form name="form1" method="post" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
+<p id="container_size">
+ <label for="size"><?php echo $label_format ?></label>
+ <select id="size" name="size" onchange="validate();">
+ <option value="false">-</option>
+ <?php
+ for($i = 4; $i >= 0; $i--) {
+ if(${"a".$i}) {
+ printf("<option value=\"A%s\">%s</option>",$i,${"label_format_a".$i});
+ }
+ }
+ ?>
+ </select>
+</p>
+
+<p id="container_orientation">
+ <label for="format"><?php echo $label_orientation; ?></label>
+ <select id="format" name="format" onchange="validate();">
+ <option value="portrait"><?php echo $label_portrait; ?></option>
+ <option value="landscape"><?php echo $label_landscape; ?></option>
+ </select>
+</p>
+
+<?php if($highquality === TRUE): ?>
+ <p id="container_quality">
+ <label for="quality"><?php echo $label_quality; ?></label>
+ <input type="radio" id="quality" name="quality" value="1" checked="checked" /> <?php echo $label_72dpi; ?>
+ <input type="radio" id="quality" name="quality" value="2" /> <?php echo $label_288dpi; ?>
+ </p>
+<?php endif; ?>
+
+<?php
+ini_set("error_reporting",E_ALL);
+ini_set("display_errors","on");
+ for($i = 1; $i <= 2; $i++) {
+ $max_comment_length = ${"comment".$i."_length"};
+ $label_hint = ($max_comment_length > -1) ? sprintf(" <em>"._mb("max.")." %s)</em>",$max_comment_length) : NULL;
+ $javascript = ($max_comment_length > -1) ? sprintf(" onblur=\"checkCommentLength(this,%s)\"",$max_comment_length) : NULL;
+
+ $html = sprintf("<p id=\"container_comment%s\">",$i);
+ $html .= sprintf("<label for=\"c%s\">%s%s</label> ",$i,${"label_comment".$i},$label_hint);
+ $html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ",$i,$i,$javascript);
+ $html .= "</p>";
+
+ echo $html;
+ }
+?>
+
+<?php if($legend === TRUE): ?>
+ <p id="container_legend">
+ <label for="mylegendcheckbox"><?php echo $label_legend; ?></label>
+ <input type="checkbox" id="mylegendcheckbox" name="mylegendcheckbox" value="false" />
+ </p>
+<?php else: ?>
+ <input type="hidden" name="mylegendcheckbox" value="false" />
+<?php endif; ?>
+
+<input type="hidden" name="map_url" />
+<input type="hidden" name="overview_url" />
+<input type="hidden" name="wms_title" />
+<input type="hidden" name="wms_id" />
+<input type="hidden" name="layers" />
+<input type="hidden" name="legendurl" />
+<input type="hidden" name="map_scale" />
+<input type="hidden" name="epsg" />
+<input type="hidden" name="conf" value="<?php echo $_REQUEST["conf"]; ?>" />
+<input type="hidden" name="comment1" />
+<input type="hidden" name="comment2" />
+<input type="hidden" name="mylegend" value="true" >
+<input type="hidden" name="measured_x_values" />
+<input type="hidden" name="measured_y_values" />
+
+<p>
+ <input type="button" id="print" name="print" value="<?php echo $label_button; ?>" onclick="printMap();" />
+</p>
+</form>
+</body>
+
+</html>
Deleted: branches/google_dev/trunk/http/print/mod_printPDF_pdf.php
===================================================================
--- trunk/mapbender/http/print/mod_printPDF_pdf.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/http/print/mod_printPDF_pdf.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,850 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-include (dirname(__FILE__)."/../classes/class.ezpdf.php");
-include (dirname(__FILE__)."/../classes/class_stripRequest.php");
-include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
-include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
-include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
-include (dirname(__FILE__)."/../print/print_functions.php");
-
-if($log == true){
- include (dirname(__FILE__)."/../classes/class_log.php");
-}
-
-#Globals
-
-$factor = intval($_REQUEST["quality"]);
-
-#$date = date("d.m.Y",strtotime("now"));
-$linewidth_dashed = 0.5;
-$linewidth = 0.5;
-
-// DURATION TIME:
-function microtime_float(){
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
-}
-$time_start = microtime_float();
-// END DURATION TIME
-
-$time_end = microtime_float();
-$time = $time_end - $time_start;
-
-/* -------------------------------------- */
-
-$size = $_REQUEST["size"];
-$format = $_REQUEST["format"];
-$map_scale = $_REQUEST["map_scale"];
-$overview_url = $_REQUEST["overview_url"];
-$epsg = $_REQUEST["epsg"];
-if($overview_url=='false'){
- $overview = false;
-}
-
-function setscalebar($scale){
- $mb_resolution = 28.35;
-
- if($scale < 16){
- $value = "10";
- $unit = "cm";
- $scalefactor = 10/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale >= 16 && $scale < 151){
- $value = "1";
- $unit = "Meter";
- $scalefactor = 100/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale >= 151 && $scale < 1550 ){
- $value = "10";
- $unit = "Meter";
- $scalefactor = 1000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale >= 1550 && $scale < 15050){
- $value = "100";
- $unit = "Meter";
- $scalefactor = 10000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale < 150050 && $scale >= 15050){
- $value = "1";
- $unit = "Kilometer";
- $scalefactor = 100000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale < 1500050 && $scale >= 150050){
- $value = "10";
- $unit = "Kilometer";
- $scalefactor = 1000000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale < 15000050 && $scale >= 1500050){
- $value = "100";
- $unit = "Kilometer";
- $scalefactor = 10000000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale < 150000001 && $scale >= 15000001){
- $value = "1000";
- $unit = "Kilometer";
- $scalefactor = 100000000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- if($scale >= 150000001){
- $value = "1000";
- $unit = "Kilometer";
- $scalefactor = 100000000/$scale;
- $img_width = round($scalefactor * $mb_resolution);
- }
- $array_scale[0] = $unit;
- $array_scale[1] = $img_width;
- $array_scale[2] = $value;
-
- return $array_scale;
-}
-
-
-$border = 0.8 * $DPC;
-
-if($matching == true){
- $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);
-}
-else{
- $urls = $_REQUEST["map_url"];
-}
-
-
-$array_urls = explode("___", $urls);
-
-$myURL = new stripRequest($array_urls[0]);
-$map_width = round($myURL->get("width"));
-$map_height = round($myURL->get("height"));
-$map_extent = $myURL->get("BBOX");
-if($factor>1){
- for($i=0; $i<count($array_urls); $i++){
- $m = new stripRequest($array_urls[$i]);
- $m->set('width',(intval($m->get('width'))*4));
- $m->set('height',(intval($m->get('height'))*4));
- if(in_array($m->get('map'),$highqualitymapfiles)){
- $m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));
- }
- $array_urls[$i] = $m->url;
- }
-}
-$coord = mb_split(",",$map_extent);
-
-if($overview === true){
- // analyse overview url and draw rectangle with position
- $o_url = new stripRequest($overview_url);
- $overview_width = round($o_url->get("width"));
- $overview_height = round($o_url->get("height"));
-
- if($factor>1){
- $o_url->set('width',(intval($o_url->get('width'))*4));
- $o_url->set('height',(intval($o_url->get('height'))*4));
- if(in_array($o_url->get('map'),$highqualitymapfiles)){
- $o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));
- $overview_url = $o_url->url;
- }
- }
-
- if($matching == true){
- $overview_url = preg_replace($pattern,$replacement,$overview_url);
- }
-
-
- if ($size == "A4" && $format == "portrait"){
- $overview_left = $a4p_overviewOffset_left;
- $overview_bottom =$a4p_overviewOffset_bottom;
- }elseif ($size == "A4" && $format == "landscape"){
- $overview_left = $a4l_overviewOffset_left;
- $overview_bottom =$a4l_overviewOffset_bottom;
- }elseif ($size == "A3" && $format == "portrait"){
- $overview_left = $a3p_overviewOffset_left;
- $overview_bottom =$a3p_overviewOffset_bottom;
- }elseif ($size == "A3" && $format == "landscape"){
- $overview_left = $a3l_overviewOffset_left;
- $overview_bottom = $a3l_overviewOffset_bottom;
- }elseif ($size == "A2" && $format == "portrait"){
- $overview_left = $a2p_overviewOffset_left;
- $overview_bottom =$a2p_overviewOffset_bottom;
- }elseif ($size == "A2" && $format == "landscape"){
- $overview_left = $a2l_overviewOffset_left;
- $overview_bottom = $a2l_overviewOffset_bottom;
- }elseif ($size == "A1" && $format == "portrait"){
- $overview_left = $a1p_overviewOffset_left;
- $overview_bottom =$a1p_overviewOffset_bottom;
- }elseif ($size == "A1" && $format == "landscape"){
- $overview_left = $a1l_overviewOffset_left;
- $overview_bottom = $a1l_overviewOffset_bottom;
- }elseif ($size == "A0" && $format == "portrait"){
- $overview_left = $a0p_overviewOffset_left;
- $overview_bottom =$a0p_overviewOffset_bottom;
- }elseif ($size == "A0" && $format == "landscape"){
- $overview_left = $a0l_overviewOffset_left;
- $overview_bottom = $a0l_overviewOffset_bottom;
- }
-
- $o_extent = $o_url->get("BBOX");
-
- $array_overview_url[0] = $overview_url;
- if($log == true){
- $l = new log("printPDF_overview",$array_overview_url);
- }
-
- /*
- $o_new = new stripRequest($overview_url);
- $o_new->set('width',50);
- $o_new->set('height',50);
- //$o->set('BBOX',$overview_extent);
- $o_url_new =$o_new->url;
- $array_overview[0] = $overview_url;
- $array_overview[1] = $o_url;
- */
-}
-
-/*
- * north arrow
- */
-if($size == "A4" && $format == "portrait"){
- $northarrow_left = $a4p_northarrow_left;
- $northarrow_bottom = $a4p_northarrow_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
- $northarrow_left = $a4l_northarrow_left;
- $northarrow_bottom = $a4l_northarrow_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
- $northarrow_left = $a3p_northarrow_left;
- $northarrow_bottom = $a3p_northarrow_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
- $northarrow_left = $a3l_northarrow_left;
- $northarrow_bottom = $a3l_northarrow_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
- $northarrow_left = $a2p_northarrow_left;
- $northarrow_bottom = $a2p_northarrow_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
- $northarrow_left = $a2l_northarrow_left;
- $northarrow_bottom = $a2l_northarrow_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
- $northarrow_left = $a1p_northarrow_left;
- $northarrow_bottom = $a1p_northarrow_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
- $northarrow_left = $a1l_northarrow_left;
- $northarrow_bottom = $a1l_northarrow_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
- $northarrow_left = $a0p_northarrow_left;
- $northarrow_bottom = $a0p_northarrow_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
- $northarrow_left = $a0l_northarrow_left;
- $northarrow_bottom = $a0l_northarrow_bottom;
-}
-
-/*
- * special image
- */
-if ($size == "A4" && $format == "portrait"){
- $specialImage_left = $a4p_special_left;
- $specialImage_bottom = $a4p_special_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
- $specialImage_left = $a4l_special_left;
- $specialImage_bottom = $a4l_special_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
- $specialImage_left = $a3p_special_left;
- $specialImage_bottom = $a3p_special_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
- $specialImage_left = $a3l_special_left;
- $specialImage_bottom = $a3l_special_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
- $specialImage_left = $a2p_special_left;
- $specialImage_bottom = $a2p_special_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
- $specialImage_left = $a2l_special_left;
- $specialImage_bottom = $a2l_special_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
- $specialImage_left = $a1p_special_left;
- $specialImage_bottom = $a1p_special_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
- $specialImage_left = $a1l_special_left;
- $specialImage_bottom = $a1l_special_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
- $specialImage_left = $a0p_special_left;
- $specialImage_bottom = $a0p_special_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
- $specialImage_left = $a0l_special_left;
- $specialImage_bottom = $a0l_special_bottom;
-}
-
-if($log == true){
- $l = new log("printPDF",$array_urls);
-}
-$pdf = new Cezpdf();
-
-$pdf->Cezpdf(mb_strtolower($size),$format);
-$diff=array(196=>'Adieresis',228=>'adieresis',
- 214=>'Odieresis',246=>'odieresis',
- 220=>'Udieresis',252=>'udieresis',
- 223=>'germandbls');
-$pdf->selectFont('../classes/fonts/Helvetica.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
-if($size == "A4" && $format == "portrait"){
- $mapOffset_left = $a4p_mapOffset_left;
- $mapOffset_bottom = $a4p_mapOffset_bottom;
- $header_height = $a4p_header_height;
- $footer_height = $a4p_footer_height;
-}
-else{
- $mapOffset_left = $a4l_mapOffset_left;
- $mapOffset_bottom = $a4l_mapOffset_bottom;
- $header_height = $a4l_header_height;
- $header_width = $a4l_header_width;
-}
-session_write_close();
-$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
-
-$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
-if($unlink == true){
- unlink($filename);
-}
-
-/** ******************************************************************
-* user drawn elements
-*/
-
-$theMeasureConfigArray = array(
- "do_fill" => FALSE,
- "fill_color" => array(
- "r" => 128 / 255,
- "g" => 128 / 255,
- "b" => 128 / 255
- ),
- "do_stroke" => FALSE,
- "stroke_color" => array(
- "r" => 254 / 255,
- "g" => 1 / 255,
- "b" => 1 / 255
- ),
- "line_style" => array(
- "width" => 2,
- "cap" => 'butt',
- "join" => 'miter',
- "dash" => array(10, 6)
- )
- );
-
-if ($_REQUEST["measured_x_values"]!=''){
- addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
- hideElementsOutsideMapframe($pdf);
-}
-
-# dashed line
-$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
-
-
-#line
-$pdf->setLineStyle($linewidth, '', '', array());
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border);
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
-
-if($epsg == "EPSG:4326"){
-
- $text4 = "";
-}
-
-if($size == "A4" && $format == "portrait"){
- #header:
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height);
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
- $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom + $map_height + $border + $header_height);
- #header-text
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text1);
- $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
-
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text2);
- $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
-
- $length = $pdf->getTextWidth($mySize, $text3);
- $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
-
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text4);
- $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
-
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text5);
- $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
-
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text6);
- $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
- $length = $pdf->getTextWidth($mySize, $text7);
- $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
- $length = $pdf->getTextWidth($mySize, $text8);
- $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
- $length = $pdf->getTextWidth($mySize, $text9);
- $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
- $length = $pdf->getTextWidth($mySize, $text10);
- $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
-
- //special image on the map-page
- if ($special == true){
- $pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
- }
-
- #footer
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
-
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text11);
- $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
- $mySize = 6;
- $length = $pdf->getTextWidth($mySize, $text12);
- $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
- $length = $pdf->getTextWidth($mySize, $text13);
- $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
-}
-else{
- $pdf->setColor(1,1,1);
- $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
- $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
- $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
- $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
-
- $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2, $ll[1] + $header_height - 2);
- $pdf->line($ll[0] + 2, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
- $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
- $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
-
- $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
- $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
-
-
- //special image on the map-page
- if ($special == true){
- $pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
- }
-
- if($epsg == "EPSG:4326"){
-
- $text4 = "";
- }
-
- $pdf->setColor(0,0,0);
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text1);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
-
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text2);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
- $length = $pdf->getTextWidth($mySize, $text3);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text4);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text5);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);
-
- $mySize = 9;
- $length = $pdf->getTextWidth($mySize, $text6);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
- $length = $pdf->getTextWidth($mySize, $text7);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
- $length = $pdf->getTextWidth($mySize, $text8);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
- $length = $pdf->getTextWidth($mySize, $text9);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
- $length = $pdf->getTextWidth($mySize, $text10);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
-
- $mySize = 8;
- $length = $pdf->getTextWidth($mySize, $text11);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11);
- $mySize = 6;
- $length = $pdf->getTextWidth($mySize, $text14);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
- $length = $pdf->getTextWidth($mySize, $text15);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
- $length = $pdf->getTextWidth($mySize, $text16);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
- $length = $pdf->getTextWidth($mySize, $text17);
- $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);
-}
-#Coordinates
-$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
-$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
-$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
-$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
-
-$mySize = 9;
-$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMiny, -90);
-$pdf->addText($mapOffset_left, $mapOffset_bottom - ($pdf->getFontHeight($mySize)), $mySize, $myMinx);
-$pdf->addText($mapOffset_left + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height + 3, $mySize, $myMaxx);
-$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
-
-
-
-
-
-
-if ($overview==true){
- // analyse request, draw rectancle
- $filename = preg_replace("/map_/","overview_",$filename);
- if($size == "A4" && $format == "portrait"){
- $i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
-
- $pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
- if($unlink == true){
- unlink($filename);
- }
- }
- else{
- $i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
-
- //$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
- $pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
- if($unlink == true){
- unlink($filename);
- }
- }
-}
-
-if ($northarrow==true){
- $pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
-}
-
-if($epsg == "EPSG:4326"){
-
- $scalebar = false;
-}
-
-if($scalebar == true){
- if ($size == "A4" && $format == "portrait"){
- $scalebar_left = $a4p_scalebar_left;
- $scalebar_bottom = $a4p_scalebar_bottom;
- }elseif ($size == "A4" && $format == "landscape"){
- $scalebar_left = $a4l_scalebar_left;
- $scalebar_bottom = $a4l_scalebar_bottom;
- }elseif ($size == "A3" && $format == "portrait"){
- $scalebar_left = $a3p_scalebar_left;
- $scalebar_bottom = $a3p_scalebar_bottom;
- }elseif ($size == "A3" && $format == "landscape"){
- $scalebar_left = $a3l_scalebar_left;
- $scalebar_bottom = $a3l_scalebar_bottom;
- }elseif ($size == "A2" && $format == "portrait"){
- $scalebar_left = $a2p_scalebar_left;
- $scalebar_bottom = $a2p_scalebar_bottom;
- }elseif ($size == "A2" && $format == "landscape"){
- $scalebar_left = $a2l_scalebar_left;
- $scalebar_bottom = $a2l_scalebar_bottom;
- }elseif ($size == "A1" && $format == "portrait"){
- $scalebar_left = $a1p_scalebar_left;
- $scalebar_bottom = $a1p_scalebar_bottom;
- }elseif ($size == "A1" && $format == "landscape"){
- $scalebar_left = $a1l_scalebar_left;
- $scalebar_bottom = $a1l_scalebar_bottom;
- }elseif ($size == "A0" && $format == "portrait"){
- $scalebar_left = $a0p_scalebar_left;
- $scalebar_bottom = $a0p_scalebar_bottom;
- }elseif ($size == "A0" && $format == "landscape"){
- $scalebar_left = $a0l_scalebar_left;
- $scalebar_bottom = $a0l_scalebar_bottom;
- }
-
- $array_scalebar = setscalebar($map_scale);
-
- $scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
- $pdf->setLineStyle($scalebar_height, '','', array());
- $pdf->setColor(0,0,0);
- #$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
- $pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
-
- $pdf->setColor(1,1,1);
- $pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);
- $pdf->setColor(1,1,1);
- $pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);
-
-
- #$pdf->setColor(1,0,1);
- #$pdf->filledRectangle($scalebar_left , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);
-
-
- # value - Einheiten
- $pdf->setColor(0,0,0);
- $mySize = 8;
- $scalebar_height_half = 0.5 * $scalebar_height;
-
- $myText = 0;
- $length = $pdf->getTextWidth($mySize, $myText);
- $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-
- $myText = $array_scalebar[2]/2;
- $length = $pdf->getTextWidth($mySize, $myText);
- $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-
- $myText = $array_scalebar[2];
- $length = $pdf->getTextWidth($mySize, $myText);
- $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
-
-
- $pdf->setColor(0,0,0);
- $mySize = 8;
- $scalebar_height_half = 0.5 * $scalebar_height;
- $myText = $array_scalebar[0];
-
- #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
-
-
- #units
- $length = $pdf->getTextWidth($mySize, $myText);
- $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
-
-}
-
-
-/* ------------------------
- new page for legend
- ------------------------ */
-if ($legend == true && $_REQUEST["mylegend"]=='true'){
-
- $pdf->ezNewPage();
-
- //Pageborder (top, bottom, left, right)
-
- if($size == "A4" && $format == "portrait"){
- $pdf->ezSetMargins(50,50,80,30);
- } else {
- $pdf->ezSetMargins(60,35,60,60);
- }
-
- //Requests
- if(CHARSET=="UTF-8"){
- $new_wms_title=utf8_decode($_REQUEST["wms_title"]);
- }else{
- $new_wms_title=$_REQUEST["wms_title"];
- }
-
- if(CHARSET=="UTF-8"){
- $new_layers=utf8_decode($_REQUEST["layers"]);
- }else{
- $new_layers=$_REQUEST["layers"];
- }
-
- $my_wms_id = explode("___",$_REQUEST["wms_id"]);
- $my_wms_title = explode("___",$new_wms_title);
- $my_layers = explode("___",$new_layers);
- if($matching == true){
- $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);
- }
- else{
- $my_legend = $_REQUEST["legendurl"];
- }
- $my_legend = explode("___",$my_legend);
-
- //columns
- if($size == "A4" && $format == "portrait"){
- $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
- } else {
- $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
- }
-
- //header from printPDF.conf
- //$pdf->ezText("<b>".$titel."</b>", 13);
- $pdf->ezText("<b><u>".$legendText."</u></b>", 13);
-
-
- //Seitenraender (top, bottom, left, right)
- if($size == "A4" && $format == "portrait"){
- $pdf->ezSetMargins(70,35,80,30);
- } else {
- $pdf->ezSetMargins(100,35,60,60);
- }
-
- //generate the legend---------------------------------------------
-
- // Gesamthoehe Legende / height of the legend
- $sum_legend_height = 0;
-
-
- for($i=0; $i<count($my_wms_id); $i++){
- if ($my_wms_id[$i] != '0'){ //wms_id not 0
- $layer = explode(",",$my_layers[$i]);
- $my_legendurls = explode(",",$my_legend[$i]);
-
- $wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
- $wms_zeilenhoehe = $pdf->getFontHeight(12);
-
- // add this to the height of the legend /addiere dies zur Gesamthoehe Legende
- $sum_legend_height += $wms_zeilenhoehe;
-
- //Layer
- $l = 0; #l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
- for($j=0; $j<count($my_legendurls); $j++){
- // url with grouped layers------------------
- $temp_url = explode('*',$my_legendurls[$j]);
- $temp_layers = explode('*',$layer[$j]);
-
- for ($q=0; $q <count($temp_url);$q++){
- if($temp_url[$q] == '1' ){ // Layertitle for the parent of grouped layers
- // add this to the height of the legend /addiere dies zur Gesamth�he Legende
- $layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
- $layer_zeilenhoehe = $pdf->getFontHeight(12);
- $sum_legend_height += $layer_zeilenhoehe;
-
- }elseif($temp_url[$q] != '0' ){
- $funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
- $imgsize = getimagesize($legendFilename);
- // add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
- $sum_legend_height += $imgsize[1];
-
- //calculate text + picture / Berechnung Groesse Schrift + Bild
- if($l == 0){
- $y_position = $wms_y_position;
- $wms_y_position = '';
- }else{
- $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
- }
- $layer_zeilenhoehe = $pdf->getFontHeight(11);
- $next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
-
- // add this to the height of the legend / addiere dies zur Gesamth�he Legende
- $sum_legend_height += $layer_zeilenhoehe;
-
- $l = $l+1;
-
- // if text + picture are smaler then the lower margin + textsize, then set a space
- //wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
- if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
- $space = $layer_zeilenhoehe + $imgsize[1];
- $pdf->ezSetDy(-$space);
- }
- if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
- $space = $layer_zeilenhoehe + $imgsize[1];
- $pdf->ezSetDy(-$space);
- }
-
- //write the header layername / Ueberschrift schreiben
- $legend = $temp_layers[$q]."\n"; //$layer[$j]."\n";
- $pdf->ezText($legend, 11, array('spacing'=>1.2));
-
- //$pdf->ezText($url, 9, array('spacing'=>1.2));
- //print the picture / Bild schreiben
- $pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
- if($unlink == true){
- unlink($legendFilename);
- }
-
- } //if legendurl
- }// for legendurl
-
- //frames (x1, y1, x2, y2)
- if($size == "A4" && $format == "portrait"){
- #line
- $pdf->setLineStyle($linewidth, '', '', array());
- //left
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height);
- //right
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
- //top
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
- //bottom
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
-
- if ($legendImage!=''){
- //image on top of page
- $pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
- }
- } else {
- $pdf->setLineStyle($linewidth, '', '', array());
- //left
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border);
- //right
- $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
- //top
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
- //bottom
- $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
-
- if ($legendImage!=''){
- //image on top of page
- $pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
- //line under legend (only landscape)
- //$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
- }
- }
- }// for layers
- } //if wms_id not 0
- }// for wms
-
- /****
- * USER POLYGON:
- */
- if($_REQUEST["measured_x_values"] != ""
- && $_REQUEST["measured_y_values"] != ""
- && is_file($legendFilenameUserPolygon)) {
- // load image
- $myY = $pdf->ezText("<b>temporary Object</b>", 11);
- $pdf->ezSetDy(-15);
- $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
- if($unlink == true){
- unlink($legendFilenameUserPolygon);
- }
- $pdf->ezSetY($myY - 7);
-
- $pdf->ezText("Element", 11, array("left" => 25));
- // deletes image
-
- $pdf->ezSetDy(-15);
-
- }
-
-$pdf->ezText($legendFooter, 11);
-}//legend true
-/* ------------------------
- end of legend
- ------------------------ */
-
-ob_clean();
-if($download == false){
- $pdf->ezStream();
-}
-else{
- $content = $pdf->ezOutput();
-
- $fp = fopen($downloadFile,'w');
- fwrite($fp,$content);
- fclose($fp);
- echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
-}
-?>
Copied: branches/google_dev/trunk/http/print/mod_printPDF_pdf.php (from rev 3752, trunk/mapbender/http/print/mod_printPDF_pdf.php)
===================================================================
--- branches/google_dev/trunk/http/print/mod_printPDF_pdf.php (rev 0)
+++ branches/google_dev/trunk/http/print/mod_printPDF_pdf.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,850 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+include (dirname(__FILE__)."/../classes/class.ezpdf.php");
+include (dirname(__FILE__)."/../classes/class_stripRequest.php");
+include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
+include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
+include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
+include (dirname(__FILE__)."/../print/print_functions.php");
+
+if($log == true){
+ include (dirname(__FILE__)."/../classes/class_log.php");
+}
+
+#Globals
+
+$factor = intval($_REQUEST["quality"]);
+
+#$date = date("d.m.Y",strtotime("now"));
+$linewidth_dashed = 0.5;
+$linewidth = 0.5;
+
+// DURATION TIME:
+function microtime_float(){
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+$time_start = microtime_float();
+// END DURATION TIME
+
+$time_end = microtime_float();
+$time = $time_end - $time_start;
+
+/* -------------------------------------- */
+
+$size = $_REQUEST["size"];
+$format = $_REQUEST["format"];
+$map_scale = $_REQUEST["map_scale"];
+$overview_url = $_REQUEST["overview_url"];
+$epsg = $_REQUEST["epsg"];
+if($overview_url=='false'){
+ $overview = false;
+}
+
+function setscalebar($scale){
+ $mb_resolution = 28.35;
+
+ if($scale < 16){
+ $value = "10";
+ $unit = "cm";
+ $scalefactor = 10/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale >= 16 && $scale < 151){
+ $value = "1";
+ $unit = "Meter";
+ $scalefactor = 100/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale >= 151 && $scale < 1550 ){
+ $value = "10";
+ $unit = "Meter";
+ $scalefactor = 1000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale >= 1550 && $scale < 15050){
+ $value = "100";
+ $unit = "Meter";
+ $scalefactor = 10000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale < 150050 && $scale >= 15050){
+ $value = "1";
+ $unit = "Kilometer";
+ $scalefactor = 100000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale < 1500050 && $scale >= 150050){
+ $value = "10";
+ $unit = "Kilometer";
+ $scalefactor = 1000000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale < 15000050 && $scale >= 1500050){
+ $value = "100";
+ $unit = "Kilometer";
+ $scalefactor = 10000000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale < 150000001 && $scale >= 15000001){
+ $value = "1000";
+ $unit = "Kilometer";
+ $scalefactor = 100000000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ if($scale >= 150000001){
+ $value = "1000";
+ $unit = "Kilometer";
+ $scalefactor = 100000000/$scale;
+ $img_width = round($scalefactor * $mb_resolution);
+ }
+ $array_scale[0] = $unit;
+ $array_scale[1] = $img_width;
+ $array_scale[2] = $value;
+
+ return $array_scale;
+}
+
+
+$border = 0.8 * $DPC;
+
+if($matching == true){
+ $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);
+}
+else{
+ $urls = $_REQUEST["map_url"];
+}
+
+
+$array_urls = explode("___", $urls);
+
+$myURL = new stripRequest($array_urls[0]);
+$map_width = round($myURL->get("width"));
+$map_height = round($myURL->get("height"));
+$map_extent = $myURL->get("BBOX");
+if($factor>1){
+ for($i=0; $i<count($array_urls); $i++){
+ $m = new stripRequest($array_urls[$i]);
+ $m->set('width',(intval($m->get('width'))*4));
+ $m->set('height',(intval($m->get('height'))*4));
+ if(in_array($m->get('map'),$highqualitymapfiles)){
+ $m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));
+ }
+ $array_urls[$i] = $m->url;
+ }
+}
+$coord = mb_split(",",$map_extent);
+
+if($overview === true){
+ // analyse overview url and draw rectangle with position
+ $o_url = new stripRequest($overview_url);
+ $overview_width = round($o_url->get("width"));
+ $overview_height = round($o_url->get("height"));
+
+ if($factor>1){
+ $o_url->set('width',(intval($o_url->get('width'))*4));
+ $o_url->set('height',(intval($o_url->get('height'))*4));
+ if(in_array($o_url->get('map'),$highqualitymapfiles)){
+ $o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));
+ $overview_url = $o_url->url;
+ }
+ }
+
+ if($matching == true){
+ $overview_url = preg_replace($pattern,$replacement,$overview_url);
+ }
+
+
+ if ($size == "A4" && $format == "portrait"){
+ $overview_left = $a4p_overviewOffset_left;
+ $overview_bottom =$a4p_overviewOffset_bottom;
+ }elseif ($size == "A4" && $format == "landscape"){
+ $overview_left = $a4l_overviewOffset_left;
+ $overview_bottom =$a4l_overviewOffset_bottom;
+ }elseif ($size == "A3" && $format == "portrait"){
+ $overview_left = $a3p_overviewOffset_left;
+ $overview_bottom =$a3p_overviewOffset_bottom;
+ }elseif ($size == "A3" && $format == "landscape"){
+ $overview_left = $a3l_overviewOffset_left;
+ $overview_bottom = $a3l_overviewOffset_bottom;
+ }elseif ($size == "A2" && $format == "portrait"){
+ $overview_left = $a2p_overviewOffset_left;
+ $overview_bottom =$a2p_overviewOffset_bottom;
+ }elseif ($size == "A2" && $format == "landscape"){
+ $overview_left = $a2l_overviewOffset_left;
+ $overview_bottom = $a2l_overviewOffset_bottom;
+ }elseif ($size == "A1" && $format == "portrait"){
+ $overview_left = $a1p_overviewOffset_left;
+ $overview_bottom =$a1p_overviewOffset_bottom;
+ }elseif ($size == "A1" && $format == "landscape"){
+ $overview_left = $a1l_overviewOffset_left;
+ $overview_bottom = $a1l_overviewOffset_bottom;
+ }elseif ($size == "A0" && $format == "portrait"){
+ $overview_left = $a0p_overviewOffset_left;
+ $overview_bottom =$a0p_overviewOffset_bottom;
+ }elseif ($size == "A0" && $format == "landscape"){
+ $overview_left = $a0l_overviewOffset_left;
+ $overview_bottom = $a0l_overviewOffset_bottom;
+ }
+
+ $o_extent = $o_url->get("BBOX");
+
+ $array_overview_url[0] = $overview_url;
+ if($log == true){
+ $l = new log("printPDF_overview",$array_overview_url);
+ }
+
+ /*
+ $o_new = new stripRequest($overview_url);
+ $o_new->set('width',50);
+ $o_new->set('height',50);
+ //$o->set('BBOX',$overview_extent);
+ $o_url_new =$o_new->url;
+ $array_overview[0] = $overview_url;
+ $array_overview[1] = $o_url;
+ */
+}
+
+/*
+ * north arrow
+ */
+if($size == "A4" && $format == "portrait"){
+ $northarrow_left = $a4p_northarrow_left;
+ $northarrow_bottom = $a4p_northarrow_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+ $northarrow_left = $a4l_northarrow_left;
+ $northarrow_bottom = $a4l_northarrow_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+ $northarrow_left = $a3p_northarrow_left;
+ $northarrow_bottom = $a3p_northarrow_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+ $northarrow_left = $a3l_northarrow_left;
+ $northarrow_bottom = $a3l_northarrow_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+ $northarrow_left = $a2p_northarrow_left;
+ $northarrow_bottom = $a2p_northarrow_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+ $northarrow_left = $a2l_northarrow_left;
+ $northarrow_bottom = $a2l_northarrow_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+ $northarrow_left = $a1p_northarrow_left;
+ $northarrow_bottom = $a1p_northarrow_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+ $northarrow_left = $a1l_northarrow_left;
+ $northarrow_bottom = $a1l_northarrow_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+ $northarrow_left = $a0p_northarrow_left;
+ $northarrow_bottom = $a0p_northarrow_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+ $northarrow_left = $a0l_northarrow_left;
+ $northarrow_bottom = $a0l_northarrow_bottom;
+}
+
+/*
+ * special image
+ */
+if ($size == "A4" && $format == "portrait"){
+ $specialImage_left = $a4p_special_left;
+ $specialImage_bottom = $a4p_special_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+ $specialImage_left = $a4l_special_left;
+ $specialImage_bottom = $a4l_special_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+ $specialImage_left = $a3p_special_left;
+ $specialImage_bottom = $a3p_special_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+ $specialImage_left = $a3l_special_left;
+ $specialImage_bottom = $a3l_special_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+ $specialImage_left = $a2p_special_left;
+ $specialImage_bottom = $a2p_special_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+ $specialImage_left = $a2l_special_left;
+ $specialImage_bottom = $a2l_special_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+ $specialImage_left = $a1p_special_left;
+ $specialImage_bottom = $a1p_special_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+ $specialImage_left = $a1l_special_left;
+ $specialImage_bottom = $a1l_special_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+ $specialImage_left = $a0p_special_left;
+ $specialImage_bottom = $a0p_special_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+ $specialImage_left = $a0l_special_left;
+ $specialImage_bottom = $a0l_special_bottom;
+}
+
+if($log == true){
+ $l = new log("printPDF",$array_urls);
+}
+$pdf = new Cezpdf();
+
+$pdf->Cezpdf(mb_strtolower($size),$format);
+$diff=array(196=>'Adieresis',228=>'adieresis',
+ 214=>'Odieresis',246=>'odieresis',
+ 220=>'Udieresis',252=>'udieresis',
+ 223=>'germandbls');
+$pdf->selectFont('../classes/fonts/LiberationSans-Regular.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
+if($size == "A4" && $format == "portrait"){
+ $mapOffset_left = $a4p_mapOffset_left;
+ $mapOffset_bottom = $a4p_mapOffset_bottom;
+ $header_height = $a4p_header_height;
+ $footer_height = $a4p_footer_height;
+}
+else{
+ $mapOffset_left = $a4l_mapOffset_left;
+ $mapOffset_bottom = $a4l_mapOffset_bottom;
+ $header_height = $a4l_header_height;
+ $header_width = $a4l_header_width;
+}
+session_write_close();
+$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
+
+$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
+if($unlink == true){
+ unlink($filename);
+}
+
+/** ******************************************************************
+* user drawn elements
+*/
+
+$theMeasureConfigArray = array(
+ "do_fill" => FALSE,
+ "fill_color" => array(
+ "r" => 128 / 255,
+ "g" => 128 / 255,
+ "b" => 128 / 255
+ ),
+ "do_stroke" => FALSE,
+ "stroke_color" => array(
+ "r" => 254 / 255,
+ "g" => 1 / 255,
+ "b" => 1 / 255
+ ),
+ "line_style" => array(
+ "width" => 2,
+ "cap" => 'butt',
+ "join" => 'miter',
+ "dash" => array(10, 6)
+ )
+ );
+
+if ($_REQUEST["measured_x_values"]!=''){
+ addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
+ hideElementsOutsideMapframe($pdf);
+}
+
+# dashed line
+$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
+
+
+#line
+$pdf->setLineStyle($linewidth, '', '', array());
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border);
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
+
+if($epsg == "EPSG:4326"){
+
+ $text4 = "";
+}
+
+if($size == "A4" && $format == "portrait"){
+ #header:
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height);
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+ $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom + $map_height + $border + $header_height);
+ #header-text
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text1);
+ $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
+
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text2);
+ $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
+
+ $length = $pdf->getTextWidth($mySize, $text3);
+ $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
+
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text4);
+ $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
+
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text5);
+ $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
+
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text6);
+ $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
+ $length = $pdf->getTextWidth($mySize, $text7);
+ $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
+ $length = $pdf->getTextWidth($mySize, $text8);
+ $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
+ $length = $pdf->getTextWidth($mySize, $text9);
+ $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
+ $length = $pdf->getTextWidth($mySize, $text10);
+ $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
+
+ //special image on the map-page
+ if ($special == true){
+ $pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+ }
+
+ #footer
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text11);
+ $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
+ $mySize = 6;
+ $length = $pdf->getTextWidth($mySize, $text12);
+ $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
+ $length = $pdf->getTextWidth($mySize, $text13);
+ $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
+}
+else{
+ $pdf->setColor(1,1,1);
+ $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
+ $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
+ $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
+ $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
+
+ $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2, $ll[1] + $header_height - 2);
+ $pdf->line($ll[0] + 2, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
+ $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
+ $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
+
+ $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
+ $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
+
+
+ //special image on the map-page
+ if ($special == true){
+ $pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+ }
+
+ if($epsg == "EPSG:4326"){
+
+ $text4 = "";
+ }
+
+ $pdf->setColor(0,0,0);
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text1);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
+
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text2);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
+ $length = $pdf->getTextWidth($mySize, $text3);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text4);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text5);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);
+
+ $mySize = 9;
+ $length = $pdf->getTextWidth($mySize, $text6);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
+ $length = $pdf->getTextWidth($mySize, $text7);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
+ $length = $pdf->getTextWidth($mySize, $text8);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
+ $length = $pdf->getTextWidth($mySize, $text9);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
+ $length = $pdf->getTextWidth($mySize, $text10);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
+
+ $mySize = 8;
+ $length = $pdf->getTextWidth($mySize, $text11);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11);
+ $mySize = 6;
+ $length = $pdf->getTextWidth($mySize, $text14);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
+ $length = $pdf->getTextWidth($mySize, $text15);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
+ $length = $pdf->getTextWidth($mySize, $text16);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
+ $length = $pdf->getTextWidth($mySize, $text17);
+ $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);
+}
+#Coordinates
+$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
+$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
+$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
+$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
+
+$mySize = 9;
+$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMiny, -90);
+$pdf->addText($mapOffset_left, $mapOffset_bottom - ($pdf->getFontHeight($mySize)), $mySize, $myMinx);
+$pdf->addText($mapOffset_left + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height + 3, $mySize, $myMaxx);
+$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
+
+
+
+
+
+
+if ($overview==true){
+ // analyse request, draw rectancle
+ $filename = preg_replace("/map_/","overview_",$filename);
+ if($size == "A4" && $format == "portrait"){
+ $i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
+
+ $pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+ if($unlink == true){
+ unlink($filename);
+ }
+ }
+ else{
+ $i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
+
+ //$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
+ $pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+ if($unlink == true){
+ unlink($filename);
+ }
+ }
+}
+
+if ($northarrow==true){
+ $pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
+}
+
+if($epsg == "EPSG:4326"){
+
+ $scalebar = false;
+}
+
+if($scalebar == true){
+ if ($size == "A4" && $format == "portrait"){
+ $scalebar_left = $a4p_scalebar_left;
+ $scalebar_bottom = $a4p_scalebar_bottom;
+ }elseif ($size == "A4" && $format == "landscape"){
+ $scalebar_left = $a4l_scalebar_left;
+ $scalebar_bottom = $a4l_scalebar_bottom;
+ }elseif ($size == "A3" && $format == "portrait"){
+ $scalebar_left = $a3p_scalebar_left;
+ $scalebar_bottom = $a3p_scalebar_bottom;
+ }elseif ($size == "A3" && $format == "landscape"){
+ $scalebar_left = $a3l_scalebar_left;
+ $scalebar_bottom = $a3l_scalebar_bottom;
+ }elseif ($size == "A2" && $format == "portrait"){
+ $scalebar_left = $a2p_scalebar_left;
+ $scalebar_bottom = $a2p_scalebar_bottom;
+ }elseif ($size == "A2" && $format == "landscape"){
+ $scalebar_left = $a2l_scalebar_left;
+ $scalebar_bottom = $a2l_scalebar_bottom;
+ }elseif ($size == "A1" && $format == "portrait"){
+ $scalebar_left = $a1p_scalebar_left;
+ $scalebar_bottom = $a1p_scalebar_bottom;
+ }elseif ($size == "A1" && $format == "landscape"){
+ $scalebar_left = $a1l_scalebar_left;
+ $scalebar_bottom = $a1l_scalebar_bottom;
+ }elseif ($size == "A0" && $format == "portrait"){
+ $scalebar_left = $a0p_scalebar_left;
+ $scalebar_bottom = $a0p_scalebar_bottom;
+ }elseif ($size == "A0" && $format == "landscape"){
+ $scalebar_left = $a0l_scalebar_left;
+ $scalebar_bottom = $a0l_scalebar_bottom;
+ }
+
+ $array_scalebar = setscalebar($map_scale);
+
+ $scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
+ $pdf->setLineStyle($scalebar_height, '','', array());
+ $pdf->setColor(0,0,0);
+ #$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
+ $pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
+
+ $pdf->setColor(1,1,1);
+ $pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);
+ $pdf->setColor(1,1,1);
+ $pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);
+
+
+ #$pdf->setColor(1,0,1);
+ #$pdf->filledRectangle($scalebar_left , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);
+
+
+ # value - Einheiten
+ $pdf->setColor(0,0,0);
+ $mySize = 8;
+ $scalebar_height_half = 0.5 * $scalebar_height;
+
+ $myText = 0;
+ $length = $pdf->getTextWidth($mySize, $myText);
+ $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+
+ $myText = $array_scalebar[2]/2;
+ $length = $pdf->getTextWidth($mySize, $myText);
+ $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+
+ $myText = $array_scalebar[2];
+ $length = $pdf->getTextWidth($mySize, $myText);
+ $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
+
+
+ $pdf->setColor(0,0,0);
+ $mySize = 8;
+ $scalebar_height_half = 0.5 * $scalebar_height;
+ $myText = $array_scalebar[0];
+
+ #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
+
+
+ #units
+ $length = $pdf->getTextWidth($mySize, $myText);
+ $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
+
+}
+
+
+/* ------------------------
+ new page for legend
+ ------------------------ */
+if ($legend == true && $_REQUEST["mylegend"]=='true'){
+
+ $pdf->ezNewPage();
+
+ //Pageborder (top, bottom, left, right)
+
+ if($size == "A4" && $format == "portrait"){
+ $pdf->ezSetMargins(50,50,80,30);
+ } else {
+ $pdf->ezSetMargins(60,35,60,60);
+ }
+
+ //Requests
+ if(CHARSET=="UTF-8"){
+ $new_wms_title=utf8_decode($_REQUEST["wms_title"]);
+ }else{
+ $new_wms_title=$_REQUEST["wms_title"];
+ }
+
+ if(CHARSET=="UTF-8"){
+ $new_layers=utf8_decode($_REQUEST["layers"]);
+ }else{
+ $new_layers=$_REQUEST["layers"];
+ }
+
+ $my_wms_id = explode("___",$_REQUEST["wms_id"]);
+ $my_wms_title = explode("___",$new_wms_title);
+ $my_layers = explode("___",$new_layers);
+ if($matching == true){
+ $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);
+ }
+ else{
+ $my_legend = $_REQUEST["legendurl"];
+ }
+ $my_legend = explode("___",$my_legend);
+
+ //columns
+ if($size == "A4" && $format == "portrait"){
+ $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
+ } else {
+ $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
+ }
+
+ //header from printPDF.conf
+ //$pdf->ezText("<b>".$titel."</b>", 13);
+ $pdf->ezText("<b><u>".$legendText."</u></b>", 13);
+
+
+ //Seitenraender (top, bottom, left, right)
+ if($size == "A4" && $format == "portrait"){
+ $pdf->ezSetMargins(70,35,80,30);
+ } else {
+ $pdf->ezSetMargins(100,35,60,60);
+ }
+
+ //generate the legend---------------------------------------------
+
+ // Gesamthoehe Legende / height of the legend
+ $sum_legend_height = 0;
+
+
+ for($i=0; $i<count($my_wms_id); $i++){
+ if ($my_wms_id[$i] != '0'){ //wms_id not 0
+ $layer = explode(",",$my_layers[$i]);
+ $my_legendurls = explode(",",$my_legend[$i]);
+
+ $wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
+ $wms_zeilenhoehe = $pdf->getFontHeight(12);
+
+ // add this to the height of the legend /addiere dies zur Gesamthoehe Legende
+ $sum_legend_height += $wms_zeilenhoehe;
+
+ //Layer
+ $l = 0; #l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
+ for($j=0; $j<count($my_legendurls); $j++){
+ // url with grouped layers------------------
+ $temp_url = explode('*',$my_legendurls[$j]);
+ $temp_layers = explode('*',$layer[$j]);
+
+ for ($q=0; $q <count($temp_url);$q++){
+ if($temp_url[$q] == '1' ){ // Layertitle for the parent of grouped layers
+ // add this to the height of the legend /addiere dies zur Gesamth�he Legende
+ $layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
+ $layer_zeilenhoehe = $pdf->getFontHeight(12);
+ $sum_legend_height += $layer_zeilenhoehe;
+
+ }elseif($temp_url[$q] != '0' ){
+ $funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
+ $imgsize = getimagesize($legendFilename);
+ // add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
+ $sum_legend_height += $imgsize[1];
+
+ //calculate text + picture / Berechnung Groesse Schrift + Bild
+ if($l == 0){
+ $y_position = $wms_y_position;
+ $wms_y_position = '';
+ }else{
+ $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
+ }
+ $layer_zeilenhoehe = $pdf->getFontHeight(11);
+ $next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
+
+ // add this to the height of the legend / addiere dies zur Gesamth�he Legende
+ $sum_legend_height += $layer_zeilenhoehe;
+
+ $l = $l+1;
+
+ // if text + picture are smaler then the lower margin + textsize, then set a space
+ //wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
+ if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
+ $space = $layer_zeilenhoehe + $imgsize[1];
+ $pdf->ezSetDy(-$space);
+ }
+ if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
+ $space = $layer_zeilenhoehe + $imgsize[1];
+ $pdf->ezSetDy(-$space);
+ }
+
+ //write the header layername / Ueberschrift schreiben
+ $legend = $temp_layers[$q]."\n"; //$layer[$j]."\n";
+ $pdf->ezText($legend, 11, array('spacing'=>1.2));
+
+ //$pdf->ezText($url, 9, array('spacing'=>1.2));
+ //print the picture / Bild schreiben
+ $pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
+ if($unlink == true){
+ unlink($legendFilename);
+ }
+
+ } //if legendurl
+ }// for legendurl
+
+ //frames (x1, y1, x2, y2)
+ if($size == "A4" && $format == "portrait"){
+ #line
+ $pdf->setLineStyle($linewidth, '', '', array());
+ //left
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height);
+ //right
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
+ //top
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+ //bottom
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+
+ if ($legendImage!=''){
+ //image on top of page
+ $pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
+ }
+ } else {
+ $pdf->setLineStyle($linewidth, '', '', array());
+ //left
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom + $map_height + $border);
+ //right
+ $pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+ //top
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+ //bottom
+ $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
+
+ if ($legendImage!=''){
+ //image on top of page
+ $pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
+ //line under legend (only landscape)
+ //$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
+ }
+ }
+ }// for layers
+ } //if wms_id not 0
+ }// for wms
+
+ /****
+ * USER POLYGON:
+ */
+ if($_REQUEST["measured_x_values"] != ""
+ && $_REQUEST["measured_y_values"] != ""
+ && is_file($legendFilenameUserPolygon)) {
+ // load image
+ $myY = $pdf->ezText("<b>temporary Object</b>", 11);
+ $pdf->ezSetDy(-15);
+ $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
+ if($unlink == true){
+ unlink($legendFilenameUserPolygon);
+ }
+ $pdf->ezSetY($myY - 7);
+
+ $pdf->ezText("Element", 11, array("left" => 25));
+ // deletes image
+
+ $pdf->ezSetDy(-15);
+
+ }
+
+$pdf->ezText($legendFooter, 11);
+}//legend true
+/* ------------------------
+ end of legend
+ ------------------------ */
+
+ob_clean();
+if($download == false){
+ $pdf->ezStream();
+}
+else{
+ $content = $pdf->ezOutput();
+
+ $fp = fopen($downloadFile,'w');
+ fwrite($fp,$content);
+ fclose($fp);
+ echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
+}
+?>
Deleted: branches/google_dev/trunk/lib/ajax.js
===================================================================
--- trunk/mapbender/lib/ajax.js 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/ajax.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,264 +0,0 @@
-/*
-* $Id: map_obj.js 2413 2008-04-23 16:21:04Z christoph $
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
-*/
-
-
-/*
- ***************************************************************************************
- * AJAX wrapper functions
- ***************************************************************************************
- */
-/**
- * A wrapper for an AJAX request via GET
- *
- * @deprecated
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error".
- */
-function mb_ajax_get(url, param, callback) {
- try {
-// $.ajaxSetup({async:false});
- $.get(url, param, callback);
- }
- catch(e) {
- var error = new Mb_exception('map.php: mb_ajax_get:'+e);
- }
-}
-
-/**
- * A wrapper for an AJAX request via POST
- *
- * @deprecated
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error".
- */
-function mb_ajax_post(url, param, callback) {
- try {
-// $.ajaxSetup({async:false});
- $.post(url, param, callback);
- }
- catch(e) {
- var error = new Mb_exception('map.php: mb_ajax_post:'+e);
- }
-}
-
-/**
- * A wrapper for an AJAX request via GET
- *
- * @deprecated
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error".
- */
-function mb_ajax_json(url, param, callback) {
- try {
-// window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work sometimes
- $.getJSON(url, param, callback);
- }
- catch(e) {
- var error = new Mb_exception('map.php: mb_ajax_json:'+e);
- }
-}
-
-Mapbender.Ajax = {
- requestCount: 0,
- Messages: {
- "fatalError": "A fatal error occured.",
- "idMismatchError": "The ID of the response is not equal to the ID of the request."
- }
-};
-
-Mapbender.Ajax.Notification = function () {
- /**
- * The method to call on the server
- */
- var method = "";
-
- /**
- * The parameters to pass to the above method
- */
- var parameters = {};
-
- this.setMethod = function (aMethod) {
- method = aMethod.toString();
- };
-
- this.setParameter = function (key, value) {
- parameters[key] = value;
- return true;
- };
-
- this.send = function (type, url) {
- switch (type.toUpperCase()) {
- case "POST" :
- $.post(url, getParameters(), function () {
- });
- break;
- case "GET" :
- $.get(url, getParameters(), function () {
- });
- break;
- default:
- return false;
- }
- return true;
- };
-
- var getParameters = function () {
- return {
- "method": method,
- "params": $.toJSON([parameters]),
- "id": null
- };
- }
-
-}
-Mapbender.Ajax.Request = function (options) {
- /**
- * "POST" or "GET"
- */
- var type = (typeof(options) == "object" && options.type) ? options.type.toUpperCase() : "POST";
-
- /**
- * result of request will be logged as Mb_notice
- */
- var log = (typeof(options) == "object" && options.log) ? options.log : false;
-
- /**
- * The method to call on the server
- */
- var method = (typeof(options) == "object" && options.method) ? options.method : "";
-
- /**
- * The parameters to pass to the above method
- */
- var parameters = (typeof(options) == "object" && options.parameters) ? options.parameters : {};
-
- /**
- * A unique identifier for this Ajax request
- */
- var id = ++Mapbender.Ajax.requestCount;
-
- /**
- * The result object, coming from the server
- */
- var result = {};
-
- /**
- * A message coming from the server
- */
- var message = "";
-
- /**
- * Did the request succeed?
- */
- var success = false;
-
- /**
- * Did an internal error occur
- */
- var internalError = false;
-
- /**
- * Checks if the response is valid.
- *
- * @param {String} json
- * @param {String} status
- */
- var receive = function (json, status) {
- if (!json) {
- message = Mapbender.Ajax.Messages.fatalError;
- new Mb_warning(message);
- internalError = true;
- return;
- }
- var resultObj = eval('(' + json + ')');
- // some severe error has occured
- if (typeof(resultObj) != "object" || status != "success") {
- message = Mapbender.Ajax.Messages.fatalError;
- new Mb_warning(message);
- internalError = true;
- return;
- }
- if (resultObj.error !== null) {
- // the ajax request reports failure
- if (resultObj.error.message) {
- message = resultObj.error.message;
- }
- else {
- message = Mapbender.Ajax.Messages.fatalError;
- }
- if (resultObj.error.code == -1) {
- internalError = true;
- }
- new Mb_warning(message);
- return;
- }
-
- // the ajax request reports success
- if (resultObj.result && typeof(resultObj.result) == "object" &&
- resultObj.result.data && typeof(resultObj.result.data) == "object") {
- if (id != resultObj.id) {
- message = Mapbender.Ajax.Messages.idMismatchError;
- new Mb_warning(message);
- internalError = true;
- return;
- }
-
- success = true;
-
- if (resultObj.result.data.message) {
- message = resultObj.data.message;
- status = resultObj.data.message;
- }
- result = resultObj.result.data;
- }
- return;
- }
-
- this.send = function (url, callback, scope) {
- internalError = false;
- success = false;
-
- var callbackWrapper = function (json, status) {
- receive(json, status);
- if (!internalError) {
- new Mb_notice("REQUEST #" + id + ": " + url + "\n\n" +
- "RESULT: " + $.toJSON(result) + "\n\n" +
- "SUCCESS: " + success + "\n\n" +
- "MESSAGE: " + message);
-
- if (scope !== undefined) {
- callback.apply(scope, [result, success, message]);
- }
- else {
- callback(result, success, message);
- }
- }
- };
- switch (type) {
- case "POST" :
- $.post(url, getParameters(), callbackWrapper);
- break;
- case "GET" :
- $.get(url, getParameters(), callbackWrapper);
- break;
- default:
- return false;
- }
- return true;
- };
-
- var getParameters = function () {
- return {
- "method": method,
- "params": $.toJSON(parameters),
- "id": id
- };
- }
-};
-Mapbender.Ajax.Request.prototype = new Mapbender.Ajax.Notification();
Copied: branches/google_dev/trunk/lib/ajax.js (from rev 3867, trunk/mapbender/lib/ajax.js)
===================================================================
--- branches/google_dev/trunk/lib/ajax.js (rev 0)
+++ branches/google_dev/trunk/lib/ajax.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,265 @@
+/*
+* $Id: map_obj.js 2413 2008-04-23 16:21:04Z christoph $
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
+*/
+
+
+/*
+ ***************************************************************************************
+ * AJAX wrapper functions
+ ***************************************************************************************
+ */
+/**
+ * A wrapper for an AJAX request via GET
+ *
+ * @deprecated
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error".
+ */
+function mb_ajax_get(url, param, callback) {
+ try {
+// $.ajaxSetup({async:false});
+ $.get(url, param, callback);
+ }
+ catch(e) {
+ var error = new Mb_exception('map.php: mb_ajax_get:'+e);
+ }
+}
+
+/**
+ * A wrapper for an AJAX request via POST
+ *
+ * @deprecated
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error".
+ */
+function mb_ajax_post(url, param, callback) {
+ try {
+// $.ajaxSetup({async:false});
+ $.post(url, param, callback);
+ }
+ catch(e) {
+ var error = new Mb_exception('map.php: mb_ajax_post:'+e);
+ }
+}
+
+/**
+ * A wrapper for an AJAX request via GET
+ *
+ * @deprecated
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error".
+ */
+function mb_ajax_json(url, param, callback) {
+ try {
+// window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work sometimes
+ $.getJSON(url, param, callback);
+ }
+ catch(e) {
+ var error = new Mb_exception('map.php: mb_ajax_json:'+e);
+ }
+}
+
+Mapbender.Ajax = {
+ requestCount: 0,
+ Messages: {
+ "fatalError": "A fatal error occured.",
+ "idMismatchError": "The ID of the response is not equal to the ID of the request."
+ }
+};
+
+Mapbender.Ajax.Notification = function () {
+ /**
+ * The method to call on the server
+ */
+ var method = "";
+
+ /**
+ * The parameters to pass to the above method
+ */
+ var parameters = {};
+
+ this.setMethod = function (aMethod) {
+ method = aMethod.toString();
+ };
+
+ this.setParameter = function (key, value) {
+ parameters[key] = value;
+ return true;
+ };
+
+ this.send = function (type, url) {
+ switch (type.toUpperCase()) {
+ case "POST" :
+ $.post(url, getParameters(), function () {
+ });
+ break;
+ case "GET" :
+ $.get(url, getParameters(), function () {
+ });
+ break;
+ default:
+ return false;
+ }
+ return true;
+ };
+
+ var getParameters = function () {
+ return {
+ "method": method,
+ "params": $.toJSON([parameters]),
+ "id": null
+ };
+ }
+
+}
+Mapbender.Ajax.Request = function (options) {
+ /**
+ * "POST" or "GET"
+ */
+ var type = (typeof(options) == "object" && options.type) ? options.type.toUpperCase() : "POST";
+
+ /**
+ * result of request will be logged as Mb_notice
+ */
+ var log = (typeof(options) == "object" && options.log) ? options.log : false;
+
+ /**
+ * The method to call on the server
+ */
+ var method = (typeof(options) == "object" && options.method) ? options.method : "";
+
+ /**
+ * The parameters to pass to the above method
+ */
+ var parameters = (typeof(options) == "object" && options.parameters) ? options.parameters : {};
+
+ /**
+ * A unique identifier for this Ajax request
+ */
+ var id = ++Mapbender.Ajax.requestCount;
+
+ /**
+ * The result object, coming from the server
+ */
+ var result = {};
+
+ /**
+ * A message coming from the server
+ */
+ var message = "";
+
+ /**
+ * Did the request succeed?
+ */
+ var success = false;
+
+ /**
+ * Did an internal error occur
+ */
+ var internalError = false;
+
+ /**
+ * Checks if the response is valid.
+ *
+ * @param {String} json
+ * @param {String} status
+ */
+ var receive = function (json, status) {
+ if (!json) {
+ message = Mapbender.Ajax.Messages.fatalError;
+ new Mb_warning(message);
+ internalError = true;
+ return;
+ }
+ var resultObj = eval('(' + json + ')');
+ // some severe error has occured
+ if (typeof(resultObj) != "object" || status != "success") {
+ message = Mapbender.Ajax.Messages.fatalError;
+ new Mb_warning(message);
+ internalError = true;
+ return;
+ }
+ if (resultObj.error !== null) {
+ // the ajax request reports failure
+ if (resultObj.error.message) {
+ message = resultObj.error.message;
+ }
+ else {
+ message = Mapbender.Ajax.Messages.fatalError;
+ }
+ if (resultObj.error.code == -1) {
+ internalError = true;
+ }
+ new Mb_warning(message);
+ return;
+ }
+
+ // the ajax request reports success
+ if (resultObj.result && typeof(resultObj.result) == "object" &&
+ resultObj.result.data && typeof(resultObj.result.data) == "object") {
+
+ if (id != resultObj.id) {
+ message = Mapbender.Ajax.Messages.idMismatchError;
+ new Mb_warning(message);
+ internalError = true;
+ return;
+ }
+
+ success = true;
+
+ if (resultObj.result.message) {
+ message = resultObj.result.message;
+ status = resultObj.result.message;
+ }
+ result = resultObj.result.data;
+ }
+ return;
+ }
+
+ this.send = function (url, callback, scope) {
+ internalError = false;
+ success = false;
+
+ var callbackWrapper = function (json, status) {
+ receive(json, status);
+ if (!internalError) {
+ new Mb_notice("REQUEST #" + id + ": " + url + "\n\n" +
+ "RESULT: " + $.toJSON(result) + "\n\n" +
+ "SUCCESS: " + success + "\n\n" +
+ "MESSAGE: " + message);
+
+ if (scope !== undefined) {
+ callback.apply(scope, [result, success, message]);
+ }
+ else {
+ callback(result, success, message);
+ }
+ }
+ };
+ switch (type) {
+ case "POST" :
+ $.post(url, getParameters(), callbackWrapper);
+ break;
+ case "GET" :
+ $.get(url, getParameters(), callbackWrapper);
+ break;
+ default:
+ return false;
+ }
+ return true;
+ };
+
+ var getParameters = function () {
+ return {
+ "method": method,
+ "params": $.toJSON(parameters),
+ "id": id
+ };
+ }
+};
+Mapbender.Ajax.Request.prototype = new Mapbender.Ajax.Notification();
Deleted: branches/google_dev/trunk/lib/ajax.php
===================================================================
--- trunk/mapbender/lib/ajax.php 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/ajax.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,202 +0,0 @@
-<?php
-# $Id:database-pgsql.php 2619 2008-07-08 15:46:11Z christoph $
-# http://www.mapbender.org/index.php/database-pgsql.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__) . "/../http/classes/class_json.php");
-
-/**
- * Represents an incoming JSON-RPC. It will NOT send a response to the client!
- * (Use AjaxResponse if you also want to send a response.)
- *
- * Usually called like this
- *
- * $incomingAjax = new AjaxRequest($_REQUEST)
- *
- * get parameters of request via
- *
- * echo $incomingAjax->getParameter("someAttribute");
- */
-class AjaxRequest {
-
- protected $method = "";
- protected $json = null;
- protected $id = null;
- protected $paramObject = array();
-
- public function __construct ($requestArray) {
- $this->json = new Mapbender_JSON();
-
- if (is_array($requestArray)) {
- $this->initializeFromArray($requestArray);
- }
- }
-
- protected function initializeFromArray ($requestArray) {
- if ($requestArray["id"]) {
- $this->id = $requestArray["id"];
- }
-
- if ($requestArray["method"]) {
- $this->method = $requestArray["method"];
-
- if ($requestArray["params"]) {
-
- $obj = $this->json->decode(stripslashes($requestArray["params"]));
- $this->paramObject = $obj;
- }
- }
- }
-
- public function getMethod () {
- return $this->method;
- }
-
- public function getParameter ($key) {
- if (is_object($this->paramObject) && $this->paramObject->$key) {
- return $this->paramObject->$key;
- }
- return null;
- }
-
- public function getId () {
- return $this->id;
- }
-}
-
-/**
- * Represents an incoming JSON-RPC, which will send a response to the client.
- *
- * Usually called like this
- *
- * $ajaxResponse = new AjaxResponse($_REQUEST)
- *
- *
- * get parameters of request via
- *
- * echo $ajaxResponse->getParameter("someAttribute");
- *
- *
- * set data to be sent back to the client
- *
- * $ajaxResponse->setResult("key", "value");
- *
- * or
- *
- * $ajaxResponse->setResult($assocArray);
- *
- *
- * set the status of this RPC
- *
- * $ajaxResponse->setSuccess(false);
- *
- * and supply a message
- *
- * $ajaxResponse->setMessage("I didn't do it.");
- *
- *
- * Finally send the response
- *
- * $ajaxResponse->send();
- */
-class AjaxResponse extends AjaxRequest {
- private $data = array();
- private $success = true;
- private $error = null;
- private $message = "";
-
- public function __construct ($ajaxRequest) {
- $this->json = new Mapbender_JSON();
-
- if (is_array($ajaxRequest)) {
- $this->initializeFromArray($ajaxRequest);
- }
-
- // in addition to AjaxRequest, immediately send an
- // error message to the client, if the request
- // could not be identified
- if ($this->id === null) {
- $this->success = false;
- $this->message = _mb("Fatal error: Could not detect ID of AJAX request.");
- $this->send();
- }
- }
-
- /**
- * Set a message to be sent back to the client.
- *
- * @param $aMessage String
- */
- public function setMessage ($aMessage) {
- $this->message = $aMessage;
- }
-
- /**
- * Set status of the RPC.
- *
- * @param $trueOrFalse Boolean
- */
- public function setSuccess ($trueOrFalse) {
- $this->success = $trueOrFalse;
- }
-
- /**
- * Compose data to be sent back to the client.
- * Either by key and value, or by passing the complete associative array.
- */
- public function setResult () {
- if (func_num_args() == 1) {
- $this->data = func_get_arg(0);
- }
- else if (func_num_args() == 2) {
- $key = func_get_arg(0);
- $value = func_get_arg(1);
- $this->data[$key] = $value;
- }
- }
-
- /**
- * Send the response to the client.
- */
- public function send () {
- header("Content-type:application/json; charset=" . CHARSET);
- echo $this->getData();
- die;
- }
-
- private function getData () {
- $dataObject = array();
- $dataObject["data"] = $this->data;
- if ($this->success) {
- $dataObject["success"] = true;
- $dataObject["message"] = $this->message;
- }
- else {
- $this->error = array(
- "code" => -1,
- "message" => $this->message
- );
- }
- $obj = array(
- "result" => $dataObject,
- "error" => $this->error,
- "id" => $this->id
- );
- return $this->json->encode($obj);
- }
-}
-?>
\ No newline at end of file
Copied: branches/google_dev/trunk/lib/ajax.php (from rev 3867, trunk/mapbender/lib/ajax.php)
===================================================================
--- branches/google_dev/trunk/lib/ajax.php (rev 0)
+++ branches/google_dev/trunk/lib/ajax.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,202 @@
+<?php
+# $Id:database-pgsql.php 2619 2008-07-08 15:46:11Z christoph $
+# http://www.mapbender.org/index.php/database-pgsql.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__) . "/../http/classes/class_json.php");
+
+/**
+ * Represents an incoming JSON-RPC. It will NOT send a response to the client!
+ * (Use AjaxResponse if you also want to send a response.)
+ *
+ * Usually called like this
+ *
+ * $incomingAjax = new AjaxRequest($_REQUEST)
+ *
+ * get parameters of request via
+ *
+ * echo $incomingAjax->getParameter("someAttribute");
+ */
+class AjaxRequest {
+
+ protected $method = "";
+ protected $json = null;
+ protected $id = null;
+ protected $paramObject = array();
+
+ public function __construct ($requestArray) {
+ $this->json = new Mapbender_JSON();
+
+ if (is_array($requestArray)) {
+ $this->initializeFromArray($requestArray);
+ }
+ }
+
+ protected function initializeFromArray ($requestArray) {
+ if ($requestArray["id"]) {
+ $this->id = intval($requestArray["id"]);
+ }
+
+ if ($requestArray["method"]) {
+ $this->method = $requestArray["method"];
+
+ if ($requestArray["params"]) {
+
+ $obj = $this->json->decode(stripslashes($requestArray["params"]));
+ $this->paramObject = $obj;
+ }
+ }
+ }
+
+ public function getMethod () {
+ return $this->method;
+ }
+
+ public function getParameter ($key) {
+ if (is_object($this->paramObject) && $this->paramObject->$key) {
+ return $this->paramObject->$key;
+ }
+ return null;
+ }
+
+ public function getId () {
+ return $this->id;
+ }
+}
+
+/**
+ * Represents an incoming JSON-RPC, which will send a response to the client.
+ *
+ * Usually called like this
+ *
+ * $ajaxResponse = new AjaxResponse($_REQUEST)
+ *
+ *
+ * get parameters of request via
+ *
+ * echo $ajaxResponse->getParameter("someAttribute");
+ *
+ *
+ * set data to be sent back to the client
+ *
+ * $ajaxResponse->setResult("key", "value");
+ *
+ * or
+ *
+ * $ajaxResponse->setResult($assocArray);
+ *
+ *
+ * set the status of this RPC
+ *
+ * $ajaxResponse->setSuccess(false);
+ *
+ * and supply a message
+ *
+ * $ajaxResponse->setMessage("I didn't do it.");
+ *
+ *
+ * Finally send the response
+ *
+ * $ajaxResponse->send();
+ */
+class AjaxResponse extends AjaxRequest {
+ private $data = array();
+ private $success = true;
+ private $error = null;
+ private $message = "";
+
+ public function __construct ($ajaxRequest) {
+ $this->json = new Mapbender_JSON();
+
+ if (is_array($ajaxRequest)) {
+ $this->initializeFromArray($ajaxRequest);
+ }
+
+ // in addition to AjaxRequest, immediately send an
+ // error message to the client, if the request
+ // could not be identified
+ if ($this->id === null) {
+ $this->success = false;
+ $this->message = _mb("Fatal error: Could not detect ID of AJAX request.");
+ $this->send();
+ }
+ }
+
+ /**
+ * Set a message to be sent back to the client.
+ *
+ * @param $aMessage String
+ */
+ public function setMessage ($aMessage) {
+ $this->message = $aMessage;
+ }
+
+ /**
+ * Set status of the RPC.
+ *
+ * @param $trueOrFalse Boolean
+ */
+ public function setSuccess ($trueOrFalse) {
+ $this->success = $trueOrFalse;
+ }
+
+ /**
+ * Compose data to be sent back to the client.
+ * Either by key and value, or by passing the complete associative array.
+ */
+ public function setResult () {
+ if (func_num_args() == 1) {
+ $this->data = func_get_arg(0);
+ }
+ else if (func_num_args() == 2) {
+ $key = func_get_arg(0);
+ $value = func_get_arg(1);
+ $this->data[$key] = $value;
+ }
+ }
+
+ /**
+ * Send the response to the client.
+ */
+ public function send () {
+ header("Content-type:application/json; charset=" . CHARSET);
+ echo $this->getData();
+ die;
+ }
+
+ private function getData () {
+ $dataObject = array();
+ $dataObject["data"] = $this->data;
+ if ($this->success) {
+ $dataObject["success"] = true;
+ $dataObject["message"] = $this->message;
+ }
+ else {
+ $this->error = array(
+ "code" => -1,
+ "message" => $this->message
+ );
+ }
+ $obj = array(
+ "result" => $dataObject,
+ "error" => $this->error,
+ "id" => $this->id
+ );
+ return $this->json->encode($obj);
+ }
+}
+?>
\ No newline at end of file
Deleted: branches/google_dev/trunk/lib/basic.js
===================================================================
--- trunk/mapbender/lib/basic.js 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/basic.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,125 +0,0 @@
-var ie = document.all?1:0;
-var n6 = document.getElementById&&!document.all?1:0;
-var n4 = document.layers?1:0;
-
-var clickX;
-var clickY;
-
-var mb_log = null;
-
-
-// transparent GIF
-var mb_trans = new Image();
-mb_trans.src = "../img/transparent.gif";
-
-/*
- * get the conjunction character of an URL
- * @param {String} onlineresource
- * @return the character & or ?
- * @type String
- */
-function mb_getConjunctionCharacter(onlineresource){
- var conChar;
- if(onlineresource.indexOf("?") > -1){
- if(onlineresource.charAt(onlineresource.length-1) == "?"){
- conChar = "";
- }else if(onlineresource.charAt(onlineresource.length-1) == "&"){
- conChar = "";
- }else{
- conChar = "&";
- }
- }
- if(onlineresource.indexOf("?") == -1){
- conChar = "?";
- }
- return conChar;
-}
-
-function mb_showHighlight(frameName,x,y){
- var pos = makeRealWorld2mapPos(frameName,x, y);
-//TODO frame des Mapobjekts frameName nehmen
- mb_arrangeElement(frameName,"highlight",pos[0]-7, pos[1]-7);
- window.frames[frameName].document.getElementById("highlight").style.visibility = 'visible';
-}
-function mb_hideHighlight(frameName){
- mb_arrangeElement(frameName,"highlight",-20, -20);
- mb_arrangeElement(frameName,"highlight",-20, -20);
- window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
-}
-
-function cloneObject(obj) {
- if (typeof obj !== 'object' || obj === null) {
- return obj;
- }
- var c = obj instanceof Array ? [] : {};
- for (var i in obj) {
- var prop = obj[i];
- if (typeof prop == 'object') {
- if (prop instanceof Array) {
- c[i] = [];
- for (var j = 0; j < prop.length; j++) {
- if (typeof prop[j] != 'object') {
- c[i].push(prop[j]);
- } else {
- c[i].push(cloneObject(prop[j]));
- }
- }
- } else {
- c[i] = cloneObject(prop);
- }
- } else {
- c[i] = prop;
- }
- }
- return c;
-}
-
-function mb_timestamp(){
- var d = new Date();
- var ts = Math.round(Date.parse(d)/1000);
- return ts;
-}
-
-/**
- * @deprecated
- * @param {Object} e
- * @param {Object} fName
- */
-function mb_getMousePos(e,fName){
-
- var warning = new Mb_warning("The function mb_getMousePos is deprecated, use the map objects getMousePosition.");
-
- if(fName){
- if(ie){
- clickX = window.frames[fName].event.clientX;
- clickY = window.frames[fName].event.clientY;
- }
- else{
- clickX = e.pageX;
- clickY = e.pageY;
- }
- }
- else{
- if(ie){
- clickX = event.clientX;
- clickY = event.clientY;
- }
- else{
- clickX = e.pageX;
- clickY = e.pageY;
- }
- }
- var pos = [clickX,clickY];
- return pos;
-}
-
-function mb_arrangeElement(frameName, elName, left, top) {
- if(frameName !== ""){
- window.frames[frameName].document.getElementById(elName).style.top = top;
- window.frames[frameName].document.getElementById(elName).style.left = left;
- }
- else{
- document.getElementById(elName).style.top = top;
- document.getElementById(elName).style.left = left;
- }
-}
\ No newline at end of file
Copied: branches/google_dev/trunk/lib/basic.js (from rev 3900, trunk/mapbender/lib/basic.js)
===================================================================
--- branches/google_dev/trunk/lib/basic.js (rev 0)
+++ branches/google_dev/trunk/lib/basic.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,112 @@
+var ie = document.all?1:0;
+var n6 = document.getElementById&&!document.all?1:0;
+var n4 = document.layers?1:0;
+
+var clickX;
+var clickY;
+
+var mb_log = null;
+
+
+// transparent GIF
+var mb_trans = new Image();
+mb_trans.src = "../img/transparent.gif";
+
+/*
+ * get the conjunction character of an URL
+ * @param {String} onlineresource
+ * @return the character & or ?
+ * @type String
+ */
+function mb_getConjunctionCharacter(onlineresource){
+ var conChar;
+ if(onlineresource.indexOf("?") > -1){
+ if(onlineresource.charAt(onlineresource.length-1) == "?"){
+ conChar = "";
+ }else if(onlineresource.charAt(onlineresource.length-1) == "&"){
+ conChar = "";
+ }else{
+ conChar = "&";
+ }
+ }
+ if(onlineresource.indexOf("?") == -1){
+ conChar = "?";
+ }
+ return conChar;
+}
+
+function mb_showHighlight(frameName,x,y){
+ var pos = makeRealWorld2mapPos(frameName,x, y);
+//TODO frame des Mapobjekts frameName nehmen
+ mb_arrangeElement(frameName,"highlight",pos[0]-7, pos[1]-7);
+ window.frames[frameName].document.getElementById("highlight").style.visibility = 'visible';
+}
+function mb_hideHighlight(frameName){
+ mb_arrangeElement(frameName,"highlight",-20, -20);
+ mb_arrangeElement(frameName,"highlight",-20, -20);
+ window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
+}
+
+function cloneObject (p, c) {
+ var c = c || {};
+ for (var i in p) {
+ if (typeof p[i] === 'object') {
+ c[i] = (p[i].constructor === Array) ? [] : {};
+ cloneObject(p[i], c[i]);
+ }
+ else {
+ c[i] = p[i];
+ }
+ }
+ return c;
+}
+
+function mb_timestamp(){
+ var d = new Date();
+ var ts = Math.round(Date.parse(d)/1000);
+ return ts;
+}
+
+/**
+ * @deprecated
+ * @param {Object} e
+ * @param {Object} fName
+ */
+function mb_getMousePos(e,fName){
+
+ var warning = new Mb_warning("The function mb_getMousePos is deprecated, use the map objects getMousePosition.");
+
+ if(fName){
+ if(ie){
+ clickX = window.frames[fName].event.clientX;
+ clickY = window.frames[fName].event.clientY;
+ }
+ else{
+ clickX = e.pageX;
+ clickY = e.pageY;
+ }
+ }
+ else{
+ if(ie){
+ clickX = event.clientX;
+ clickY = event.clientY;
+ }
+ else{
+ clickX = e.pageX;
+ clickY = e.pageY;
+ }
+ }
+ var pos = [clickX,clickY];
+ return pos;
+}
+
+function mb_arrangeElement(frameName, elName, left, top) {
+ if(frameName !== ""){
+ window.frames[frameName].document.getElementById(elName).style.top = top;
+ window.frames[frameName].document.getElementById(elName).style.left = left;
+ }
+ else{
+ document.getElementById(elName).style.top = top;
+ document.getElementById(elName).style.left = left;
+ }
+}
\ No newline at end of file
Modified: branches/google_dev/trunk/lib/core.js
===================================================================
--- trunk/mapbender/lib/core.js 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/core.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -75,11 +75,6 @@
var eventAfterMapObjectConstruction = new MapbenderEvent(); // possibly obsolete!
/**
- * Triggered after the map has been resized
- */
-var eventResizeMap = new MapbenderEvent();
-
-/**
* deprecated wrapped function
* @deprecated
*/
Deleted: branches/google_dev/trunk/lib/event.js
===================================================================
--- trunk/mapbender/lib/event.js 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/event.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,203 +0,0 @@
-/**
- * An event. What happens, when the event occurs, depends on which functions have been
- * registered with the event.
- *
- * usage:
- *
- * // create a new Event
- * var eventAfterMapRequest = new MapbenderEvent();
- *
- * // register a function with that event
- * eventAfterMapRequest.register(function () {
- * ...
- * })
- *
- * // trigger the event
- * eventAfterMapRequest.trigger();
- *
- */
-var MapbenderEvent = function () {
-
- // public methods
- /**
- * A function that needs to be executed, when the event occurs, has to be
- * registered via this function.
- */
- this.register = function(aFunction, scope) {
-
- var mpbnFunction = new MapbenderFunction(aFunction, scope);
- functionArray.push(mpbnFunction);
- };
-
- /**
- * Exclude a previously registered function from the event
- */
- this.unregister = function(aFunction) {
- for (var i = 0, len = functionArray.length; i < len; i++) {
- if (functionArray[i].getFunction() === aFunction) {
- for (var j = i + 1; j < len; j++) {
- functionArray[j-1] = functionArray[j];
- }
- delete functionArray[len - 1];
- len = len - 1;
- }
- }
- functionArray.length = len;
- };
-
- /**
- * Checks if a function is already registered with this event
- */
- this.isRegistered = function (aFunction) {
- for (var i = 0, len = functionArray.length; i < len; i++) {
- if (functionArray[i].getFunction() === aFunction) {
- return true;
- }
- }
- return false;
- };
-
- /**
- * This function triggers the event
- */
- this.trigger = function(properties, booleanOperator) {
- if (!(functionArray.length > 0)) {
- return true;
- }
- //
- // check arguments
- //
- // properties
- if (typeof(properties) != "object") {
- // maybe properties is missing, and so
- // properties represents booleanOperator
- if (typeof(booleanOperator) == "undefined") {
- booleanOperator = properties;
- properties = undefined;
- }
- else {
-// var e = new Mb_exception("MapbenderEvent.trigger: invalid properties: %s", properties);
- }
- }
-
- // booleanOperator
- if (typeof(booleanOperator) == "string") {
- if (booleanOperator != "AND" && booleanOperator != "OR") {
-// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator: %s", booleanOperator);
- }
- }
- else if (typeof(booleanOperator) != "undefined") {
-// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator, must be a string, but is %s", typeof(booleanOperator));
- }
-
- var result;
-
- // the optional boolean operator allows to combine the return values of the functions
- // into a single result value.
- switch (booleanOperator) {
- case "AND":
- result = true;
- break;
- case "OR":
- result = false;
- break;
- case "CAT":
- result = "";
- break;
- default:
- result = true;
- break;
- }
-
- if (log) {
- var e = new Mb_notice("functions (after sort): " + functionArray.join(","));
- }
-
- for (var i = 0; i < functionArray.length; i++) {
- // executes the function at position i
- // and determines the return value based on the (optional) boolean operator
- switch (booleanOperator) {
- case "AND":
- result = result && functionArray[i].execute(properties);
- break;
- case "OR":
- result = result || functionArray[i].execute(properties);
- break;
- case "CAT":
- result += functionArray[i].execute(properties);
- break;
- default:
- result = functionArray[i].execute(properties);
- break;
- }
- }
- return result;
- };
-
- this.getProperties = function () {
- return propertiesObj;
- };
-
- // private
- /**
- * these functions will be executed once the event is triggered
- */
- var functionArray = [];
-
- var propertiesObj;
- var log = false;
-};
-
-/**
- * A MapbenderFunction is a function with a priority.
- */
-var MapbenderFunction = function (aFunction, aScope) {
-
- // public
- /**
- * Returns the function itself
- */
- this.getFunction = function () {
- return func;
- };
-
- /**
- * Executes the function
- */
- this.execute = function (argumentObj) {
- if (typeof(aFunction) == "function") {
- if (scope) {
- return aFunction.call(scope, argumentObj);
- }
- return func(argumentObj);
- }
-
- // this branch is for backwards compatibility with the
- // pre-2.5 event system that is based on strings.
- else {
- var argumentNames = [];
- var argumentValues = [];
- for (var i in argumentObj) {
- if (typeof(argumentObj[i]) == "number" || typeof(argumentObj[i]) == "boolean") {
- argumentNames.push(i);
- argumentValues.push(argumentObj[i]);
- }
- else if (typeof(argumentObj[i]) == "string") {
- argumentNames.push(i);
- argumentValues.push("'" + argumentObj[i] + "'");
- }
- }
- var str = "";
- str += "(function (" + argumentNames.join(", ") + ") {";
- str += "return " + aFunction;
- str += "}";
- str += "(" + argumentValues.join(", ") + "));";
- var returnValue = eval(str);
- return returnValue;
- }
- };
-
- // private
- var func = aFunction;
- var scope = aScope;
-};
\ No newline at end of file
Copied: branches/google_dev/trunk/lib/event.js (from rev 3855, trunk/mapbender/lib/event.js)
===================================================================
--- branches/google_dev/trunk/lib/event.js (rev 0)
+++ branches/google_dev/trunk/lib/event.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,203 @@
+/**
+ * An event. What happens, when the event occurs, depends on which functions have been
+ * registered with the event.
+ *
+ * usage:
+ *
+ * // create a new Event
+ * var eventAfterMapRequest = new MapbenderEvent();
+ *
+ * // register a function with that event
+ * eventAfterMapRequest.register(function () {
+ * ...
+ * })
+ *
+ * // trigger the event
+ * eventAfterMapRequest.trigger();
+ *
+ */
+var MapbenderEvent = function () {
+
+ // public methods
+ /**
+ * A function that needs to be executed, when the event occurs, has to be
+ * registered via this function.
+ */
+ this.register = function(aFunction, scope) {
+
+ var mpbnFunction = new MapbenderFunction(aFunction, scope);
+ functionArray.push(mpbnFunction);
+ };
+
+ /**
+ * Exclude a previously registered function from the event
+ */
+ this.unregister = function(aFunction) {
+ for (var i = 0, len = functionArray.length; i < len; i++) {
+ if (functionArray[i].getFunction() === aFunction) {
+ for (var j = i + 1; j < len; j++) {
+ functionArray[j-1] = functionArray[j];
+ }
+ delete functionArray[len - 1];
+ len = len - 1;
+ }
+ }
+ functionArray.length = len;
+ };
+
+ /**
+ * Checks if a function is already registered with this event
+ */
+ this.isRegistered = function (aFunction) {
+ for (var i = 0, len = functionArray.length; i < len; i++) {
+ if (functionArray[i].getFunction() === aFunction) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ /**
+ * This function triggers the event
+ */
+ this.trigger = function(properties, booleanOperator) {
+ if (!(functionArray.length > 0)) {
+ return true;
+ }
+ //
+ // check arguments
+ //
+ // properties
+ if (typeof(properties) != "object") {
+ // maybe properties is missing, and so
+ // properties represents booleanOperator
+ if (typeof(booleanOperator) == "undefined") {
+ booleanOperator = properties;
+ properties = undefined;
+ }
+ else {
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid properties: %s", properties);
+ }
+ }
+
+ // booleanOperator
+ if (typeof(booleanOperator) == "string") {
+ if (booleanOperator != "AND" && booleanOperator != "OR") {
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator: %s", booleanOperator);
+ }
+ }
+ else if (typeof(booleanOperator) != "undefined") {
+// var e = new Mb_exception("MapbenderEvent.trigger: invalid booleanOperator, must be a string, but is %s", typeof(booleanOperator));
+ }
+
+ var result;
+
+ // the optional boolean operator allows to combine the return values of the functions
+ // into a single result value.
+ switch (booleanOperator) {
+ case "AND":
+ result = true;
+ break;
+ case "OR":
+ result = false;
+ break;
+ case "CAT":
+ result = "";
+ break;
+ default:
+ result = true;
+ break;
+ }
+
+ if (log) {
+ var e = new Mb_notice("functions (after sort): " + functionArray.join(","));
+ }
+
+ for (var i = 0; i < functionArray.length; i++) {
+ // executes the function at position i
+ // and determines the return value based on the (optional) boolean operator
+ switch (booleanOperator) {
+ case "AND":
+ result = result && functionArray[i].execute(properties);
+ break;
+ case "OR":
+ result = result || functionArray[i].execute(properties);
+ break;
+ case "CAT":
+ result += functionArray[i].execute(properties);
+ break;
+ default:
+ result = functionArray[i].execute(properties);
+ break;
+ }
+ }
+ return result;
+ };
+
+ this.getProperties = function () {
+ return propertiesObj;
+ };
+
+ // private
+ /**
+ * these functions will be executed once the event is triggered
+ */
+ var functionArray = [];
+
+ var propertiesObj;
+ var log = false;
+};
+
+/**
+ * A MapbenderFunction is a function with a priority.
+ */
+var MapbenderFunction = function (aFunction, aScope) {
+
+ // public
+ /**
+ * Returns the function itself
+ */
+ this.getFunction = function () {
+ return func;
+ };
+
+ /**
+ * Executes the function
+ */
+ this.execute = function (argumentObj) {
+ if (typeof(func) == "function" || typeof(func) == "object") {
+ if (scope) {
+ return func.call(scope, argumentObj);
+ }
+ return func(argumentObj);
+ }
+
+ // this branch is for backwards compatibility with the
+ // pre-2.5 event system that is based on strings.
+ else {
+ var argumentNames = [];
+ var argumentValues = [];
+ for (var i in argumentObj) {
+ if (typeof(argumentObj[i]) == "number" || typeof(argumentObj[i]) == "boolean") {
+ argumentNames.push(i);
+ argumentValues.push(argumentObj[i]);
+ }
+ else if (typeof(argumentObj[i]) == "string") {
+ argumentNames.push(i);
+ argumentValues.push("'" + argumentObj[i] + "'");
+ }
+ }
+ var str = "";
+ str += "(function (" + argumentNames.join(", ") + ") {";
+ str += "return " + aFunction;
+ str += "}";
+ str += "(" + argumentValues.join(", ") + "));";
+ var returnValue = eval(str);
+ return returnValue;
+ }
+ };
+
+ // private
+ var func = aFunction;
+ var scope = aScope;
+};
Modified: branches/google_dev/trunk/lib/point.js
===================================================================
--- trunk/mapbender/lib/point.js 2009-03-13 16:26:06 UTC (rev 3711)
+++ branches/google_dev/trunk/lib/point.js 2009-06-02 15:24:25 UTC (rev 3979)
@@ -162,7 +162,7 @@
new_min = new Point(min.x, center.y - relation_px_y * extent.x / 2);
new_max = new Point(max.x, center.y + relation_px_y * extent.x / 2);
}
- mb_mapObj[ind].extent = new_min.x +","+ new_min.y +","+ new_max.x +","+ new_max.y;
+ mb_mapObj[ind].extent.set(new_min, new_max);
}
/**
* @ignore
Copied: branches/google_dev/trunk/license/Liberation-License.txt (from rev 3767, trunk/mapbender/license/Liberation-License.txt)
===================================================================
--- branches/google_dev/trunk/license/Liberation-License.txt (rev 0)
+++ branches/google_dev/trunk/license/Liberation-License.txt 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,19 @@
+LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY
+LIBERATION FONT SOFTWARE
+
+This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement.
+
+ 1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions:
+
+ (a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+
+ (b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it.
+
+ 2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software.
+
+ 3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation.
+
+ 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages.
+
+ 5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply.
+Copyright é 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
Copied: branches/google_dev/trunk/license/bitstream-COPYRIGHT.TXT (from rev 3767, trunk/mapbender/license/bitstream-COPYRIGHT.TXT)
===================================================================
--- branches/google_dev/trunk/license/bitstream-COPYRIGHT.TXT (rev 0)
+++ branches/google_dev/trunk/license/bitstream-COPYRIGHT.TXT 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,124 @@
+Bitstream Vera Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as
+long as "Bitstream" or "Vera" are not in the names), and full
+redistribution (so long as they are not *sold* by themselves). They
+can be be bundled, redistributed and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright
+=========
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
+Vera is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute
+the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Bitstream Vera" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
+SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font
+Software without prior written authorization from the Gnome Foundation
+or Bitstream Inc., respectively. For further information, contact:
+fonts at gnome dot org.
+
+Copyright FAQ
+=============
+
+ 1. I don't understand the resale restriction... What gives?
+
+ Bitstream is giving away these fonts, but wishes to ensure its
+ competitors can't just drop the fonts as is into a font sale system
+ and sell them as is. It seems fair that if Bitstream can't make money
+ from the Bitstream Vera fonts, their competitors should not be able to
+ do so either. You can sell the fonts as part of any software package,
+ however.
+
+ 2. I want to package these fonts separately for distribution and
+ sale as part of a larger software package or system. Can I do so?
+
+ Yes. A RPM or Debian package is a "larger software package" to begin
+ with, and you aren't selling them independently by themselves.
+ See 1. above.
+
+ 3. Are derivative works allowed?
+ Yes!
+
+ 4. Can I change or add to the font(s)?
+ Yes, but you must change the name(s) of the font(s).
+
+ 5. Under what terms are derivative works allowed?
+
+ You must change the name(s) of the fonts. This is to ensure the
+ quality of the fonts, both to protect Bitstream and Gnome. We want to
+ ensure that if an application has opened a font specifically of these
+ names, it gets what it expects (though of course, using fontconfig,
+ substitutions could still could have occurred during font
+ opening). You must include the Bitstream copyright. Additional
+ copyrights can be added, as per copyright law. Happy Font Hacking!
+
+ 6. If I have improvements for Bitstream Vera, is it possible they might get
+ adopted in future versions?
+
+ Yes. The contract between the Gnome Foundation and Bitstream has
+ provisions for working with Bitstream to ensure quality additions to
+ the Bitstream Vera font family. Please contact us if you have such
+ additions. Note, that in general, we will want such additions for the
+ entire family, not just a single font, and that you'll have to keep
+ both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add
+ glyphs to the font, they must be stylistically in keeping with Vera's
+ design. Vera cannot become a "ransom note" font. Jim Lyles will be
+ providing a document describing the design elements used in Vera, as a
+ guide and aid for people interested in contributing to Vera.
+
+ 7. I want to sell a software package that uses these fonts: Can I do so?
+
+ Sure. Bundle the fonts with your software and sell your software
+ with the fonts. That is the intent of the copyright.
+
+ 8. If applications have built the names "Bitstream Vera" into them,
+ can I override this somehow to use fonts of my choosing?
+
+ This depends on exact details of the software. Most open source
+ systems and software (e.g., Gnome, KDE, etc.) are now converting to
+ use fontconfig (see www.fontconfig.org) to handle font configuration,
+ selection and substitution; it has provisions for overriding font
+ names and subsituting alternatives. An example is provided by the
+ supplied local.conf file, which chooses the family Bitstream Vera for
+ "sans", "serif" and "monospace". Other software (e.g., the XFree86
+ core server) has other mechanisms for font substitution.
+
Copied: branches/google_dev/trunk/license/dejavu-LICENSE (from rev 3767, trunk/mapbender/license/dejavu-LICENSE)
===================================================================
--- branches/google_dev/trunk/license/dejavu-LICENSE (rev 0)
+++ branches/google_dev/trunk/license/dejavu-LICENSE 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,99 @@
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
Copied: branches/google_dev/trunk/resources (from rev 3874, trunk/mapbender/resources)
Deleted: branches/google_dev/trunk/resources/db/update/update_2.7.sql
===================================================================
--- trunk/mapbender/resources/db/update/update_2.7.sql 2009-04-14 15:52:41 UTC (rev 3874)
+++ branches/google_dev/trunk/resources/db/update/update_2.7.sql 2009-06-02 15:24:25 UTC (rev 3979)
@@ -1,9 +0,0 @@
--- remove event handlers, are now in the script
-UPDATE gui_element SET e_attributes = '' WHERE e_id = 'selArea1';
-UPDATE gui_element SET e_attributes = '' WHERE e_id = 'pan1';
-UPDATE gui_element SET e_content = '' WHERE e_id = 'navFrame';
-
-
---
--- new definition of addWMSfromfilteredList_ajax due to i18n
-UPDATE gui_element set e_attributes = '', e_js_file = 'mod_addWmsFromFilteredList_button.php' where e_id = 'addWMSfromfilteredList_ajax';
\ No newline at end of file
Copied: branches/google_dev/trunk/resources/db/update/update_2.7.sql (from rev 3904, trunk/mapbender/resources/db/update/update_2.7.sql)
===================================================================
--- branches/google_dev/trunk/resources/db/update/update_2.7.sql (rev 0)
+++ branches/google_dev/trunk/resources/db/update/update_2.7.sql 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,10 @@
+-- remove event handlers, are now in the script
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'selArea1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'pan1';
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'featureInfo1';
+UPDATE gui_element SET e_content = '' WHERE e_id = 'navFrame';
+
+
+--
+-- new definition of addWMSfromfilteredList_ajax due to i18n
+UPDATE gui_element set e_attributes = '', e_js_file = 'mod_addWmsFromFilteredList_button.php' where e_id = 'addWMSfromfilteredList_ajax';
\ No newline at end of file
Copied: branches/google_dev/trunk/tools (from rev 3835, trunk/mapbender/tools)
Copied: branches/google_dev/trunk/tools/send_post_curl.php (from rev 3963, trunk/mapbender/tools/send_post_curl.php)
===================================================================
--- branches/google_dev/trunk/tools/send_post_curl.php (rev 0)
+++ branches/google_dev/trunk/tools/send_post_curl.php 2009-06-02 15:24:25 UTC (rev 3979)
@@ -0,0 +1,127 @@
+<html>
+<head>
+<?php
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+<title>Test POST/SOAP Communication for CSW/WFS</title>
+</head>
+<?php
+if(isset($_REQUEST["filter"]) && $_REQUEST["filter"] != "" && $_REQUEST["onlineresource"] != ''){
+ $arURL = parse_url($_REQUEST["onlineresource"]);
+ $host = $arURL["host"];
+ $port = $arURL["port"];
+ $doSOAP=false;
+ if ($_REQUEST["soap"]=='true') {
+ $doSOAP=true;
+ }
+ if($port == ''){
+ $port = 80;
+ }
+ $path = $arURL["path"];
+ $method = "POST";
+ $data = stripslashes($_REQUEST["filter"]);
+ $dataXMLObject = new SimpleXMLElement($data);
+ $datanew = $dataXMLObject->asXML();
+ $headers = array(
+ "POST ".$path." HTTP/1.1",
+ "Content-type: text/xml; charset=\"utf-8\"",
+ "Cache-Control: no-cache",
+ "Pragma: no-cache",
+ "Content-length: ".strlen($datanew)
+ );
+ if ($doSOAP) {
+ $soapHead = "<soapenv:Envelope ";
+ $soapHead .= "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" ";
+ $soapHead .= "xmlns:xi=\"http://www.w3.org/2001/XInclude\" ";
+ $soapHead .= "xmlns:dct=\"http://purl.org/dc/terms/\" ";
+ $soapHead .= "xmlns:ows=\"http://www.opengis.net/ows\" ";
+ $soapHead .= "xmlns:xlink=\"http://www.w3.org/1999/xlink\" ";
+ $soapHead .= "xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" ";
+ $soapHead .= "xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">\n";
+ $soapHead .= "<soapenv:Header/>\n";
+ $soapHead .= "<soapenv:Body>\n";
+ $soapFoot = "</soapenv:Body>\n";
+ $soapFoot .= "</soapenv:Envelope>\n";
+ $data = $soapHead.$data.$soapFoot;
+ $dataXMLObject = new SimpleXMLElement($data);
+ $datanew = $dataXMLObject->asXML();
+ $headers = array(
+ "POST ".$path." HTTP/1.1",
+ "Content-type: application/soap+xml; charset=\"utf-8\"",
+ "Cache-Control: no-cache",
+ "Pragma: no-cache",
+ "SOAPAction: \"run\"",
+ "Content-length: ".strlen($datanew)
+ );
+ }
+ //do curl connection and request
+ $out = getCURL($_REQUEST["onlineresource"],$datanew,$headers,$doSOAP);
+}
+//of class_connector
+function getCURL($url,$data,$headers,$doSOAP){
+ $ch = curl_init ($url);
+ $arURL = parse_url($url);
+ $host = $arURL["host"];
+ $port = $arURL["port"];
+ if($port == ''){
+ $port = 80;
+ }
+ $path = $arURL["path"];
+ curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
+ //or with own headers
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ if(CONNECTION_PROXY != ""){
+ curl_setopt($ch, CURLOPT_PROXY,CONNECTION_PROXY.":".CONNECTION_PORT);
+ }
+ if(CONNECTION_PASSWORD != ""){
+ curl_setopt ($ch, CURLOPT_PROXYUSERPWD, CONNECTION_USER.':'.CONNECTION_PASSWORD);
+ }
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
+ $useragent='GeoPortal Rheinland-Pfalz Testsystem';
+ curl_setopt ($ch,CURLOPT_USERAGENT,$useragent);
+ $file = curl_exec ($ch);
+ curl_close ($ch);
+ $e = new mb_exception("send_post_curl.php: url " . $url);
+ $e = new mb_exception("send_post_curl.php: send post " . $data);
+ $e = new mb_exception("send_post_curl.php: response " . $file);
+ return $file;
+ }
+?>
+<body>
+<form action='send_post_curl.php' method='post'>
+OnlineResource (Choose the right one out of the Capabilities - SOAP and POST may differ!):<br>
+<input name='onlineresource' type='text' size='100' value='<?php echo $_REQUEST["onlineresource"]; ?>'>
+<br>
+Use SOAP <input type='checkbox' id='soap' name='soap' value='true'><br>
+Filter:<br>
+<textarea name='filter' cols='100' rows='15'><?php echo stripslashes($_REQUEST["filter"]); ?></textarea><br>
+Filter which is posted (maybe SOAP):<br>
+<textarea name='postfilter' cols='100' rows='15'><?php echo $datanew; ?></textarea><br>
+<input type='submit' value='submit'><br>
+HTTP Headers of sended Request (php array):<br>
+<textarea name='headers' cols='100' rows='5'><?php print_r($headers); ?></textarea><br>
+<br>
+Response:<br>
+<textarea name='response' cols='100' rows='30'><?php echo htmlentities($out); ?></textarea><br>
+</form>
+</body>
+</html>
More information about the Mapbender_commits
mailing list