[Mapbender-commits] r7092 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Nov 4 15:06:12 EDT 2010
Author: armin11
Date: 2010-11-04 12:06:12 -0700 (Thu, 04 Nov 2010)
New Revision: 7092
Added:
trunk/mapbender/http/php/mod_acceptedTou_server.php
Modified:
trunk/mapbender/http/php/mod_savewmc_server.php
trunk/mapbender/http/php/mod_showMetadata.php
Log:
Some bugfixes and enhancements of metadata show module.
Added: trunk/mapbender/http/php/mod_acceptedTou_server.php
===================================================================
--- trunk/mapbender/http/php/mod_acceptedTou_server.php (rev 0)
+++ trunk/mapbender/http/php/mod_acceptedTou_server.php 2010-11-04 19:06:12 UTC (rev 7092)
@@ -0,0 +1,44 @@
+<?php
+require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+require_once(dirname(__FILE__) . "/../classes/class_tou.php");
+
+//ajax wrapper for class_tou.php
+
+$ajaxResponse = new AjaxResponse($_POST);
+$json = new Mapbender_JSON();
+$touObject = new tou();
+
+//$currentUser = new User();
+//$wmc = new wmc();
+
+$resultObj = array();
+//obj structure in session for acceptedTou (see class_tou.php):
+//acceptedTou {
+// wms [100,101,112],
+// wfs [12,34]
+// }
+switch ($ajaxResponse->getMethod()) {
+
+ case 'checkAcceptedTou':
+ $result = $touObject->check($ajaxResponse->getParameter("serviceType"),$ajaxResponse->getParameter("serviceId"));
+ $ajaxResponse->setResult($result['accepted']); //1 or 0
+ $ajaxResponse->setMessage(_mb($result['message']));
+ $ajaxResponse->setSuccess(true);
+ break;
+ case 'setAcceptedTou':
+ $serviceType = $ajaxResponse->getParameter("serviceType");
+ $serviceId = $ajaxResponse->getParameter("serviceId");
+ $result = $touObject->set($ajaxResponse->getParameter("serviceType"),$ajaxResponse->getParameter("serviceId"));
+ $ajaxResponse->setResult($result['setTou']); //1 or 0
+ $ajaxResponse->setMessage(_mb($result['message']));
+ $ajaxResponse->setSuccess(true);
+ break;
+ // Invalid command
+ default:
+ $ajaxResponse->setMessage(_mb("No method specified."));
+ $ajaxResponse->setSuccess(false);
+}
+
+$ajaxResponse->send();
+?>
Modified: trunk/mapbender/http/php/mod_savewmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_savewmc_server.php 2010-11-04 15:34:53 UTC (rev 7091)
+++ trunk/mapbender/http/php/mod_savewmc_server.php 2010-11-04 19:06:12 UTC (rev 7092)
@@ -71,7 +71,8 @@
exit;
}
foreach($mapObject as $map) {
- if (isset($mapObject->isOverview) && $mapObject->isOverview == "1") { continue; }
+ #$e = new mb_exception("mod_savewmc_server.php: isOverview".$map->isOverview);
+ if (isset($map->isOverview) && $map->isOverview == "1") { continue; }
$wmc->wmc_extent = $map->extent;
$wmc->wmc_srs = $map->epsg;
}
@@ -91,4 +92,4 @@
}
$ajaxResponse->send();
-?>
\ No newline at end of file
+?>
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2010-11-04 15:34:53 UTC (rev 7091)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2010-11-04 19:06:12 UTC (rev 7092)
@@ -140,6 +140,7 @@
$translation['minscale'] = 'Minimaler Maßstab';
$translation['maxscale'] = 'Maximaler Maßstab';
$translation['crs'] = 'Koordinatenreferenzsysteme (mit BBOX)';
+ $translation['wmccrs'] = 'Eingestelltes Koordinatenreferenzsystem';
$translation['wgs84Bbox'] = 'Eckpunkte in geogr. Koordinaten';
$translation['wgs84BboxGraphic'] = 'Kartenübersicht';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
@@ -194,6 +195,7 @@
$translation['minscale'] = 'Minimum scale';
$translation['maxscale'] = 'Maximum scale';
$translation['crs'] = 'Coordinate Reference System';
+ $translation['wmccrs'] = 'Used Coordinate Reference System';
$translation['wgs84Bbox'] = 'Corner in geographic Coordinates';
$translation['wgs84BboxGraphic'] = 'Map View';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
@@ -248,6 +250,7 @@
$translation['minscale'] = 'Minimum scale';
$translation['maxscale'] = 'Maximum scale';
$translation['crs'] = 'Coordinate Reference System';
+ $translation['wmccrs'] = 'Used Coordinate Reference System';
$translation['wgs84Bbox'] = 'Corner in geographic Coordinates';
$translation['wgs84BboxGraphic'] = 'Map View';
$translation['mapbenderCapabilities'] = 'Geoportal Capabilities';
@@ -330,7 +333,7 @@
case "wmc":
$wmcId = $id;
$sql = "SELECT ";
- $sql .= "mb_user_wmc.wmc_serial_id as contentid, mb_user_wmc.wmc_title as contenttitle, mb_user_wmc.abstract as contentabstract, mb_user_wmc.minx,mb_user_wmc.miny,mb_user_wmc.maxx,mb_user_wmc.maxy,mb_user_wmc.srs, ";
+ $sql .= "mb_user_wmc.wmc_serial_id as contentid, mb_user_wmc.wmc_title as contenttitle, mb_user_wmc.abstract as contentabstract, mb_user_wmc.minx as contentminx,mb_user_wmc.miny as contentminy,mb_user_wmc.maxx as contentmaxx,mb_user_wmc.maxy as contentmaxy,mb_user_wmc.srs as contentcrs, ";
$sql .= "mb_user.mb_user_position_name as contactposition, mb_user.mb_user_organisation_name as contactorganization, (mb_user.mb_user_street || ' ' || mb_user.mb_user_housenumber) as address, mb_user.mb_user_city as city, mb_user_wmc.wmc_timestamp as timestamp, mb_user_wmc.fkey_user_id as owner,";
$sql .= "mb_user.mb_user_country as stateorprovince, mb_user.mb_user_postal_code as postcode, mb_user.mb_user_phone as contactvoicetelephone, mb_user.mb_user_phone1 as contactfacsimiletelephone, ";
$sql .= "mb_user.mb_user_email as contactelectronicmailaddress ";
@@ -665,17 +668,47 @@
}
}
$epsgString = '';
-for ($j = 0; $j < count($contentBboxes); $j++) {
+if ($resource != 'wmc') {
+ for ($j = 0; $j < count($contentBboxes); $j++) {
$epsgString .= $contentBboxes[$j]['epsg']." ";
if ($contentBboxes[$j]['epsg'] == 'EPSG:4326') {
$wgs84Bbox = $contentBboxes[$j]['minx'].",".$contentBboxes[$j]['miny'].",".$contentBboxes[$j]['maxx'].",".$contentBboxes[$j]['maxy'];
-
- $getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox),$layerId);
+ $getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
}
+
+ }
+$html .= $t_a.$translation['crs'].$t_b.$epsgString.$t_c;
}
+if ($resource == 'wmc') {
+ $epsgString .= $resourceMetadata['contentcrs']." ";
+ if ($resourceMetadata['contentcrs'] == 'EPSG:4326') {
+ $wgs84Bbox = $resourceMetadata['contentminx'].",".$resourceMetadata['contentminy'].",".$resourceMetadata['contentmaxx'].",".$resourceMetadata['contentmaxy'];
+ $getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+ } elseif ($resourceMetadata['contentcrs'] != ''){
+ //transform crs
+ $oldEPSG = preg_replace("/EPSG:/","", $resourceMetadata['contentcrs']);
+ $ll = transform(
+ floatval($resourceMetadata['contentminx']),
+ floatval($resourceMetadata['contentminy']),
+ $oldEPSG,
+ "4326"
+ );
+ $ur = transform(
+ floatval($resourceMetadata['contentmaxx']),
+ floatval($resourceMetadata['contentmaxy']),
+ $oldEPSG,
+ "4326"
+ );
+ $wgs84Bbox = round($ll["x"],4).",".round($ll["y"],4).",".round($ur["x"],4).",".round($ur["y"],4);
+ $getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+ }
+$html .= $t_a.$translation['wmccrs'].$t_b.$epsgString.$t_c;
+}
-$html .= $t_a.$translation['crs'].$t_b.$epsgString.$t_c;
+
+
if (isset($wgs84Bbox)) {
+
$html .= $t_a.$translation['wgs84Bbox'].$t_b.$wgs84Bbox.$t_c;
if (defined('EXTENTSERVICEURL')) {
$html .= $t_a.$translation['wgs84BboxGraphic'].$t_b."<img src='".$getMapUrl."'>".$t_c;
@@ -855,7 +888,7 @@
$string = mb_eregi_replace("\n", "<br>", $string);
return $string;
}
-function getExtentGraphic($layer_4326_box, $layerId) {
+function getExtentGraphic($layer_4326_box) {
$rlp_4326_box = array(6.05,48.9,8.6,50.96);
if ($layer_4326_box[0] <= $rlp_4326_box[0] || $layer_4326_box[2] >= $rlp_4326_box[2] || $layer_4326_box[1] <= $rlp_4326_box[1] || $layer_4326_box[3] >= $rlp_4326_box[3]) {
if ($layer_4326_box[0] < $rlp_4326_box[0]) {
@@ -887,4 +920,25 @@
$getMapUrl = EXTENTSERVICEURL."VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=".EXTENTSERVICELAYER."&STYLES=&SRS=EPSG:4326&BBOX=".$rlp_4326_box[0].",".$rlp_4326_box[1].",".$rlp_4326_box[2].",".$rlp_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&minx=".$layer_4326_box[0]."&miny=".$layer_4326_box[1]."&maxx=".$layer_4326_box[2]."&maxy=".$layer_4326_box[3];
return $getMapUrl;
}
+//from php/mod_coordsLookup_server.php
+function transform ($x, $y, $oldEPSG, $newEPSG) {
+ if (is_null($x) || !is_numeric($x) ||
+ is_null($y) || !is_numeric($y) ||
+ is_null($oldEPSG) || !is_numeric($oldEPSG) ||
+ is_null($newEPSG) || !is_numeric($newEPSG)) {
+ return null;
+ }
+ $sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$x." ".$y.")',".$oldEPSG."),".$newEPSG.")) as minx";
+ $resMinx = db_query($sqlMinx);
+ $minx = floatval(db_result($resMinx,0,"minx"));
+
+ $sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$x." ".$y.")',".$oldEPSG."),".$newEPSG.")) as miny";
+ $resMiny = db_query($sqlMiny);
+ $miny = floatval(db_result($resMiny,0,"miny"));
+
+ return array("x" => $minx, "y" => $miny);
+
+}
+
+
?>
More information about the Mapbender_commits
mailing list