[Opengeoscience-developers] OpenGeoscience branch, map_fixes, created. 60083eb99d470a00ebef09b68cf1bf854023b01b

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Mar 6 17:43:23 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, map_fixes has been created
        at  60083eb99d470a00ebef09b68cf1bf854023b01b (commit)

- Log -----------------------------------------------------------------
http://public.kitware.com/gitweb?p=OpenGeoscience/opengeoscience.git;a=commitdiff;h=60083eb99d470a00ebef09b68cf1bf854023b01b
commit 60083eb99d470a00ebef09b68cf1bf854023b01b
Author:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
AuthorDate: Wed Mar 6 17:42:50 2013 -0500
Commit:     Aashish Chaudhary <aashish.chaudhary at kitware.com>
CommitDate: Wed Mar 6 17:42:50 2013 -0500

    Udpated events definitions

diff --git a/web/lib/app.js b/web/lib/app.js
index 76fedd2..eca78c0 100644
--- a/web/lib/app.js
+++ b/web/lib/app.js
@@ -36,15 +36,11 @@ function main() {
     "showAttribution" : 1,
     "visible" : 1
   }, ogs.geo.planeFeature(ogs.geo.latlng(-90.0, 0.0), ogs.geo.latlng(90.0,
-  180.0)));
+                                                                     180.0)));
 
   myMap.addLayer(planeLayer);
 
