flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Updated Map classes with corresponding JavaScript versions of the ActionScript classes for Google Map place and location searches.
Date Mon, 02 Jun 2014 20:46:20 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 30caa1b71 -> 4819f8f5e


Updated Map classes with corresponding JavaScript versions of the ActionScript classes for
Google Map place and location searches.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4819f8f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4819f8f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4819f8f5

Branch: refs/heads/develop
Commit: 4819f8f5e34d502d8f0556a733cfe93c99d40604
Parents: 30caa1b
Author: Peter Ent <pent@apache.org>
Authored: Mon Jun 2 16:46:08 2014 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jun 2 16:46:08 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/flex/maps/google/Geometry.js | 50 +++++++++++
 .../src/org/apache/flex/maps/google/LatLng.js   | 53 ++++++++++++
 .../src/org/apache/flex/maps/google/Map.js      | 29 +++++--
 .../src/org/apache/flex/maps/google/Place.js    | 88 ++++++++++++++++++++
 4 files changed, 213 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4819f8f5/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Geometry.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Geometry.js b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Geometry.js
new file mode 100644
index 0000000..2ee1201
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Geometry.js
@@ -0,0 +1,50 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.maps.google.Geometry');
+
+goog.require('org.apache.flex.maps.google.LatLng');
+
+
+// IMPORTANT:
+// In order to use this class, the Google MAP API must be downloaded
+// from the <head> section of the main HTML file.
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.maps.google.Geometry = function() {
+  this.location = new org.apache.flex.maps.google.LatLng();
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.maps.google.Geometry.prototype.
+FLEXJS_CLASS_INFO =
+{ names: [{ name: 'Geometry',
+           qName: 'org.apache.flex.maps.google.Geometry' }],
+    interfaces: [] };
+
+
+/**
+ * @type {Object} The current location
+ */
+org.apache.flex.maps.google.Geometry.prototype.location = null;
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4819f8f5/frameworks/js/FlexJS/src/org/apache/flex/maps/google/LatLng.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/maps/google/LatLng.js b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/LatLng.js
new file mode 100644
index 0000000..23fac04
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/LatLng.js
@@ -0,0 +1,53 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.maps.google.LatLng');
+
+
+// IMPORTANT:
+// In order to use this class, the Google MAP API must be downloaded
+// from the <head> section of the main HTML file.
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.maps.google.LatLng = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.maps.google.LatLng.prototype.
+FLEXJS_CLASS_INFO =
+{ names: [{ name: 'LatLng',
+           qName: 'org.apache.flex.maps.google.LatLng' }],
+    interfaces: [] };
+
+
+/**
+ * @type {number} The latitude
+ */
+org.apache.flex.maps.google.LatLng.prototype.lat = 0;
+
+
+/**
+ * @type {number} The longitude
+ */
+org.apache.flex.maps.google.LatLng.prototype.lng = 0;
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4819f8f5/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Map.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Map.js b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Map.js
index c96231a..8844c93 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Map.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Map.js
@@ -14,6 +14,10 @@
 
 goog.provide('org.apache.flex.maps.google.Map');
 
+goog.require('org.apache.flex.maps.google.Geometry');
+goog.require('org.apache.flex.maps.google.LatLng');
+goog.require('org.apache.flex.maps.google.Place');
+
 
 // IMPORTANT:
 // In order to use this class, the Google MAP API must be downloaded
@@ -242,16 +246,27 @@ org.apache.flex.maps.google.Map.prototype.geoCodeHandler =
  */
 org.apache.flex.maps.google.Map.prototype.searchResultHandler =
 function(results, status) {
-  this.places = results;
+  this.searchResults = [];
   if (status == window['google']['maps']['places']['PlacesServiceStatus']['OK']) {
     for (var i = 0; i < results.length; i++) {
-      var place = results[i];
-      this.markers.push(this.createMarker(place['geometry']['location']));
+      var place = new org.apache.flex.maps.google.Place();
+      place.geometry.location.lat = results[i]['geometry']['location']['lat'];
+      place.geometry.location.lng = results[i]['geometry']['location']['lng'];
+      place.icon = results[i]['icon'];
+      place.id = results[i]['id'];
+      place.name = results[i]['name'];
+      place.reference = results[i]['reference'];
+      place.vicinity = results[i]['vicinity'];
+      this.searchResults.push(place);
+
+      this.markers.push(this.createMarker(results[i]['geometry']['location']));
     }
-    var event = document.createEvent('Event');
-    event.results = this.places;
-    event.initEvent('searchResults', true, true);
-    window.dispatchEvent(event);
+    //var event = document.createEvent('Event');
+    //event.results = this.places;
+    //event.initEvent('searchResults', true, true);
+    //window.dispatchEvent(event);
+    var event = new org.apache.flex.events.Event('searchResult');
+    this.dispatchEvent(event);
   }
 };
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4819f8f5/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Place.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Place.js b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Place.js
new file mode 100644
index 0000000..f2f3143
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/maps/google/Place.js
@@ -0,0 +1,88 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.maps.google.Place');
+
+goog.require('org.apache.flex.maps.google.Geometry');
+
+
+// IMPORTANT:
+// In order to use this class, the Google MAP API must be downloaded
+// from the <head> section of the main HTML file.
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.maps.google.Place = function() {
+  this.geometry = new org.apache.flex.maps.google.Geometry();
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.maps.google.Place.prototype.
+FLEXJS_CLASS_INFO =
+{ names: [{ name: 'Place',
+           qName: 'org.apache.flex.maps.google.Place' }],
+    interfaces: [] };
+
+
+/**
+ * @type {Object} The current location
+ */
+org.apache.flex.maps.google.Place.prototype.geometry = null;
+
+
+/**
+ * @type {String} The icon representing the place.
+ */
+org.apache.flex.maps.google.Place.prototype.icon = null;
+
+
+/**
+ * @type {String} A unique identifier for the place.
+ */
+org.apache.flex.maps.google.Place.prototype.id = null;
+
+
+/**
+ * @type {String} The name of the place.
+ */
+org.apache.flex.maps.google.Place.prototype.name = null;
+
+
+/**
+ * @type {String} A reference identifier.
+ */
+org.apache.flex.maps.google.Place.prototype.reference = null;
+
+
+/**
+ * @type {String} A description of the area of the place.
+ */
+org.apache.flex.maps.google.Place.prototype.vicinity = null;
+
+
+/**
+ * @return {String} A description of the area of the place.
+ */
+org.apache.flex.maps.google.Place.prototype.toString = function() {
+  return this.name;
+};
+


Mime
View raw message