Permalink
Browse files

add initial groups stuff

  • Loading branch information...
1 parent e1cb51a commit 3b48c4e0f9ce4f64bf3ac13dd3960c7173f25c0e @jeyoder committed May 27, 2015
View
@@ -0,0 +1,33 @@
+{
+ "version": "0.1.0",
+ // List of configurations. Add new configurations or edit existing ones.
+ // ONLY "node" and "mono" are supported, change "type" to switch.
+ "configurations": [
+ {
+ // Name of configuration; appears in the launch configuration drop down menu.
+ "name": "Launch app.js",
+ // Type of configuration. Possible values: "node", "mono".
+ "type": "node",
+ // Workspace relative or absolute path to the program.
+ "program": "app.js",
+ // Automatically stop program after launch.
+ "stopOnEntry": true,
+ // Command line arguments passed to the program.
+ "args": [],
+ // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
+ "cwd": ".",
+ // Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
+ "runtimeExecutable": null,
+ // Environment variables passed to the program.
+ "env": { }
+ },
+ {
+ "name": "Attach",
+ "type": "node",
+ // TCP/IP address. Default is "localhost".
+ "address": "localhost",
+ // Port to attach to.
+ "port": 5858
+ }
+ ]
+}
View
@@ -17,9 +17,23 @@
<div id="canvas-holder">
<canvas id="canvas"></canvas>
- <div id="search-holder">
- <span class="icon-search"></span>
- <input type="text" id="search"></input>
+ <div id="menubar">
+ <div id="search-holder" class="menu-item">
+ <span class="icon-search"></span>
+ <input type="text" id="search"></input>
+ </div>
+ <div id="menu-groups" class="menu-item">
+ Groups
+ <ul id="groups-display" class="submenu">
+ <li data-group="GPSGroup">GPSs</li>
+ <li data-group="IridiumGroup">Iridium</li>
+ <li data-group="GlonassGroup">GLONASS</li>
+ <li data-group="Iridium33DebrisGroup">Iridium 33 Debris</li>
+ </ul>
+ </div>
+ <div id="menu-groups" class="menu-item">
+ Color Schemes
+ </div>
</div>
<div id="search-results"></div>
<div id="sat-hoverbox">(none)</div>
@@ -11,6 +11,7 @@
//our script files
'shader-loader.js',
'color-scheme.js',
+'groups.js',
'search-box.js',
'orbit-display.js',
'line.js',
@@ -1,3 +1,4 @@
+/* global groups */
(function() {
var ColorScheme = function(colorizer) {
@@ -7,12 +8,13 @@
ColorScheme.prototype.calculateColorBuffer = function() {
var numSats = satSet.numSats;
- var colorData = new Float32Array(numSats*3);
+ var colorData = new Float32Array(numSats*4);
for(var i=0; i < numSats; i++) {
var color = this.colorizer(i);
- colorData[i*3] = color[0];
- colorData[i*3+1] = color[1];
- colorData[i*3+2] = color[2];
+ colorData[i*4] = color[0]; //R
+ colorData[i*4+1] = color[1]; //G
+ colorData[i*4+2] = color[2]; //B
+ colorData[i*4+3] = color[3]; //A
}
gl.bindBuffer(gl.ARRAY_BUFFER, this.colorBuf);
gl.bufferData(gl.ARRAY_BUFFER, colorData, gl.STATIC_DRAW);
@@ -23,27 +25,35 @@
ColorScheme.default = new ColorScheme(function(satId){
var sat = satSet.getSat(satId);
if(sat.OBJECT_TYPE === 'PAYLOAD') {
- return [1.0, 0.2, 0.0];
+ return [1.0, 0.2, 0.0, 1.0];
} else if (sat.OBJECT_TYPE === 'ROCKET BODY'){
- return [0.2, 0.5, 1.0];
+ return [0.2, 0.5, 1.0, 0.85];
// return [0.6, 0.6, 0.6];
} else if (sat.OBJECT_TYPE === 'DEBRIS') {
- return [0.5, 0.5, 0.5];
+ return [0.5, 0.5, 0.5, 0.85];
} else {
- return [1.0, 1.0, 0.0];
+ return [1.0, 1.0, 0.0, 1.0];
}
});
ColorScheme.apogee = new ColorScheme(function(satId) {
var ap = satSet.getSat(satId).apogee;
var gradientAmt = Math.min(ap / 45000, 1.0);
- return[1.0 - gradientAmt, gradientAmt, 0.0];
+ return[1.0 - gradientAmt, gradientAmt, 0.0, 1.0];
});
ColorScheme.velocity = new ColorScheme(function(satId) {
var vel = satSet.getSat(satId).velocity;
var gradientAmt = Math.min(vel / 15, 1.0);
- return[1.0 - gradientAmt, gradientAmt, 0.0];
+ return[1.0 - gradientAmt, gradientAmt, 0.0, 1.0];
+ });
+
+ ColorScheme.group = new ColorScheme(function(satId) {
+ if(groups.selectedGroup.hasSat(satId)) {
+ return [1.0, 0.2, 0.0, 1.0];
+ } else {
+ return [1.0, 1.0, 1.0, 0.1];
+ }
});
};
@@ -9,7 +9,7 @@
var numSats = satSet.numSats;
var colorData = new Float32Array(numSats*3);
for(var i=0; i < numSats; i++) {
- var color = colorizer(satSet.getSat(i));
+ var color = this.colorizer(satSet.getSat(i));
colorData[i*3] = color[0];
colorData[i*3+1] = color[1];
colorData[i*3+2] = color[2];
@@ -19,7 +19,7 @@
};
ColorScheme.prototype.getColorBuffer = function() {
- return this.colorBuf;
+ return this.colorBuf;
}
ColorScheme.default = new ColorScheme(function(sat){
@@ -0,0 +1,108 @@
+/* global $ */
+/* global ColorScheme */
+/* global orbitDisplay */
+/* global satSet */
+(function() {
+ var groups = {};
+ groups.selectedGroup = null;
+
+ function SatGroup(groupType, data) {
+ this.sats = [];
+ if(groupType === 'intlDes') {
+ for(var i=0; i < data.length; i++){
+ this.sats.push({
+ satId : satSet.getIdFromIntlDes(data[i]),
+ orbitBuffer : orbitDisplay.allocateBuffer()
+ });
+ }
+ } else if (groupType === 'nameRegex') {
+ var satIdList = satSet.searchNameRegex(data);
+ for(var i=0; i < satIdList.length; i++) {
+ this.sats.push({
+ satId : satIdList[i],
+ orbitBuffer: orbitDisplay.allocateBuffer()
+ });
+ }
+ }
+ }
+
+ SatGroup.prototype.hasSat = function(id) {
+ var len = this.sats.length;
+ for(var i=0; i < len; i++) {
+ if(this.sats[i].satId === id) return true;
+ }
+ return false;
+ };
+
+ SatGroup.prototype.updateOrbits = function() {
+ for(var i=0; i < this.sats.length; i++) {
+ orbitDisplay.updateOrbitBuffer(this.sats[i].orbitBuffer, this.sats[i].satId);
+ }
+ };
+
+ SatGroup.prototype.forEachBuffer = function(callback) {
+ for(var i=0; i<this.sats.length; i++) {
+ callback(this.sats[i].orbitBuffer);
+ }
+ };
+
+ groups.selectGroup = function(group) {
+ console.log('selectGroup');
+ groups.selectedGroup = group;
+ group.updateOrbits();
+ };
+
+ groups.init = function() {
+ var start = performance.now();
+
+ $('#groups-display>li').mouseover(function() {
+ var groupName = $(this).data('group');
+ console.log('selecting group: ' + groupName);
+ groups.selectGroup(groups[groupName]);
+ satSet.setColorScheme(ColorScheme.group);
+ });
+
+ groups.GPSGroup = new SatGroup('intlDes', [
+ '90103A',
+ '93068A',
+ '96041A',
+ '97035A',
+ '99055A',
+ '00025A',
+ '00040A',
+ '00071A',
+ '01004A',
+ '03005A',
+ '03010A',
+ '03058A',
+ '04009A',
+ '04023A',
+ '04045A',
+ '05038A',
+ '06042A',
+ '06052A',
+ '07047A',
+ '07062A',
+ '08012A',
+ '09043A',
+ '10022A',
+ '11036A',
+ '12053A',
+ '13023A',
+ '14008A',
+ '14026A',
+ '14045A',
+ '14068A',
+ '15013A'
+ ]);
+
+ groups.IridiumGroup = new SatGroup('nameRegex', /IRIDIUM(?!.*DEB)/);
+ groups.Iridium33DebrisGroup = new SatGroup('nameRegex', /(COSMOS 2251|IRIDIUM 33) DEB/);
+ groups.GlonassGroup = new SatGroup('nameRegex', /GLONASS/);
+
+ console.log('groups init: ' + (performance.now() - start) + ' ms');
+ };
+ window.groups = groups;
+
+
+})();
@@ -1,3 +1,5 @@
+/* global groups */
+/* global ColorScheme */
/* global satSet */
/* global $ */
/* global shaderLoader */
@@ -85,7 +87,10 @@ $(document).ready(function() {
debugLine3 = new Line();
earth.init();
ColorScheme.init();
- satSet.init();
+ satSet.init(function(satData) {
+ groups.init();
+ searchBox.init(satData);
+ });
orbitDisplay.init();
/* var rotSpeed = 0.001;
Oops, something went wrong.

0 comments on commit 3b48c4e

Please sign in to comment.