[Opengeoscience-developers] OpenGeoscience branch, add_point_source, updated. 5a6b316020debc3d527f0bf3b6f2af5f9f629463

Aashish Chaudhary aashish.chaudhary at kitware.com
Fri Mar 8 17:53:27 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  5a6b316020debc3d527f0bf3b6f2af5f9f629463 (commit)
      from  a8c603785b92b733dc1715189f64be62fb251e2c (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=5a6b316020debc3d527f0bf3b6f2af5f9f629463
commit 5a6b316020debc3d527f0bf3b6f2af5f9f629463
Author:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
AuthorDate: Fri Mar 8 17:52:25 2013 -0500
Commit:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
CommitDate: Fri Mar 8 17:52:25 2013 -0500

    Fixed map image not showing up sometimes

diff --git a/web/lib/geo/map.js b/web/lib/geo/map.js
index 09a11ff..a608e2b 100644
--- a/web/lib/geo/map.js
+++ b/web/lib/geo/map.js
@@ -74,6 +74,7 @@ geoModule.map = function(node, options) {
 
   var m_that = this;
   var m_node = node;
+  var m_baseLayer = null;
   var m_leftMouseButtonDown = false;
   var m_rightMouseButtonDown = false;
   var m_initialized = false;
@@ -282,25 +283,30 @@ geoModule.map = function(node, options) {
     return false;
   }
 
-  // TODO use zoom and center options
+  /**
+   * On successful loading of the background imagery for
+   * map, use the image as texture and redraw the map.
+   *
+   */
+  function updateMapImage(image) {
+    var worldTexture = new vglModule.texture();
+    worldTexture.updateDimensions();
+    worldTexture.setImage(worldImage);
+    m_baseLayer.material().addAttribute(worldTexture);
+    draw();
+  }
 
-  var m_baseLayer = (function() {
+  // TODO use zoom and center options
+  m_baseLayer = (function() {
     var mapActor = ogs.vgl.utils.createTexturePlane(-180.0, -90.0, 0.0, 180.0,
                                                     -90.0, 0.0, -180.0, 90.0,
                                                     0.0);
-
     // Setup texture
     worldImage = new Image();
     worldImage.src = "./data/land_shallow_topo_2048.png";
-    var worldTexture = new vglModule.texture();
-    worldTexture.setImage(worldImage);
-
-    // TODO Currently hard-coded
-
-    mapActor.material().addAttribute(worldTexture);
+    worldImage.onload = updateMapImage;
 
     m_renderer.addActor(mapActor);
-
     document.onmousedown = handleMouseDown;
     document.onmouseup = handleMouseUp;
     document.onmousemove = handleMouseMove;
@@ -309,8 +315,6 @@ geoModule.map = function(node, options) {
     };
     HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords;
 
-    draw();
-
     return mapActor;
   })();
 
diff --git a/web/lib/vgl/texture.js b/web/lib/vgl/texture.js
index fb17d95..448d8f2 100644
--- a/web/lib/vgl/texture.js
+++ b/web/lib/vgl/texture.js
@@ -21,7 +21,6 @@
 // texture class
 //
 //////////////////////////////////////////////////////////////////////////////
-
 vglModule.texture = function() {
 
   if (!(this instanceof vglModule.texture)) {
@@ -29,7 +28,7 @@ vglModule.texture = function() {
   }
   vglModule.materialAttribute.call(this, materialAttributeType.Texture);
 
-  /// Private member variables
+  // / Private member variables
   this.m_width = 0;
   this.m_height = 0;
   this.m_depth = 0;
@@ -46,7 +45,7 @@ vglModule.texture = function() {
 
   this.modifiedOn();
 
-  /// Public member methods
+  // / Public member methods
   this.setup = function(renderState) {
     gl.deleteTexture(this.m_textureHandle);
     this.m_textureHandle = gl.createTexture();
@@ -62,9 +61,9 @@ vglModule.texture = function() {
       this.updateDimensions();
       this.computeInternalFormatUsingImage();
 
-      //console.log("m_internalFormat " + this.m_internalFormat);
-      //console.log("m_pixelFormat " + this.m_pixelFormat);
-      //console.log("m_pixelDataType " + this.m_pixelDataType);
+      // console.log("m_internalFormat " + this.m_internalFormat);
+      // console.log("m_pixelFormat " + this.m_pixelFormat);
+      // console.log("m_pixelDataType " + this.m_pixelDataType);
 
       // FOR now support only 2D textures
       gl.texImage2D(gl.TEXTURE_2D, 0, this.m_internalFormat,
@@ -93,19 +92,15 @@ vglModule.texture = function() {
     gl.bindTexture(gl.TEXTURE_2D, null);
   };
 
-  this.handleTextureLoaded = function(image) {
-    this.m_image = image;
-    this.updateDimensions();
-    this.modifiedOn(true);
-  };
-
   this.image = function() {
     return this.m_image;
   };
 
   this.setImage = function(image) {
     if (image !== null) {
-      image.onload = this.handleTextureLoaded(image);
+      this.m_image = image;
+      this.updateDimensions();
+      this.modifiedOn(true);
       return true;
     }
 
@@ -174,7 +169,6 @@ vglModule.texture = function() {
     return false;
   };
 
-
   this.pixelFormat = function() {
     return this.m_pixelFormat;
   };
@@ -189,7 +183,6 @@ vglModule.texture = function() {
     return true;
   };
 
-
   this.pixelDataType = function() {
     return this.m_pixelDataType;
   };
@@ -210,23 +203,23 @@ vglModule.texture = function() {
     // Currently image does not define internal format
     // and hence it's pixel format is the only way to query
     // information on how color has been stored.
-//    switch (this.m_image.pixelFormat()) {
-//    case gl.RGB:
-//      this.m_internalFormat = gl.RGB;
-//      break;
-//    case gl.RGBA:
-//      this.m_internalFormat = gl.RGBA;
-//      break;
-//    case gl.Luminance:
-//      this.m_internalFormat = gl.Luminance;
-//      break;
-//    case gl.LuminanceAlpha:
-//      this.m_internalFormat = gl.LuminanceAlpha;
-//      break;
-//    // Do nothing when image pixel format is none or undefined.
-//    default:
-//      break;
-//    };
+    // switch (this.m_image.pixelFormat()) {
+    // case gl.RGB:
+    // this.m_internalFormat = gl.RGB;
+    // break;
+    // case gl.RGBA:
+    // this.m_internalFormat = gl.RGBA;
+    // break;
+    // case gl.Luminance:
+    // this.m_internalFormat = gl.Luminance;
+    // break;
+    // case gl.LuminanceAlpha:
+    // this.m_internalFormat = gl.LuminanceAlpha;
+    // break;
+    // // Do nothing when image pixel format is none or undefined.
+    // default:
+    // break;
+    // };
 
     // TODO Fix this
     this.m_internalFormat = gl.RGBA;

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

Summary of changes:
 web/lib/geo/map.js     |   28 +++++++++++++----------
 web/lib/vgl/texture.js |   57 +++++++++++++++++++++---------------------------
 2 files changed, 41 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
OpenGeoscience



More information about the Opengeoscience-developers mailing list