Example #1
0
	w.loadBatcher = function(batcher, resetCamera) {
		if (oldBatcher !== null)
			removeBatcher(oldBatcher);

		addBatcher(batcher);
		oldBatcher = batcher;

		var batcherProps = determineBatcherProps(batcher);
		console.log('Batcher props:', batcherProps);
		var mn = batcherProps[0],
			mx = batcherProps[1],
			cg = batcherProps[2],
			scale = batcherProps[3];

		if (resetCamera === true) {
			setupView(mn, mx, cg, scale);
			restorePoint = [mn, mx, cg, scale];
		}

		// update some of the fields
		var zrange = new THREE.Vector2(0, mx.z - mn.z);

		var cgToUse = batcher.correctiveOffset || cg;

		// trigger signals for setting offsets
		$.event.trigger({
			type: 'plasio.offsetsChanged',
			offsets: cgToUse
		});

		// z-range
		$.event.trigger({
			type: 'plasio.zrangeChanged',
			zrange: zrange
		});

		// trigger a signal which will cause the intenisty range to update
		$.event.trigger({
			type: 'plasio.intensityClampChanged'
		});

		// change scale
		$.event.trigger({
			type: 'plasio.scaleChanged',
			scale: scale
		});

		// change classification clamp
		$.event.trigger({
			type: 'plasio.classificationRangeChanged',
			range: batcher.klass
		});
	};
Example #2
0
	PointCollector.prototype.push = function(x, y, p, isNew) {
		var newPos = new THREE.Vector2(x, y);
		for (var i = 0; i < this.points.length ; i ++) {
			if (newPos.distanceTo(this.points[i].screenPos) < 16.0) {
				// the user clicked on one of the points
				var thisPoint = this.points[i];

				this.orthoScene.remove(this.points[i].sprite);
				this.points.splice(i, 1);

				$.event.trigger({
					type: 'plasio.mensuration.pointRemoved',
					point: thisPoint
				});

				needRefresh = true;
				return;
			}
		}

		if (p.x === 0.0 && p.y === 0.0 && p.z === 0.0)
			return; // didn't click on a point

		if (this.points.length === 0) // first point starts with id == 1.
			p.id = 1;
		else if (isNew) { // if a new id increment, or use the parents
			p.id = this.points[this.points.length - 1].id + 1;
		}
		else {
			p.id = this.points[this.points.length - 1].id;
		}


		// the user intends to add a new point
		p.sprite = null;
		p.screenPos = newPos;
		p.color = new THREE.Color();
		p.color.setHSL(Math.random(), 0.8, 0.8);

		this.points.push(p);

		$.event.trigger({
			type: 'plasio.mensuration.pointAdded',
			point: p
		});

		needRefresh = true;
	};
Example #3
0
                    slide: withRefresh(function() {
                        $.event.trigger({
                            type: 'plasio.inundationOpacityChanged'
                        });

                        o.setState({opacity: $(m).val()});
                    })
Example #4
0
function emitChangeEdit(tool, state) {
  $.event.trigger({
    type: 'changeEdit',
    tool,
    active: state
  });
}
	function _cleanup() {
		overlay.fadeOut('fast');

		wrap.hide();

		$.event.trigger('fancybox-cleanup');

		inner.empty().attr('tabindex','-1');

		fancybox_enable_base_elements();

		try{
			target_bookmark.focus();
		} catch (er){
			// empty
		}

		if ($.isFunction(currentOpts.onClosed)) {
			currentOpts.onClosed(currentArray, currentIndex, currentOpts);
		}

		currentArray	= selectedOpts	= [];
		currentIndex	= selectedIndex	= 0;
		currentOpts		= selectedOpts	= {};

		busy = false;
	}
Example #6
0
		$("#scale-geoms-clear").on('click', function(e) {
			e.preventDefault();

			$.event.trigger({
				type: 'plasio.scalegeoms.reset'
			});
		});
