From 1a216ccec3a93f38f6f5ba2dfb8fc30683661daf Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 19 Jan 2010 15:49:34 +0000 Subject: [PATCH] 2010-01-18 Miguel de Dios * include/functions_gis.php, operation/gis_maps/ajax.php: code for GIS maps, now show correctly the path points and start to show the popup for this points. * include/javascript/OpenLayers/lib/Gears/gears_init.js, include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js: some files of OpenLayers that I erased in the previous clean. * images/spinner.gif: image for ajax loading. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2287 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 + pandora_console/images/spinner.gif | Bin 0 -> 673 bytes pandora_console/include/functions_gis.php | 349 ++++++++++++++++++ .../OpenLayers/lib/Gears/gears_init.js | 88 +++++ .../lib/OpenLayers/Format/ArcXML/Features.js | 48 +++ pandora_console/operation/gis_maps/ajax.php | 65 ++++ 6 files changed, 560 insertions(+) create mode 100644 pandora_console/images/spinner.gif create mode 100644 pandora_console/include/functions_gis.php create mode 100755 pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js create mode 100755 pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js create mode 100644 pandora_console/operation/gis_maps/ajax.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 6a47706ecc..7f23c3e203 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2010-01-18 Miguel de Dios + + * include/functions_gis.php, operation/gis_maps/ajax.php: code for GIS maps, + now show correctly the path points and start to show the popup for this + points. + * include/javascript/OpenLayers/lib/Gears/gears_init.js, + include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js: + some files of OpenLayers that I erased in the previous clean. + * images/spinner.gif: image for ajax loading. + 2010-01-18 Miguel de Dios * operation/visual_console/render_view.php: fix style, add a white space. diff --git a/pandora_console/images/spinner.gif b/pandora_console/images/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2a1bc0c6f545e20e631a96e8e92f9822e75d046 GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nnmm28Kh24mmkF0U1e2Nli^nlO|14{3qpHl$uzQnxasi zS(2fUn3Y(Olb@KPmzkHA&!G5|g@FsGT=74*pKD04vtxj(k)8oFBTz^Oh=E26FfcG1 zbL_hF&)}42ws10s6^G;;cE1^EoUR)U5A70}d2pLv!jVIT7j&Z~EblI3x0K*v_sV|m z0W=b9G$XP(CLnYCdK49;TX=SFc-G}o=oA=|U?{1O;Nu!CwW3C5Yw7*Bi4yD$3fCnb zwK+>}QdQ9sf*QnxY>*kpE+b{_Q;sJloS71)&(@kO!}mqf@1v(v;*8Y=G9S3kY~Cw# zY=t&c z;3~JK4HxB^lY(MD+sYeQ=t%XSSW;x^1M?dTvN=W^yNcAcy`HCte31C;)5xP%b~qs> zDP&4(%TBqBNGHwnryK;BdMI$fEg xd0mc!C@j^ZpLxYv4HmnPfI0THYuv<%+6iSmMn&w3dPGDfL1|=LY008wP(boU~ literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php new file mode 100644 index 0000000000..296edec4f9 --- /dev/null +++ b/pandora_console/include/functions_gis.php @@ -0,0 +1,349 @@ + + + + + + + + + + 0, 'longitude' => -3.709, 'latitude' => 40.422, 'altitude' => 0, 'manual_placemen' => 1), + array('id_tgis_data' => 1, 'longitude' => -3.710, 'latitude' => 40.420, 'altitude' => 0, 'manual_placemen' => 0), + array('id_tgis_data' => 2, 'longitude' => -3.711, 'latitude' => 40.420, 'altitude' => 0, 'manual_placemen' => 1), + array('id_tgis_data' => 3, 'longitude' => -3.712, 'latitude' => 40.422, 'altitude' => 0, 'manual_placemen' => 0), + array('id_tgis_data' => 4, 'longitude' => -3.708187, 'latitude' => 40.42056, 'altitude' => 0, 'manual_placemen' => 0) + ); + + $avaliableColors = array("#ff0000", "#00ff00", "#0000ff", "#000000"); + + $color = $avaliableColors[array_rand($avaliableColors)]; + ?> + + \ No newline at end of file diff --git a/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js b/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js new file mode 100755 index 0000000000..d531a3f5bb --- /dev/null +++ b/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js @@ -0,0 +1,88 @@ +/* + * Copyright 2007, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Google Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Sets up google.gears.*, which is *the only* supported way to access Gears. + * + * Circumvent this file at your own risk! + * + * In the future, Gears may automatically define google.gears.* without this + * file. Gears may use these objects to transparently fix bugs and compatibility + * issues. Applications that use the code below will continue to work seamlessly + * when that happens. + */ + +(function() { + // We are already defined. Hooray! + if (window.google && google.gears) { + return; + } + + var factory = null; + + // Firefox + if (typeof GearsFactory != 'undefined') { + factory = new GearsFactory(); + } else { + // IE + try { + factory = new ActiveXObject('Gears.Factory'); + // privateSetGlobalObject is only required and supported on WinCE. + if (factory.getBuildInfo().indexOf('ie_mobile') != -1) { + factory.privateSetGlobalObject(this); + } + } catch (e) { + // Safari + if ((typeof navigator.mimeTypes != 'undefined') + && navigator.mimeTypes["application/x-googlegears"]) { + factory = document.createElement("object"); + factory.style.display = "none"; + factory.width = 0; + factory.height = 0; + factory.type = "application/x-googlegears"; + document.documentElement.appendChild(factory); + } + } + } + + // *Do not* define any objects if Gears is not installed. This mimics the + // behavior of Gears defining the objects in the future. + if (!factory) { + return; + } + + // Now set up the objects, being careful not to overwrite anything. + // + // Note: In Internet Explorer for Windows Mobile, you can't add properties to + // the window object. However, global objects are automatically added as + // properties of the window object in all browsers. + if (!window.google) { + google = {}; + } + + if (!google.gears) { + google.gears = {factory: factory}; + } +})(); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js new file mode 100755 index 0000000000..7e71feb201 --- /dev/null +++ b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js @@ -0,0 +1,48 @@ +/* Copyright (c) 2009 MetaCarta, Inc., published under the Clear BSD + * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Format/ArcXML.js + */ + +/** + * Class: OpenLayers.Format.ArcXML.Features + * Read/Wite ArcXML features. Create a new instance with the + * constructor. + * + * Inherits from: + * - + */ +OpenLayers.Format.ArcXML.Features = OpenLayers.Class(OpenLayers.Format.XML, { + + /** + * Constructor: OpenLayers.Format.ArcXML.Features + * Create a new parser/writer for ArcXML Features. Create an instance of this class + * to get a set of features from an ArcXML response. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + initialize: function(options) { + OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); + }, + + /** + * APIMethod: read + * Read data from a string of ArcXML, and return a set of OpenLayers features. + * + * Parameters: + * data - {String} or {DOMElement} data to read/parse. + * + * Returns: + * {Array()} A collection of features. + */ + read: function(data) { + var axl = new OpenLayers.Format.ArcXML(); + var parsed = axl.read(data); + + return parsed.features.feature; + } +}); diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php new file mode 100644 index 0000000000..3fb213a52a --- /dev/null +++ b/pandora_console/operation/gis_maps/ajax.php @@ -0,0 +1,65 @@ + 0, 'longitude' => -3.709, + 'latitude' => 40.422, 'altitude' => 0, 'end_timestamp' => '2010-01-14 17:19:45', 'start_timestamp' => '2010-01-12 17:19:45', 'manual_placemen' => 1, 'tagente_id_agente' => 1); + + $returnJSON = array(); + $returnJSON['correct'] = 1; + $returnJSON['content'] = __('Agent') . ': pepito
'; + $returnJSON['content'] .= __('Position') . ': (' . $row['longitude'] . ', ' . $row['latitude'] . ', ' . $row['altitude'] . ')
'; + $returnJSON['content'] .= __('Start contact') . ': ' . $row['start_timestamp'] . '
'; + $returnJSON['content'] .= __('Last contact') . ': ' . $row['end_timestamp'] . '
'; + $returnJSON['content'] .= __('Num reports') . ': 666
'; //$row['num_packages']; //TODO + if ($row['manual_placemen']) $returnJSON['content'] .= '
' . __('Manual placement') . '
'; + + echo json_encode($returnJSON); + + break; +} +// $returnJSON = array(); +// +// $returnJSON['correct'] = 1; +// $returnJSON['content'] = ''; +// +// //echo json_encode($returnJSON); +// break; +//} +// +//$listPoints = get_db_all_rows_sql('SELECT * FROM tgis_data WHERE tagente_id_agente = ' . $idAgent . ' ORDER BY end_timestamp ASC'); +// +//$listPoints = array( +// array('id_tgis_data' => 0, 'longitude' => -3.709, 'latitude' => 40.422, 'altitude' => 0, 'manual_placemen' => 1), +// array('id_tgis_data' => 1, 'longitude' => -3.710, 'latitude' => 40.420, 'altitude' => 0, 'manual_placemen' => 0), +// array('id_tgis_data' => 2, 'longitude' => -3.711, 'latitude' => 40.420, 'altitude' => 0, 'manual_placemen' => 1), +// array('id_tgis_data' => 3, 'longitude' => -3.712, 'latitude' => 40.422, 'altitude' => 0, 'manual_placemen' => 0), +// array('id_tgis_data' => 4, 'longitude' => -3.708187, 'latitude' => 40.42056, 'altitude' => 0, 'manual_placemen' => 0) +//); + +?> \ No newline at end of file