[Opengeoscience-developers] OpenGeoscience branch, add_point_source, updated. cb31e4223f1c80e69b4cc874445a75fdcff60d97

Aashish Chaudhary aashish.chaudhary at kitware.com
Thu Mar 7 00:11:08 EST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenGeoscience".

The branch, add_point_source has been updated
       via  cb31e4223f1c80e69b4cc874445a75fdcff60d97 (commit)
      from  b216c6223dfee9e33b5f35d8871d85053a37c472 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://public.kitware.com/gitweb?p=OpenGeoscience/opengeoscience.git;a=commitdiff;h=cb31e4223f1c80e69b4cc874445a75fdcff60d97
commit cb31e4223f1c80e69b4cc874445a75fdcff60d97
Author:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
AuthorDate: Thu Mar 7 00:07:16 2013 -0500
Commit:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
CommitDate: Thu Mar 7 00:07:16 2013 -0500

    Got the cities to show up on the map

diff --git a/web/lib/app.js b/web/lib/app.js
index 5a47654..98a25bd 100644
--- a/web/lib/app.js
+++ b/web/lib/app.js
@@ -37,15 +37,44 @@ function main() {
     "visible" : 1
   }, ogs.geo.planeFeature(ogs.geo.latlng(-90.0, 0.0), ogs.geo.latlng(90.0,
                                                                      180.0)));
+  myMap.addLayer(planeLayer);
 
-  var pointLayer = ogs.geo.featureLayer({
-    "opacity" : 1,
-    "showAttribution" : 1,
-    "visible" : 1
-  }, ogs.geo.pointFeature([ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, 0.0 ]));
+  // Read city geo-coded data
+  var table = [];
+  var citieslatlon = [];
+  var colors = [];
+  $.ajax({
+    type : "GET",
+    url : "./data/cities.csv",
+    dataType : "text",
+    success : function(data) {
+      table = processCSVData(data);
+      if (table.length > 0) {
+        var i;
+        for (i = 0; i < table.length; ++i) {
+          if (table[i][2] != undefined) {
+            var lat = table[i][2];
+            lat = lat.replace(/(^\s+|\s+$|^\"|\"$)/g, '');
+            lat = parseFloat(lat);
 
-  myMap.addLayer(planeLayer);
-  myMap.addLayer(pointLayer);
+            var lon = table[i][3];
+            lon = lon.replace(/(^\s+|\s+$|^\"|\"$)/g, '');
+            lon = parseFloat(lon);
+            citieslatlon.push(lon, lat, 0.0);
+            colors.push(1.0, 1.0, 153.0 / 255.0);
+          }
+        }
+
+        var pointLayer = ogs.geo.featureLayer({
+          "opacity" : 1,
+          "showAttribution" : 1,
+          "visible" : 1
+        }, ogs.geo.pointFeature(citieslatlon, colors));
+
+        myMap.addLayer(pointLayer);
+      }
+    }
+  });
 
   // Listen for slider slidechange event
   $('#slider-vertical').slider().bind('slide', function(event, ui) {
@@ -72,3 +101,16 @@ function main() {
     }
   })();
 }
+
+function processCSVData(csvdata) {
+  var table = [];
+  var lines = csvdata.split(/\r\n|\n/);
+
+  for ( var i = 0; i < lines.length; i++) {
+    var row = lines[i].split(',');
+    table.push(row);
+  }
+
+  console.log(table[0][0]);
+  return table;
+}
diff --git a/web/lib/geo/feature.js b/web/lib/geo/feature.js
index e0aba2f..1bce8b9 100644
--- a/web/lib/geo/feature.js
+++ b/web/lib/geo/feature.js
@@ -86,8 +86,8 @@ geoModule.pointFeature = function(positions, colors) {
   ogs.vgl.actor.call(this);
 
   // Initialize
+  console.log('pos ' + positions);
   var actor = ogs.vgl.utils.createPoints(positions, colors);
-
   this.setMapper(actor.mapper());
   this.setMaterial(actor.material());
 
diff --git a/web/lib/vgl/geomData.js b/web/lib/vgl/geomData.js
index 06278c1..de587ad 100644
--- a/web/lib/vgl/geomData.js
+++ b/web/lib/vgl/geomData.js
@@ -116,8 +116,7 @@ vglModule.primitive = function() {
   };
 
   /*
-   * Return primitive type
-   *g
+   * Return primitive type g
    */
   this.primitiveType = function() {
     return m_primitiveType;
@@ -155,8 +154,7 @@ vglModule.primitive = function() {
     return m_indicesValueType;
   };
   /*
-   * Set indices value type
-   *g
+   * Set indices value type g
    */
   this.setIndicesValueType = function(type) {
     m_indicesValueType = type;
@@ -233,7 +231,7 @@ vglModule.points = function() {
 
   this.setPrimitiveType(gl.POINTS);
   this.setIndicesValueType(gl.UNSIGNED_SHORT);
-  this.setIndexCount(3);
+  this.setIndexCount(1);
 
   return this;
 };
diff --git a/web/lib/vgl/pointSource.js b/web/lib/vgl/pointSource.js
index 869cc79..1f3a27c 100644
--- a/web/lib/vgl/pointSource.js
+++ b/web/lib/vgl/pointSource.js
@@ -91,6 +91,8 @@ vglModule.pointSource = function() {
     var indices = [];
     indices.length = numPts;
 
+    console.log(numPts);
+
     for (i = 0; i < numPts; ++i) {
       indices[i] = i;
     }

-----------------------------------------------------------------------

Summary of changes:
 web/lib/app.js             |   56 ++++++++++++++++++++++++++++++++++++++-----
 web/lib/geo/feature.js     |    2 +-
 web/lib/vgl/geomData.js    |    8 ++----
 web/lib/vgl/pointSource.js |    2 +
 4 files changed, 55 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
OpenGeoscience



More information about the Opengeoscience-developers mailing list