Example #7
0
function emitChangeOfflineEdits(edits, layerName) {
  $.event.trigger({
    type: 'changeOfflineEdits',
    edits,
    layerName
  });
}
      content.fadeTo(currentOpts.changeFade, 0.3, function() {
        var finish_resizing = function() {
          content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
        };

        $.event.trigger('fancybox-change');

        content
          .empty()
          .removeAttr('filter')
          .css({
            'border-width' : currentOpts.padding,
            'width'  : final_pos.width - currentOpts.padding * 2,
            'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
          });

        if (equal) {
          finish_resizing();

        } else {
          fx.prop = 0;

          $(fx).animate({prop: 1}, {
             duration : currentOpts.changeSpeed,
             easing : currentOpts.easingChange,
             step : _draw,
             complete : finish_resizing
          });
        }
      });
	testChange = function testChange( e ) {
		var elem = e.target, data, val;

		if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
			return;
		}

		data = jQuery.data( elem, "_change_data" );
		val = getVal(elem);

		// the current data will be also retrieved by beforeactivate
		if ( e.type !== "focusout" || elem.type !== "radio" ) {
			jQuery.data( elem, "_change_data", val );
		}

		if ( data === undefined || val === data ) {
			return;
		}

		if ( data != null || val ) {
			e.type = "change";
			e.liveFired = undefined;
			return jQuery.event.trigger( e, arguments[1], elem );
		}
	};
Example #10
0
      .done(function(res) {
        self.preferences_cache = res;
        self.preference_version(self.generate_preference_version());

        pgBrowser.keyboardNavigation.init();
        if(pgBrowser.tree) {
          modifyAnimation.modifyAcitreeAnimation(self);
          modifyAnimation.modifyAlertifyAnimation(self);
        }

        // Initialize Tree saving/reloading
        pgBrowser.browserTreeState.init();

        /* Once the cache is loaded after changing the preferences,
         * notify the modules of the change
         */
        if(modulesChanged) {
          if(typeof modulesChanged === 'string'){
            $.event.trigger('prefchange:'+modulesChanged);
          } else {
            _.each(modulesChanged, (val, key)=> {
              $.event.trigger('prefchange:'+key);
            });
          }
        }
      })
Example #11
0
		$(document).on("plasio.load.progress", function(e) {
			$.event.trigger({
				type: 'plasio.progress.progress',
				percent: e.percent,
				message: e.message
			});
		});
Example #12
0
		.catch(Promise.CancellationError, function(e) {
			console.log(e, e.stack);

			$.event.trigger({
				type: "plasio.load.cancelled",
			});
		})
Example #13
0
        handleOpen: function() {
            var url = this.refs.pipelineUrl.getValue(),
                server = this.refs.serverAddress.getValue(),
                pipelineId = this.refs.pipelineId.getValue();


            var comps = {};
            if (url.length > 0) {
                comps = util.parseGHComponents(url); // normalize this URL
            }
            else {
                comps = {server: server, pipelineId: pipelineId};
            }

            console.log("Got components:", comps);

            if (!comps) {
                return this.setState({error: 'The specified pipeline settings seem invalid.'}, function() {
                    var node = this.refs.pipelineUrl.getInputDOMNode();

                    node.setSelectionRange(0, node.value.length);
                    node.focus();
                });
            }

            $.event.trigger({
                type: 'plasio.loadfiles.greyhound',
                comps: [comps]
            });

            this.props.onRequestHide();
        },
Example #14
0
                    slide: withRefresh(function() {
                        $.event.trigger({
                            type: 'plasio.inundationChanged'
                        });

                        o.setState({value: $(n).val()});
                    })
Example #15
0
		.catch(function(e) {
			console.log(e, e.stack);

			$.event.trigger({
				type: "plasio.load.failed",
				error: "Failed to load file"
			});
		})
Example #16
0
        openQuickPipeline: function(pipeline) {
            $.event.trigger({
                type: 'plasio.loadfiles.greyhound',
                comps: [{server: 'test.greyhound.io:8080', pipelineId: pipeline}]
            });

            this.props.onRequestHide();
        },
Example #17
0
		return function() {
			var r = f.apply(this, arguments);
			$.event.trigger({
				type: 'plasio.renderer.needRefresh'
			});

			return r;
		};
Example #18
0
export function triggerEvent(type, self, data) {
    $.event.trigger({
        type: 'sidebar:' + type + '.fxp.sidebar',
        sidebar: self,
        eventData: data,
        time: new Date()
    });
}
Example #19
0
			slide: withRefresh(function() {
				var r = currentColorClamp();
				colormapRange.setRange(r[0], r[1]);

				$.event.trigger({
					type: 'plasio.colorClampChanged'
				});
			})