-  $(myMap).on('mapUpdated', function() {
-    // For test purposes only
-  });
-
-  // / Listen for slider slidechange event
+  // Listen for slider slidechange event
   $('#slider-vertical').slider().bind('slide', function(event, ui) {
     planeLayer.setOpacity(ui.value);
     myMap.redraw();
diff --git a/web/lib/geo/layer.js b/web/lib/geo/layer.js
index 87e8817..46eef9e 100644
--- a/web/lib/geo/layer.js
+++ b/web/lib/geo/layer.js
@@ -48,9 +48,9 @@ geoModule.layerOptions = function() {
  */
 geoModule.layer = function(options) {
 
-  this.signals = {
-    "opacityChanged" : "opacityChanged",
-    "layerUpdated" : "layerUpdated"
+  this.events = {
+    "opacitychange" : "opacitychange",
+    "update" : "update"
   };
 
   if (!(this instanceof geoModule.layer)) {
@@ -59,11 +59,11 @@ geoModule.layer = function(options) {
 
   ogs.vgl.object.call(this);
 
-  /** Member variables */
+  // Member variables
   var m_that = this;
   var m_opacity = options.opacity || 1.0;
 
-  /** TODO Write a function for this */
+  // TODO Write a function for this
   if (m_opacity > 1.0) {
     m_opacity = 1.0;
     console.log("[WARNING] Opacity cannot be greater than 1.0");
@@ -99,7 +99,7 @@ geoModule.layer = function(options) {
   this.setOpacity = function(val) {
     m_opacity = val;
     $(m_that).trigger({
-      type : this.signals.opacityChanged,
+      type : this.events.opacitychange,
       opacity : m_opacity
     });
   };
@@ -142,14 +142,15 @@ geoModule.featureLayer = function(options, feature) {
     return new geoModule.featureLayer(options, feature);
   }
 
-  // / Register with base class
+  // Register with base class
   geoModule.layer.call(this, options);
 
-  // / Initialize member variables
+  // Initialize member variables
   var m_that = this;
   var m_actor = feature;
+
   /**
-   * Return the underlying renderable entity
+   * Return the underlying drawable entity
    *
    * This function should be implemented by the derived classes
    */
@@ -175,12 +176,11 @@ geoModule.featureLayer = function(options, feature) {
 
     if (opacityUniform != null) {
       opacityUniform.set(event.opacity);
-      $(m_that).trigger(this.signals.layerUpdated);
+      $(m_that).trigger(this.events.update);
     }
   };
 
-  /** Signal-slot connection */
-  $(m_that).on(this.signals.opacityChanged, m_that.updateLayerOpacity);
+  $(m_that).on(this.events.opacitychange, m_that.updateLayerOpacity);
 
   return this;
 };
diff --git a/web/lib/geo/map.js b/web/lib/geo/map.js
index a7285c9..abfdeca 100644
--- a/web/lib/geo/map.js
+++ b/web/lib/geo/map.js
@@ -67,7 +67,11 @@ geoModule.map = function(node, options) {
     return new geoModule.map(node, options);
   }
 
-  // / Member variables
+  // Member variables
+  this.events = {
+    update : "update"
+  };
+
   var m_that = this;
   var m_node = node;
   var m_leftMouseButtonDown = false;
@@ -85,12 +89,12 @@ geoModule.map = function(node, options) {
   if (!options.center) {
     m_options.center = geoModule.latlng(0.0, 0.0);
   }
+
   if (options.zoom === undefined) {
     m_options.zoom = 10;
   }
 
-  // TODO For now using the JQuery
-  $(this).on('mapUpdated', draw);
+  $(this).on(m_that.events.update, draw);
 
   var m_renderer = new ogs.vgl.renderer();
   m_renderer.resize($(node).width(), $(node).height());
@@ -106,7 +110,7 @@ geoModule.map = function(node, options) {
     distance = 600 - (600 - (60 * m_options.zoom)) + 1;
 
     m_camera.setPosition(m_options.center.lng(), m_options.center.lat(),
-    distance);
+                         distance);
     m_camera.setFocalPoint(m_options.center.lng(), m_options.center.lat(), 0.0);
 
     m_initialized = true;
@@ -191,33 +195,34 @@ geoModule.map = function(node, options) {
 
       var focalPoint = m_camera.focalPoint();
       var focusWorldPt = vec4.createFrom(focalPoint[0], focalPoint[1],
-      focalPoint[2], 1);
+                                         focalPoint[2], 1);
 
-      var focusDisplayPt = ogs.vgl.renderer.worldToDisplay(focusWorldPt,
-      m_camera.viewMatrix(), m_camera.projectionMatrix(), width, height);
+      var focusDisplayPt = ogs.vgl.renderer
+          .worldToDisplay(focusWorldPt, m_camera.viewMatrix(), m_camera
+              .projectionMatrix(), width, height);
 
       var displayPt1 = vec4.createFrom(currentMousePos.x, currentMousePos.y,
-      focusDisplayPt[2], 1.0);
+                                       focusDisplayPt[2], 1.0);
       var displayPt2 = vec4.createFrom(m_mouseLastPos.x, m_mouseLastPos.y,
-      focusDisplayPt[2], 1.0);
+                                       focusDisplayPt[2], 1.0);
 
       var worldPt1 = ogs.vgl.renderer.displayToWorld(displayPt1, m_camera
-      .viewMatrix(), m_camera.projectionMatrix(), width, height);
+          .viewMatrix(), m_camera.projectionMatrix(), width, height);
       var worldPt2 = ogs.vgl.renderer.displayToWorld(displayPt2, m_camera
-      .viewMatrix(), m_camera.projectionMatrix(), width, height);
+          .viewMatrix(), m_camera.projectionMatrix(), width, height);
 
       dx = worldPt1[0] - worldPt2[0];
       dy = worldPt1[1] - worldPt2[1];
 
       // Move the scene in the direction of movement of mouse;
       m_camera.pan(-dx, -dy);
-      $(m_that).trigger('mapUpdated');
+      $(m_that).trigger(m_that.events.update);
     }
 
     if (m_rightMouseButtonDown) {
       zTrans = currentMousePos.y - m_mouseLastPos.y;
       m_camera.zoom(zTrans * 0.5);
-      $(m_that).trigger('mapUpdated');
+      $(m_that).trigger(m_that.events.update);
     }
 
     m_mouseLastPos.x = currentMousePos.x;
@@ -281,7 +286,8 @@ geoModule.map = function(node, options) {
 
   var 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);
+                                                    -90.0, 0.0, -180.0, 90.0,
+                                                    0.0);
 
     // Setup texture
     worldImage = new Image();

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


hooks/post-receive
-- 
OpenGeoscience



More information about the Opengeoscience-developers mailing list