@wwtelescope/webclient 6.3.5 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # @wwtelescope/webclient 6.4.1 (2023-02-15)
2
+
3
+ - Make sliders in layer properties window be initialized with the correct value
4
+ (#354, @Carifio24).
5
+
6
+
7
+ # @wwtelescope/webclient 6.4.0 (2022-07-12)
8
+
9
+ - Finally update this to expose all of our new datasets (@pkgw, #353)! These
10
+ have been managed in the [wwt-core-catalogs][wcc] repository, but not actually
11
+ exposed in the production webclient until now. The update required us to
12
+ rebuild the webclient’s precompiled search index, which took a lot of
13
+ infrastructural work. That is now working.
14
+ - Fix a formatting bug that could lead to the seconds value being 60 (@Carifio24, #351).
15
+
16
+ [wcc]: https://github.com/WorldWideTelescope/wwt-core-catalogs/
17
+
18
+
1
19
  # @wwtelescope/webclient 6.3.5 (2022-05-19)
2
20
 
3
21
  - index.html: load pako and uuid early for updated webgl-engine
package/README.md CHANGED
@@ -20,14 +20,10 @@ JavaScript library.
20
20
 
21
21
  ## Building and Testing
22
22
 
23
- In order to build and test the app, you need:
24
-
25
- 1. [Node.js](https://nodejs.org/), specifically the `npm` command. If you need
26
- to install Node.js, use your operating system’s package manager or visit
27
- [nodejs.org](https://nodejs.org/) for installation instructions.
28
- 2. The [Grunt](https://gruntjs.com/) task runner, specifically the `grunt`
29
- command. Once again, install it using your operating system’s package
30
- manager or [see the Grunt website](https://gruntjs.com/getting-started).
23
+ In order to build and test the app, you need: [Node.js](https://nodejs.org/),
24
+ specifically the `npm` command. If you need to install Node.js, use your
25
+ operating system’s package manager or visit [nodejs.org](https://nodejs.org/)
26
+ for installation instructions.
31
27
 
32
28
  The first time you check out these files, run:
33
29
 
@@ -38,7 +34,7 @@ npm install
38
34
  Once that has been done, you can build the website with:
39
35
 
40
36
  ```
41
- grunt dist-dev
37
+ npx grunt dist-dev
42
38
  ```
43
39
 
44
40
  This will create the app files in the `dist` subdirectory of your repository
package/app.js CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  // Note that, unlike the other source files, this file is processed through
26
26
  // Grunt's templating system. This is done so that we can insert various
27
- // build-time parameters. Note also that the variables here must references to
27
+ // build-time parameters. Note also that the variables here must be references to
28
28
  // the Grunt config object; the templating in index.html uses different
29
29
  // variables.
30
30
 
@@ -46,7 +46,7 @@ var wwt = {
46
46
  'wwtControllers',
47
47
  'ngCookies',
48
48
  'angular-intro'
49
- ]).config(function($sceDelegateProvider) {
49
+ ]).config(function ($sceDelegateProvider) {
50
50
  $sceDelegateProvider.resourceUrlWhitelist([
51
51
  // same origin
52
52
  'self',
@@ -63,13 +63,15 @@ var wwt = {
63
63
  controllers: angular.module('wwtControllers', [])
64
64
  };
65
65
 
66
- $(window).on('load', function() {
66
+ $(window).on('load', function () {
67
67
  // Load search data after everything else.
68
68
  //
69
- // Historically the search data were managed in the webclient repository,
70
- // but they're really a "core" asset, since they index the core WWT
71
- // datasets.
69
+ // Historically the search data were managed in the webclient repository, but
70
+ // they're really a "core" asset, since they index the core WWT datasets.
71
+ //
72
+ // The JS file here sets a global `wwt.searchData` variable, which is
73
+ // processed in the `init()` function defined in `dataproxy/SearchData.js`.
72
74
  var scr = document.createElement('script');
73
- scr.setAttribute("src", wwtlib.URLHelpers.singleton.coreStaticUrl('data/searchdata.min.js'));
75
+ scr.setAttribute("src", wwtlib.URLHelpers.singleton.coreStaticUrl('data/searchdata_v2.min.js'));
74
76
  document.getElementsByTagName("head")[0].appendChild(scr);
75
77
  });
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2021 the .NET Foundation
1
+ # Copyright 2020-2023 the .NET Foundation
2
2
  # Licensed under the MIT License
3
3
 
4
4
  parameters:
@@ -85,11 +85,11 @@ jobs:
85
85
  azurePowerShellVersion: 'LatestVersion'
86
86
  scriptType: 'inlineScript'
87
87
  inline: |
88
- Unpublish-AzCdnEndpointContent `
88
+ Clear-AzCdnEndpointContent `
89
89
  -ProfileName wwt-cdn-01 `
90
90
  -ResourceGroupName wwt-web01 `
91
91
  -EndpointName wwtweb-prod `
92
- -PurgeContent '/$(WEBCLIENT_DEPLOYMENT_TAG)/*'
92
+ -ContentPath @('/$(WEBCLIENT_DEPLOYMENT_TAG)/*')
93
93
 
94
94
 
95
95
  # Deployment jobs that should only happen on updates to `rc`, i.e.
@@ -33,9 +33,8 @@ wwt.controllers.controller(
33
33
  '$popover',
34
34
 
35
35
  function ($scope, $rootScope, uiLibrary, $q, appState, loc, $timeout, finderScope,
36
- searchDataService, places, util, hashManager, skyball, searchUtil, $modal,
37
- $element, $cookies, AutohidePanels, $window, $popover)
38
- {
36
+ searchDataService, places, util, hashManager, skyball, searchUtil, $modal,
37
+ $element, $cookies, AutohidePanels, $window, $popover) {
39
38
  //TODO - figure out how to clean up lame long list of dependencies injected
40
39
  var ctl;
41
40
 
@@ -136,7 +135,7 @@ wwt.controllers.controller(
136
135
  };
137
136
 
138
137
  $scope.setLookAt = function (lookAt, imageryName, noUpdate, keepCamera) {
139
- if (!lookAt || !isNaN(parseInt(lookAt))){
138
+ if (!lookAt || !isNaN(parseInt(lookAt))) {
140
139
  lookAt = wwtlib.WWTControl.singleton.renderContext.get_backgroundImageset()._dataSetType;
141
140
  lookAt = $scope.lookTypes[lookAt];
142
141
  if ($scope.lookAt === lookAt) {
@@ -184,7 +183,7 @@ wwt.controllers.controller(
184
183
  }
185
184
  }
186
185
 
187
- angular.element($window).bind('resize', function() {
186
+ angular.element($window).bind('resize', function () {
188
187
  $rootScope.$apply(update_window_size);
189
188
  });
190
189
 
@@ -559,7 +558,7 @@ wwt.controllers.controller(
559
558
  }
560
559
  }
561
560
 
562
- var placeNameForQueryString = function(item) {
561
+ var placeNameForQueryString = function (item) {
563
562
  // Various "research" menus like to put an item's name into URL query
564
563
  // strings. Compute the proper (well, good-enough) representation. When
565
564
  // the name has multiple semicolon-separated identifiers, usually the
@@ -595,8 +594,8 @@ wwt.controllers.controller(
595
594
  });
596
595
 
597
596
  var finderTimer,
598
- finderActive = false,
599
- finderMoved = true;
597
+ finderActive = false,
598
+ finderMoved = true;
600
599
 
601
600
  $scope.showFinderScope = function (event) {
602
601
  // On Windows, right-click brings up the finder scope and control-click
@@ -646,14 +645,14 @@ wwt.controllers.controller(
646
645
  }
647
646
 
648
647
  finderTimer = setInterval(pollFinder, 400);
649
- viewportChange(null, {finderMove: true});
648
+ viewportChange(null, { finderMove: true });
650
649
  }
651
650
  };
652
651
 
653
652
  var pollFinder = function () {
654
653
  if (checkVisibleFinderScope()) {
655
654
  if (finderMoved) {
656
- viewportChange(null, {finderMove: true});
655
+ viewportChange(null, { finderMove: true });
657
656
  finderMoved = false;
658
657
  }
659
658
  }
@@ -734,11 +733,6 @@ wwt.controllers.controller(
734
733
  }
735
734
  };
736
735
 
737
- $scope.setSurveyProperties = function () {
738
- $scope.propertyItem = $scope.backgroundImagery;
739
- $scope.propertyItem.isSurvey = true;
740
- };
741
-
742
736
  $scope.setActiveItem = function (item) {
743
737
  $scope.activeItem = item;
744
738
  if (item.guid) {
@@ -749,7 +743,7 @@ wwt.controllers.controller(
749
743
  $scope.activeItem.imageSet = item.get_studyImageset();
750
744
  }
751
745
  };
752
-
746
+
753
747
  $scope.addCatalogHiPS = function (item) {
754
748
  if (item.guid) {
755
749
  $scope.shareUrl = hashManager.setHashVal('place', item.guid, true, true);
@@ -769,7 +763,7 @@ wwt.controllers.controller(
769
763
  };
770
764
 
771
765
  $scope.setForegroundImage = function (item) {
772
- if(item.isCatalogHips){
766
+ if (item.isCatalogHips) {
773
767
  $scope.addCatalogHiPS(item);
774
768
  return;
775
769
  }
@@ -800,7 +794,7 @@ wwt.controllers.controller(
800
794
  };
801
795
 
802
796
  $scope.setBackgroundImage = function (item) {
803
- if(item.isCatalogHips){
797
+ if (item.isCatalogHips) {
804
798
  $scope.addCatalogHiPS(item);
805
799
  return;
806
800
  }
@@ -933,21 +927,21 @@ wwt.controllers.controller(
933
927
  $scope.playTour = function (url, edit) {
934
928
  $('.finder-scope').hide();
935
929
 
936
- wwt.wc.add_tourError(function(e) {
930
+ wwt.wc.add_tourError(function (e) {
937
931
  util.exitFullscreen();
938
- $scope.$applyAsync(function() {
932
+ $scope.$applyAsync(function () {
939
933
  wwt.tourPlaying = $rootScope.tourPlaying = false;
940
934
  });
941
935
  uiLibrary.showErrorMessage('There was an error loading this tour. The tour file may be damaged or inaccessible.');
942
- console.warn('Tour error',$scope,e);
936
+ console.warn('Tour error', $scope, e);
943
937
  });
944
938
 
945
939
  wwt.wc.add_tourReady(function () {
946
- console.log({ready:wwtlib.WWTControl.singleton.tourEdit});
940
+ console.log({ ready: wwtlib.WWTControl.singleton.tourEdit });
947
941
 
948
942
  $scope.$applyAsync(function () {
949
943
  $scope.isLoading = false;
950
- $scope.activeItem = {label: 'currentTour'};
944
+ $scope.activeItem = { label: 'currentTour' };
951
945
  $scope.activePanel = 'currentTour';
952
946
  $scope.ribbon.tabs[1].menu['Edit Tour'] = [$scope.editTour];
953
947
  });
@@ -1009,7 +1003,7 @@ wwt.controllers.controller(
1009
1003
  //todo show dialog for tour properties
1010
1004
  $rootScope.currentTour = wwtlib.WWTControl.singleton.createTour("New Tour");
1011
1005
 
1012
- $scope.activeItem = {label: 'currentTour'};
1006
+ $scope.activeItem = { label: 'currentTour' };
1013
1007
  $scope.activePanel = 'currentTour';
1014
1008
  $rootScope.$applyAsync(function () {
1015
1009
  $rootScope.editingTour = true;
@@ -1179,9 +1173,9 @@ wwt.controllers.controller(
1179
1173
  $scope.homePrefChange = function (isWebclient) {
1180
1174
  $cookies.remove('homepage');
1181
1175
  if (!isWebclient) {
1182
- $cookies.put('homepage', 'home', {expires: new Date(2050, 1, 1), path: "/"});
1176
+ $cookies.put('homepage', 'home', { expires: new Date(2050, 1, 1), path: "/" });
1183
1177
  } else {
1184
- $cookies.put('homepage', 'webclient', {expires: new Date(2050, 1, 1), path: "/"});
1178
+ $cookies.put('homepage', 'webclient', { expires: new Date(2050, 1, 1), path: "/" });
1185
1179
  }
1186
1180
  };
1187
1181
 
@@ -1227,9 +1221,9 @@ wwt.controllers.controller(
1227
1221
  $scope.displayXFader = function () {
1228
1222
  return (
1229
1223
  $scope.lookAt === 'Sky' &&
1230
- $scope.trackingObj &&
1231
- !$scope.tourPlaying &&
1232
- ($scope.trackingObj.get_backgroundImageset() != null || $scope.trackingObj.get_studyImageset() != null)
1224
+ $scope.trackingObj &&
1225
+ !$scope.tourPlaying &&
1226
+ ($scope.trackingObj.get_backgroundImageset() != null || $scope.trackingObj.get_studyImageset() != null)
1233
1227
  );
1234
1228
  }
1235
1229
 
@@ -1294,7 +1288,7 @@ wwt.controllers.controller(
1294
1288
  $scope.fovClass = function () {
1295
1289
  return $scope.lookAt === 'Planet' || $scope.lookAt === 'Panorama' || $scope.lookAt === 'Earth' ? 'hide' :
1296
1290
  $scope.lookAt === 'SolarSystem' ? 'solar-system-mode fov-panel' :
1297
- 'fov-panel';
1291
+ 'fov-panel';
1298
1292
  }
1299
1293
 
1300
1294
  $scope.contextPanelClass = function () {
@@ -1303,7 +1297,7 @@ wwt.controllers.controller(
1303
1297
  cls += ' hide';
1304
1298
  }
1305
1299
 
1306
- $rootScope.compressed = $scope.compressed = cls.indexOf('compressed')>0;
1300
+ $rootScope.compressed = $scope.compressed = cls.indexOf('compressed') > 0;
1307
1301
  return cls;
1308
1302
  }
1309
1303
 
@@ -52,7 +52,6 @@ wwt.controllers.controller('DataVizController', ['$scope', '$rootScope', 'Util',
52
52
  return {label: c, type: i};
53
53
  });
54
54
  l.computeDateDomainRange(0,-1);
55
- console.log('compute');
56
55
  var none = {label: 'None', index: -1};
57
56
  $scope.columns.splice(0, 0, none);
58
57
  l.psType = l.get_pointScaleType();
@@ -61,12 +60,21 @@ wwt.controllers.controller('DataVizController', ['$scope', '$rootScope', 'Util',
61
60
 
62
61
  var sliders = {};
63
62
  var initExpSlider = function (sel, prop, initVal) {
64
- $scope[prop] = initVal;
63
+ var value = $scope[prop];
64
+ if (value == null) {
65
+ value = l['get_' + prop]();
66
+ if (value == null) {
67
+ value = initVal;
68
+ }
69
+ $scope[prop] = value;
70
+ }
65
71
  if (sliders[prop]) {
66
72
  return;
67
73
  }
68
74
  setTimeout(function () {
69
75
  var bar = $(sel);
76
+ var pxValue = 4 * Math.round(Math.log2(value)) + 50;
77
+ bar[0].style.left = pxValue.toString() + 'px';
70
78
  var off = parseInt(bar.css('left').replace('px', ''));
71
79
  sliders[prop] = new wwt.Move({
72
80
  el: bar,
@@ -17,8 +17,8 @@ wwt.app.factory(
17
17
  };
18
18
 
19
19
  var root,
20
- rootFolders,
21
- openCollectionsFolder;
20
+ rootFolders,
21
+ openCollectionsFolder;
22
22
 
23
23
  function getRoot() {
24
24
  var deferred = $q.defer();
@@ -79,8 +79,8 @@ wwt.app.factory(
79
79
  item.isPlanet = item.get_dataSetType() === 1;
80
80
  }
81
81
  if (typeof item.get_projection == 'function'
82
- && typeof item.get_extension == 'function') {
83
- item.isCatalogHips = item.get_projection() === 7 && item.get_extension() === ".tsv";
82
+ && typeof item.get_extension == 'function') {
83
+ item.isCatalogHips = item.get_projection() === 7 && item.get_extension() === ".tsv";
84
84
  }
85
85
 
86
86
  util.rewritePlaceUrls(item);
@@ -100,7 +100,9 @@ wwt.app.factory(
100
100
 
101
101
  root = wwt.wc.createFolder();
102
102
 
103
- var url = new URL(wwt.staticAssetsPrefix + 'assets/webclient-explore-root.wtml', window.location).toString();
103
+ // Resolving relative to window.location helps us deal with http/https
104
+ // here:
105
+ var url = new URL(wwt.coreStaticUrlPrefix + 'wwtweb/catalog.aspx?W=explorerootweb', window.location).toString();
104
106
 
105
107
  root.loadFromUrl(url, function () {
106
108
  var collection;
@@ -1,38 +1,27 @@
1
1
  wwt.app.factory(
2
2
  'SearchData',
3
3
  [
4
- '$http',
5
4
  '$q',
6
- '$timeout',
7
- 'Places',
8
5
  'Util',
9
6
 
10
- function ($http, $q, $timeout, places, util) {
7
+ function ($q, util) {
11
8
  var api = {
12
9
  getData: getData,
13
10
  getIndex: getIndex
14
11
  };
15
12
 
16
13
  var data,
17
- searchIndex = {},
18
- initPromise,
19
- constellations = [];
14
+ searchIndex = {},
15
+ initPromise,
16
+ constellations = [];
20
17
  var deferredInit = $q.defer();
21
- var allDataDeferred = $q.defer();
22
- var allDataPromise = (function(){return allDataDeferred.promise;})();
23
18
 
24
- function getData(all) {
19
+ function getData() {
25
20
  var deferred = $q.defer();
26
21
 
27
- if (all) {
28
- allDataPromise.then(function () {
29
- deferred.resolve(data);
30
- });
31
- } else {
32
- initPromise.then(function () {
33
- deferred.resolve(data);
34
- });
35
- }
22
+ initPromise.then(function () {
23
+ deferred.resolve(data);
24
+ });
36
25
 
37
26
  return deferred.promise;
38
27
  };
@@ -50,67 +39,86 @@
50
39
  var imageset_id = 100;
51
40
 
52
41
  var init = function () {
53
- if (wwt.searchData) {
42
+ // The special `wwt.searchData` global is assigned in the JS file that
43
+ // the main webclient app loads asynchronously (see `app.js`).
44
+ if (!wwt.searchData) {
45
+ setTimeout(init, 333);
46
+ } else {
47
+ // searchDataIndexed is used in `factories/SearchUtil.js`.
54
48
  wwt.searchDataIndexed = [];
49
+
55
50
  data = wwt.searchData;
56
51
  var start = new Date();
57
52
 
58
53
  $.each(data.Constellations, function (i, item) {
59
- /*if (item.name === 'SolarSystem') {
60
- item.places = ssData;
61
- return;
62
- }*/
63
54
  constellations[i] = item.name;
64
55
 
65
56
  $.each(item.places, function (j, place) {
66
57
  var fgi = place.fgi,
67
- imgSet;
58
+ imgSet;
68
59
 
69
60
  if (fgi) {
70
61
  imageset_id++;
71
62
 
63
+ var band_pass = (fgi.bp !== undefined) ? fgi.bp : wwtlib.BandPass.visible;
64
+ var projection = (fgi.pr !== undefined) ? fgi.pr : wwtlib.ProjectionType.tan;
65
+ var base_tile_level = (fgi.bl !== undefined) ? fgi.bl : 0;
66
+ var file_type = (fgi.ft !== undefined) ? fgi.ft : ".png";
67
+ var tile_levels = (fgi.lv !== undefined) ? fgi.lv : 4;
68
+ var bottoms_up = (fgi.bu !== undefined) ? fgi.bu : false;
69
+ var quad_tree_map = (fgi.q !== undefined) ? fgi.q : "";
70
+ var offset_x = (fgi.oX !== undefined) ? fgi.oX : 0;
71
+ var offset_y = (fgi.oY !== undefined) ? fgi.oY : 0;
72
+ var default_set = (fgi.ds !== undefined) ? fgi.ds : false; // "StockSet" in XML
73
+ var rotation = (fgi.r !== undefined) ? fgi.r : 0;
74
+ var width_factor = (fgi.wf !== undefined) ? fgi.wf : 2;
75
+
72
76
  imgSet = wwtlib.Imageset.create(
73
- fgi.n,//name
74
- fgi.u,//url
75
- fgi.dt || 2,//datasettype -default to sky
76
- fgi.bp,//bandPass
77
- fgi.pr,//projection
78
- imageset_id,//imagesetid
79
- fgi.bl,//baseLevel
80
- fgi.lv,//levels
81
- null,//tilesize
82
- fgi.bd,//baseTileDegrees
83
- '',//extension
84
- fgi.bu,//bottomsUp
85
- fgi.q,//quadTreeTileMap,
86
- fgi.cX,//centerX
87
- fgi.cY,//centerY
88
- fgi.r,//rotation
89
- true,//sparse
90
- fgi.tu,//thumbnailUrl,
91
- fgi.ds,//defaultSet,
92
- false,//elevationModel
93
- fgi.wf,//widthFactor,
94
- fgi.oX,//offsetX
95
- fgi.oY,//offsetY
96
- fgi.ct,//creditsText
97
- fgi.cu,//creditsUrl
98
- '', '',
99
- 0,//meanRadius
100
- null
77
+ fgi.n, // name
78
+ fgi.u, // url
79
+ wwtlib.ImageSetType.sky, // data_set_type -- never changes (for now?)
80
+ band_pass,
81
+ projection,
82
+ imageset_id, // imageset id
83
+ base_tile_level,
84
+ tile_levels,
85
+ null, // tile_size
86
+ fgi.bd, // baseTileDegrees
87
+ file_type,
88
+ bottoms_up,
89
+ quad_tree_map,
90
+ fgi.cX, // centerX
91
+ fgi.cY, // centerY
92
+ rotation,
93
+ true, // sparse
94
+ fgi.tu, // thumbnailUrl,
95
+ default_set,
96
+ false, // elevationModel
97
+ width_factor,
98
+ offset_x,
99
+ offset_y,
100
+ fgi.ct, // creditsText
101
+ fgi.cu, // creditsUrl
102
+ '', // demUrl
103
+ '', // altUrl
104
+ 0, // meanRadius
105
+ null // referenceFrame
101
106
  );
102
107
 
103
108
  util.rewritePlaceUrls(imgSet);
104
109
  }
105
110
 
111
+ var classification = (place.c !== undefined) ? place.c : wwtlib.Classification.unidentified;
112
+ var zoom_factor = (place.z !== undefined) ? place.z : -1;
113
+
106
114
  var pl = wwtlib.Place.create(
107
- place.n,//name
108
- place.d,//dec
109
- place.r,//ra
110
- place.c,//classification
111
- item.name,//constellation
112
- fgi ? fgi.dt : 2,//type
113
- place.z//zoomfactor
115
+ place.n, // name
116
+ place.d, // dec
117
+ place.r, // ra
118
+ classification,
119
+ item.name, // constellation
120
+ wwtlib.ImageSetType.sky, // type -- never changes (for now?)
121
+ zoom_factor,
114
122
  );
115
123
 
116
124
  if (imgSet) {
@@ -134,28 +142,7 @@
134
142
 
135
143
  var end = new Date();
136
144
  util.log('parsed places in ' + (end.valueOf() - start.valueOf()) + 'ms', data);
137
-
138
- var urlbase = wwtlib.URLHelpers.singleton.coreStaticUrl('data/client_v6/');
139
-
140
- importWtml(urlbase + 'Wise.wtml').then(function () {
141
- //console.log('wise loaded');
142
- importWtml(urlbase + 'Hubble.wtml').then(function () {
143
- //console.log('hubble loaded');
144
- importWtml(urlbase + 'ESO.wtml').then(function () {
145
- //console.log('eso loaded');
146
- importWtml(urlbase + 'Chandra.wtml').then(function () {
147
- //console.log('chandra loaded');
148
- importWtml(urlbase + 'Spitzer.wtml').then(function () {
149
- allDataDeferred.resolve(true);
150
- });
151
- });
152
- });
153
- });
154
- });
155
-
156
145
  deferredInit.resolve(data);
157
- } else {
158
- setTimeout(init, 333);
159
146
  }
160
147
 
161
148
  return deferredInit.promise;
@@ -194,87 +181,6 @@
194
181
  });
195
182
  };
196
183
 
197
- function importWtml(wtmlPath) {
198
- var deferred = $q.defer();
199
-
200
- $.ajax({
201
- url: wtmlPath + '?v=' + $('body').data('resVersion')
202
- }).done(function () {
203
- var wtml = $($.parseXML(arguments[0]));
204
-
205
- wtml.find('Place').each(function (i, place) {
206
- place = $(place);
207
- var constellation, ra = parseFloat(place.attr('RA')), dec = parseFloat(place.attr('Dec'));
208
-
209
- if (ra !== 0 || dec !== 0) {
210
- constellation = wwtlib.Constellations.containment.findConstellationForPoint(ra, dec);
211
-
212
- var fgi = place.find('ImageSet').length ? place.find('ImageSet') : null;
213
-
214
- var wwtPlace = wwtlib.Place.create(
215
- place.attr('Name'),
216
- dec,
217
- ra,
218
- place.attr('DataSetType'),
219
- constellation,
220
- fgi ? util.getImageSetType(fgi.attr('DataSetType')) : 2, //type
221
- parseFloat(place.find('ZoomLevel')) //zoomfactor
222
- );
223
-
224
- if (fgi != null) {
225
- imageset_id++;
226
-
227
- var imgset = wwtlib.Imageset.create(
228
- fgi.attr('Name'),
229
- fgi.attr('Url'),
230
- util.getImageSetType(fgi.attr('DataSetType')),
231
- fgi.attr('BandPass'),
232
- wwtlib.ProjectionType[fgi.attr('Projection').toLowerCase()],
233
- imageset_id, //imagesetid
234
- parseInt(fgi.attr('BaseTileLevel')),
235
- parseInt(fgi.attr('TileLevels')),
236
- null, //tilesize
237
- parseFloat(fgi.attr('BaseDegreesPerTile')),
238
- fgi.attr('FileType'),
239
- fgi.attr('BottomsUp') === 'True',
240
- '', //quadTreeTileMap (I need to find a wtml file that has this and check spelling of the attr)
241
- parseFloat(fgi.attr('CenterX')),
242
- parseFloat(fgi.attr('CenterY')),
243
- parseFloat(fgi.attr('Rotation')),
244
- true, //sparse
245
- fgi.find('ThumbnailUrl').text(), //thumbnailUrl,
246
- false, //defaultSet,
247
- false, //elevationModel
248
- parseFloat(fgi.attr('WidthFactor')), //widthFactor,
249
- parseFloat(fgi.attr('OffsetX')),
250
- parseFloat(fgi.attr('OffsetY')),
251
- fgi.find('Credits').text(),
252
- fgi.find('CreditsUrl').text(),
253
- '', '',
254
- 0, //meanRadius
255
- null
256
- );
257
-
258
- util.rewritePlaceUrls(imgset);
259
- wwtPlace.set_studyImageset(imgset);
260
- }
261
-
262
- indexPlaceNames(wwtPlace);
263
-
264
- var cIndex = constellations.indexOf(constellation);
265
- var constellationPlaces = wwt.searchData.Constellations[cIndex].places;
266
- wwtPlace.guid = cIndex + '.' + constellationPlaces.length;
267
- util.rewritePlaceUrls(wwtPlace);
268
- constellationPlaces.push(wwtPlace);
269
- }
270
- });
271
-
272
- deferred.resolve(true);
273
- });
274
-
275
- return deferred.promise;
276
- }
277
-
278
184
  initPromise = init();
279
185
 
280
186
  return api;
@@ -1,4 +1,4 @@
1
- wwt.app.factory(
1
+ wwt.app.factory(
2
2
  'SearchUtil',
3
3
  [
4
4
  'SearchData',
@@ -8,155 +8,133 @@
8
8
 
9
9
  function (searchDataService, $q, util, $rootScope) {
10
10
  var api = {
11
- runSearch: runSearch,
12
- findNearbyObjects: findNearbyObjects,
13
- getPlaceById: getPlaceById
11
+ runSearch: runSearch,
12
+ findNearbyObjects: findNearbyObjects,
13
+ getPlaceById: getPlaceById
14
14
  }
15
15
 
16
16
  function runSearch(q) {
17
- var deferred = $q.defer();
18
-
19
- searchDataService.getIndex().then(function (d) {
20
- var searchData = wwt.searchDataIndexed;
21
- var foundPlaces = [];
22
-
23
- if (q.length < 2) {
24
- foundPlaces = searchData[q];
25
- } else {
26
- var subset = searchData[q.charAt(0).toLowerCase()];
27
-
28
- $.each(subset, function (i, place) {
29
- var names = place.get_names();
30
- var placeChosen = false;
31
-
32
- $.each(names, function (j, name) {
33
- if (q.indexOf(' ') === -1 && name.split(' ').length > 1) {
34
- var words = name.split(' ');
35
-
36
- $.each(words, function (k, word) {
37
- if (word.toLowerCase().indexOf(q.toLowerCase()) === 0 && !placeChosen) {
38
- foundPlaces.push(place);
39
- placeChosen = true;
40
- }
41
- });
42
- } else if (name.toLowerCase().indexOf(q.toLowerCase()) === 0 && !placeChosen) {
43
- foundPlaces.push(place);
44
- placeChosen = true;
45
- }
46
- });
47
- });
48
- }
49
-
50
- deferred.resolve(foundPlaces.sort(sortByImagery));
51
- });
52
-
53
- return deferred.promise;
17
+ var deferred = $q.defer();
18
+
19
+ searchDataService.getIndex().then(function (d) {
20
+ var searchData = wwt.searchDataIndexed;
21
+ var foundPlaces = [];
22
+
23
+ if (q.length < 2) {
24
+ foundPlaces = searchData[q];
25
+ } else {
26
+ var subset = searchData[q.charAt(0).toLowerCase()];
27
+
28
+ $.each(subset, function (i, place) {
29
+ var names = place.get_names();
30
+ var placeChosen = false;
31
+
32
+ $.each(names, function (j, name) {
33
+ if (q.indexOf(' ') === -1 && name.split(' ').length > 1) {
34
+ var words = name.split(' ');
35
+
36
+ $.each(words, function (k, word) {
37
+ if (word.toLowerCase().indexOf(q.toLowerCase()) === 0 && !placeChosen) {
38
+ foundPlaces.push(place);
39
+ placeChosen = true;
40
+ }
41
+ });
42
+ } else if (name.toLowerCase().indexOf(q.toLowerCase()) === 0 && !placeChosen) {
43
+ foundPlaces.push(place);
44
+ placeChosen = true;
45
+ }
46
+ });
47
+ });
48
+ }
49
+
50
+ deferred.resolve(foundPlaces.sort(sortByImagery));
51
+ });
52
+
53
+ return deferred.promise;
54
54
  }
55
55
 
56
- var sortByImagery = function(p1, p2) {
57
- return p1.fromCenter - p2.fromCenter;
56
+ var sortByImagery = function (p1, p2) {
57
+ return p1.fromCenter - p2.fromCenter;
58
58
  }
59
59
 
60
+ // This interface has serious issues -- the mechanism for constructing
61
+ // place IDs is based on indices into the search data, which are *not*
62
+ // things that ought to be required to stay stable over time. A different
63
+ // approach should be used.
60
64
  function getPlaceById(id) {
61
65
  var deferred = $q.defer();
62
66
 
63
- var tryFind = function(all) {
64
- var deferred2 = $q.defer();
65
-
66
- searchDataService.getData(all).then(function (d) {
67
- var constellationIndex = parseInt(id.split('.')[0]);
68
- var placeIndex = parseInt(id.split('.')[1]);
69
- var p = d.Constellations[constellationIndex].places[placeIndex];
70
- if (p) {
71
- deferred2.resolve(p);
72
- }else{
73
- deferred2.resolve(null);
74
- }
75
- });
67
+ searchDataService.getData(all).then(function (d) {
68
+ var constellationIndex = parseInt(id.split('.')[0]);
69
+ var placeIndex = parseInt(id.split('.')[1]);
70
+ var p = d.Constellations[constellationIndex].places[placeIndex];
71
+ deferred.resolve(p || null);
72
+ });
76
73
 
77
- return deferred2.promise;
78
- };
74
+ return deferred.promise;
75
+ }
79
76
 
80
- tryFind().then(function(p) {
81
- if (p) {
82
- deferred.resolve(p);
83
- } else {
84
- console.log('wait for full');
77
+ function findNearbyObjects(args) {
78
+ var deferred = $q.defer();
85
79
 
86
- tryFind(true).then(function(p) {
87
- if (p) {
88
- deferred.resolve(p);
89
- } else {
90
- deferred.reject()
80
+ searchDataService.getData().then(function (d) {
81
+ var searchData = wwt.searchData;
82
+
83
+ if ($rootScope.viewport && (args.lookAt === 'Sky' || args.lookAt === 'SolarSystem')) {
84
+ var ulCoords = args.singleton.getCoordinatesForScreenPoint(0, 0);
85
+ var corner = wwtlib.Coordinates.raDecTo3d(ulCoords.x, ulCoords.y);
86
+ var center = wwtlib.Coordinates.raDecTo3d($rootScope.viewport.RA, $rootScope.viewport.Dec);
87
+ var dist = wwtlib.Vector3d.subtractVectors(corner, center).length();
88
+ var constellation = args.singleton.constellation;
89
+ var constellationPlaces, ssPlaces;
90
+
91
+ $.each(searchData.Constellations, function (i, item) {
92
+ if (item.name === constellation) {
93
+ constellationPlaces = item.places;
94
+ } else if (item.name === 'SolarSystem') {
95
+ ssPlaces = item.places;
91
96
  }
92
97
  });
93
- }
94
- });
95
98
 
96
- return deferred.promise;
97
- }
99
+ if (args.lookAt === 'SolarSystem') {
100
+ deferred.resolve(ssPlaces);
101
+ }
98
102
 
99
- function findNearbyObjects(args) {
100
- var deferred = $q.defer();
101
-
102
- searchDataService.getData().then(function(d) {
103
- var searchData = wwt.searchData;
104
-
105
- if ($rootScope.viewport && (args.lookAt === 'Sky' || args.lookAt === 'SolarSystem')) {
106
- var ulCoords = args.singleton.getCoordinatesForScreenPoint(0, 0);
107
- var corner = wwtlib.Coordinates.raDecTo3d(ulCoords.x, ulCoords.y);
108
- var center = wwtlib.Coordinates.raDecTo3d($rootScope.viewport.RA, $rootScope.viewport.Dec);
109
- var dist = wwtlib.Vector3d.subtractVectors(corner, center).length();
110
- var constellation = args.singleton.constellation;
111
- var constellationPlaces, ssPlaces;
112
-
113
- $.each(searchData.Constellations, function(i, item) {
114
- if (item.name === constellation) {
115
- constellationPlaces = item.places;
116
- } else if (item.name === 'SolarSystem') {
117
- ssPlaces = item.places;
118
- }
119
- });
120
-
121
- if (args.lookAt === 'SolarSystem') {
122
- deferred.resolve(ssPlaces);
123
- }
124
-
125
- var searchPlaces = ssPlaces.concat(constellationPlaces);
126
- var results = [];
103
+ var searchPlaces = ssPlaces.concat(constellationPlaces);
104
+ var results = [];
127
105
  var solsys = [];
128
106
  var imgsets = [];
129
107
 
130
- $.each(searchPlaces, function(i, place) {
131
- if (place && place.get_name() !== 'Earth') {
132
- try {
133
- var placeDist = wwtlib.Vector3d.subtractVectors(place.get_location3d(), center);
108
+ $.each(searchPlaces, function (i, place) {
109
+ if (place && place.get_name() !== 'Earth') {
110
+ try {
111
+ var placeDist = wwtlib.Vector3d.subtractVectors(place.get_location3d(), center);
134
112
 
135
- if (dist > placeDist.length()) {
136
- place.fromCenter = placeDist.length();
113
+ if (dist > placeDist.length()) {
114
+ place.fromCenter = placeDist.length();
137
115
 
138
- if (place.get_constellation() === 'SolarSystem') {
139
- solsys.push(place)
116
+ if (place.get_constellation() === 'SolarSystem') {
117
+ solsys.push(place)
140
118
  } else if (place.get_studyImageset()) {
141
- imgsets.push(place);
119
+ imgsets.push(place);
142
120
  } else {
143
121
  results.push(place);
144
122
  }
145
- }
146
- } catch (er) {
147
- util.log(er, place);
148
- }
149
- }
150
- });
151
-
152
- solsys = solsys.sort(sortByImagery);
153
- deferred.resolve(solsys.concat(imgsets.sort(sortByImagery), results.sort(sortByImagery)));
154
- } else {
155
- deferred.resolve([]);
156
- }
157
- });
158
-
159
- return deferred.promise;
123
+ }
124
+ } catch (er) {
125
+ util.log(er, place);
126
+ }
127
+ }
128
+ });
129
+
130
+ solsys = solsys.sort(sortByImagery);
131
+ deferred.resolve(solsys.concat(imgsets.sort(sortByImagery), results.sort(sortByImagery)));
132
+ } else {
133
+ deferred.resolve([]);
134
+ }
135
+ });
136
+
137
+ return deferred.promise;
160
138
  }
161
139
 
162
140
  return api;
package/factories/Util.js CHANGED
@@ -128,6 +128,22 @@
128
128
  var minutes = Math.floor(remainder);
129
129
  var seconds = (remainder - minutes) * 60;
130
130
 
131
+ if (isNaN(extraPrecision)) {
132
+ extraPrecision = 0;
133
+ }
134
+ var secondsStr = seconds.toFixed(extraPrecision);
135
+
136
+ if (secondsStr.startsWith('60')) {
137
+ seconds = 0;
138
+ secondsStr = seconds.toFixed(extraPrecision);
139
+ minutes += 1;
140
+
141
+ if (minutes == 60) {
142
+ minutes = 0;
143
+ hourlike += 1;
144
+ }
145
+ }
146
+
131
147
  values[0] = hourlike.toFixed(0);
132
148
  if (hourlike < 10) {
133
149
  values[0] = '0' + values[0];
@@ -138,11 +154,7 @@
138
154
  values[1] = '0' + values[1];
139
155
  }
140
156
 
141
- if (isNaN(extraPrecision)) {
142
- extraPrecision = 0;
143
- }
144
-
145
- values[2] = seconds.toFixed(extraPrecision);
157
+ values[2] = secondsStr;
146
158
  if (seconds < 10) {
147
159
  values[2] = '0' + values[2];
148
160
  }
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "type": "git",
36
36
  "url": "https://github.com/WorldWideTelescope/wwt-web-client.git"
37
37
  },
38
- "version": "6.3.5"
38
+ "version": "6.4.1"
39
39
  }
@@ -1,21 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
- <Folder Name="Collections" Group="Explorer" >
3
- <Folder Name="Latest Imagery" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=vampfeeds" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=folder" />
4
- <Folder Name="Constellations" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=constellations" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=constellations" />
5
- <Folder Name="Solar System (Sky)" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=solarsystemsky" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=solarsystem" />
6
- <Folder Name="All-Sky Surveys" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=surveys" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=aitoff" />
7
- <Folder Name="HiPS Surveys" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=hips" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=aitoff" />
8
- <Folder Name="Spitzer Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=studiesspitzer" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=spitzer" />
9
- <Folder Name="Chandra Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=studieschandra" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=chandra" />
10
- <Folder Name="Hubble Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=studieshubble" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=hubble" />
11
- <Folder Name="Astrophotography" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=astrophoto" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=egastrophoto" />
12
- <Folder Name="SOFIA Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=sofia_studies" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=nasa_sofia" />
13
- <Folder Name="Radio Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=studiesradio" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=radiostudies" />
14
- <Folder Name="NOAO Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=studiesnoao" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=noao" />
15
- <Folder Name="Gemini Studies" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=geministudies" Group="Explorer" Searchable="True" Type="Sky" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=geminiobservatory" />
16
- <Folder Name="Messier Catalog" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=messier" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=messier" />
17
- <Folder Name="Planets/Moons" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=solarsystemsphere" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=solarsystem" />
18
- <Folder Name="Earth" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=earth" Group="Explorer" Type="Planet" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=earthhybrid" />
19
- <Folder Name="Mars" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=marsroot&amp;v=2" Group="Explorer" Type="Planet" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=mars" />
20
- <Folder Name="Panoramas" Url="http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=panos" Group="Explorer" Thumbnail="http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=pano" />
21
- </Folder>