Example #20
0
function emitChangeFeature(change) {
  $.event.trigger({
    type: 'changeFeature',
    feature: change.feature,
    layerName: change.layerName,
    action: change.action,
    status: change.status || 'pending'
  });
}
Example #21
0
		$(document).on("plasio.load.started", function() {
			scope.stopAllPlayback();
			$.event.trigger({
				type: 'plasio.progress.start'
			});

			$.event.trigger({
				type: 'plasio.progress.progress',
				percent: 0
			});

			$("#loadError").html("").hide();
			$("#browse button").attr("disabled", true);
			$("#browse").hide();
			$("#browseCancel").show();

			fileLoadInProgress = true;
		});
Example #22
0
function emitToggleEdit(tool, optOptions) {
  const options = optOptions || {};
  const e = {
    type: 'toggleEdit',
    tool
  };
  $.extend(e, options);
  $.event.trigger(e);
}
	triggerHandler: function( type, data ) {
		if ( this[0] ) {
			var event = jQuery.Event( type );
			event.preventDefault();
			event.stopPropagation();
			jQuery.event.trigger( event, data, this[0] );
			return event.result;
		}
	},
Example #24
0
		var cleanup = function() {
			$.event.trigger({
				type: 'plasio.progress.end'
			});

			$("#browseCancel").hide();
			$("#browse button").attr("disabled", false);
			$("#browse").show();
			fileLoadInProgress = false;
		};
Example #25
0
		var progress = function(pc, msg) {
			console.log("progress: ", pc, msg);
			var obj = {
				type: "plasio.load.progress",
				percent: Math.round(pc * 100)
			};

			if (msg !== undefined) obj.message = msg;
			$.event.trigger(obj);
		};
Example #26
0
        remove: withRefresh(function(i) {
            console.log('Removing region');
            var r = this.state.regions[i];
            this.setState({ regions: _.without(this.state.regions, r) });

            $.event.trigger({
                type: 'plasio.regions.remove',
                region: r
            });
        }),
Example #27
0
        toggle: function() {
            var nextEnabled = !this.state.enabled;
            this.setState({enabled: nextEnabled,
                          slider: false});

                          $.event.trigger({
                              type: 'plasio.inundationEnable',
                              enable: nextEnabled
                          });
        }
Example #28
0
		$("#container").on("dblclick", function(e) {
			if (!e.altKey) {
				e.preventDefault();

				$.event.trigger({
					type: 'plasio.mensuration.addPoint',
					x: e.clientX, y: e.clientY,
					startNew: e.shiftKey
				});
			}
		});
Example #29
0
		var setCurrentBatcher = function(index, resetCamera) {
			console.log('Setting active batcher at index:', index);

			var b = allBatches[index];
			render.loadBatcher(b.batcher, resetCamera);
			loadFileInformation(b.header);

			$.event.trigger({
				type: "plasio.needRefresh"
			});
		};
Example #30
0
	ModelCache.prototype.getModel = function(url, cb) {
		var o = this;
		if (this.models[url])
			return setTimeout(function() {
				var m = o.models[url];
				cb(m[0], m[1]);
			}, 0);

			if (this.inprogress[url]) {
				// this download is in progress right now, so we'd wait till its done and then invoke user's callback
				//
				return this.inprogress[url].push(cb);
			}

			// this URL is neither loaded nor has it been queued, queue it
			this.inprogress[url] = [cb];

			$.event.trigger({
				type: 'plasio.progress.start'
			});

			var loader = new THREE.BinaryLoader();
			loader.load(url, function(geometry, materials) {
				console.log('Done loading object');

				$.event.trigger({
					type: 'plasio.progress.end'
				});

				for (var i = 0 ; i < materials.length ; i ++) {
					materials[i].ambient = new THREE.Color(1, 1, 1);
					materials[i].color = new THREE.Color(1, 1, 1);
				}

				o.models[url] = [geometry, materials];

				setTimeout(function() {
					var cbs = o.inprogress[url];
					delete o.inprogress[url];

					for (var k in cbs) {
						cbs[k](geometry, materials);
					}
				}, 0);
			},
			undefined, undefined,
			function(e) {
				$.event.trigger({
					type: "plasio.progress.progress",
					percent: (100 * e.loaded / e.total)
				});
			});
	};