Skip to content

Commit 6d0d1a4

Browse files
authored
Firefly-88: Merge PR #835 from firefly-88-coverage-map
Firefly-88: Improve coverage, catalog & Image layer handling
2 parents 5b23be4 + 6382f34 commit 6d0d1a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1018
-422
lines changed
319 Bytes
Loading
743 Bytes
Loading
1.17 KB
Loading

src/firefly/html/test/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ <h3>Firefly Test</h3>
4848
<li class="test-item"><a href="tests-chart.html">Chart Tests</a>
4949
<div class="test-desc">This page tests various charts. </div>
5050
</li>
51+
<li class="test-item"><a href="test-misc.html">Misc Tests</a>
52+
<div class="test-desc">This page tests small API items. </div>
53+
</li>
5154
</ul>
5255

5356

@@ -112,6 +115,7 @@ <h4>To add a test to an existing page</h4>
112115
+ indent-4 :source need to adjust for 4 indentation
113116
+ indent-5 :source need to adjust for 5 indentation
114117
expected-list :turn on normal list styling, use with ul element (firefly turns it off)
118+
exclusive :if defined on any template, display only that template (for debugging)
115119
</xmp>
116120
</div>
117121

src/firefly/html/test/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313

1414
.tpl {
15-
--tpl-height: 300px;
15+
--tpl-height: 400px;
1616
height: var(--tpl-height);
1717
}
1818
.tpl.xs {

src/firefly/html/test/template_loader.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
window.onload = function () {
44
const tests = document.getElementsByTagName('template');
5-
var cnt = 1;
6-
Object.values(tests).forEach(function(test) {
7-
const c = test.content;
8-
const expected = c.querySelector('#expected');
9-
const actual = c.querySelector('#actual');
10-
const scpt = c.querySelector('script');
11-
12-
renderTest(cnt++, expected, actual, scpt, test);
13-
});
5+
let cnt = 1;
6+
const allTest= Object.values(tests);
7+
const exclusiveTest= allTest.filter( (test) => test.className && test.className.includes('exclusive'));
8+
const activeTest= exclusiveTest.length ? exclusiveTest : allTest;
9+
activeTest.forEach((test) => {
10+
const c = test.content;
11+
const expected = c.querySelector('#expected');
12+
const actual = c.querySelector('#actual');
13+
const scpt = c.querySelector('script');
14+
renderTest(cnt++, expected, actual, scpt, test, Boolean(exclusiveTest.length));
15+
});
1416
};
1517

16-
function renderTest(cnt, expected, actual, script, testTmpl) {
17-
const title = cnt + ' - ' + testTmpl.title;
18+
19+
function renderTest(cnt, expected, actual, script, testTmpl, onlyUsingExclusize) {
20+
const title = (onlyUsingExclusize? 'EXCLUSIVE - ' : '') + cnt + ' - ' + testTmpl.title;
1821
const iframe = document.createElement('iframe');
1922
iframe.id = 'iframe';
2023
iframe.src = './template.html';

src/firefly/html/test/test-misc.html

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!doctype html>
2+
3+
<!--
4+
~ License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
5+
-->
6+
7+
<html>
8+
9+
<head>
10+
<title>Firefly main tests</title>
11+
<link rel="stylesheet" href="styles.css">
12+
<script type="text/javascript" src="template_loader.js"></script>
13+
</head>
14+
15+
<body>
16+
17+
<!-- define all of your tests below -->
18+
19+
<template title="API 2 Table / Customized HiPS" style='height: 400px' class="tpl" >
20+
<div id="expected" style="position: relative" >
21+
<div class="source-code indent-3" style="position: absolute; bottom: 0; left: 0">
22+
- two tables, both wise catalogs
23+
- Coverage display, HiPS, ALLWISE
24+
- HiPS image is customized
25+
- META_INFO contains
26+
{CoverageHiPS: 'ivo://CDS/P/allWISE/color'}
27+
28+
- Testing:
29+
- click on table to center catalog
30+
- zoom in and click on rows to center
31+
if off the screen
32+
</div>
33+
</div>
34+
<div id="actual" class="flow-h">
35+
<div id="tableDiv" style='width:500px;' class="box"></div>
36+
<div id="coverageDiv" style='width:500px;' class="box"></div>
37+
</div>
38+
<script>
39+
irsaviewer_init();
40+
41+
onFireflyLoaded = function (firefly) {
42+
43+
firefly.util.image.initAutoReadout(
44+
firefly.ui.DefaultApiReadout,
45+
{ MouseReadoutComponent:firefly.ui.PopupMouseReadoutMinimal,
46+
showThumb:false,
47+
showMag:false
48+
}
49+
);
50+
table1Data = firefly.util.table.makeIrsaCatalogRequest('WISE catalog', 'WISE', 'allwise_p3as_psd',
51+
{ position: '10.68479;41.26906;EQ_J2000',
52+
SearchMethod: 'Cone',
53+
radius: 100
54+
},
55+
{ META_INFO: {CENTER_COLUMN: 'ra;dec;EQJ2000', CatalogOverlayType: 'IRSA', CoverageHiPS: 'ivo://CDS/P/allWISE/color'}}
56+
);
57+
58+
table2Data = firefly.util.table.makeIrsaCatalogRequest('WISE catalog', 'WISE', 'allwise_p3as_psd',
59+
{ position: '0;0;GAL',
60+
SearchMethod: 'Cone',
61+
radius: 200
62+
},
63+
{ META_INFO: {CENTER_COLUMN: 'ra;dec;EQJ2000',
64+
CatalogOverlayType: 'IRSA'}}
65+
);
66+
67+
firefly.showTable('tableDiv', table1Data,
68+
{ removable: true,
69+
showTitle:false,
70+
showUnits: true,
71+
showFilters: false,
72+
selectable: false,
73+
expandable: true,
74+
help_id: 'tables'
75+
}
76+
);
77+
78+
firefly.showTable('tableDiv', table2Data,
79+
{ removable: true,
80+
showTitle:false,
81+
showUnits: true,
82+
showFilters: false,
83+
selectable: false,
84+
expandable: true,
85+
help_id: 'tables'
86+
}
87+
);
88+
89+
90+
firefly.showCoverage('coverageDiv', {gridOn:'FALSE'});
91+
92+
}
93+
</script>
94+
</template>
95+
96+
97+
<!-- this is where test cases will be attached-->
98+
<div id="tst-container"/>
99+
100+
101+
</body>

src/firefly/html/test/tests-main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
</script>
122122
</template>
123123

124-
<template title="Failed API Image Load" class="tpl" style="height: 260px">
124+
<template title="Failed API Image Load" class="tpl sm" >
125125
<div id="expected" >
126126
Image load fails. The following should happen:
127127
<ul class='expected-list'>
@@ -146,7 +146,7 @@
146146
</script>
147147
</template>
148148

149-
<template title="Two table coverage" class="tpl" style="height: 260px">
149+
<template title="Two table coverage" class="tpl" >
150150
<div id="expected" >
151151
<div>Both tables cover similar area, HiPS coverage
152152
<ul class='expected-list'>

src/firefly/java/edu/caltech/ipac/firefly/server/query/IpacTableFromExternalTask.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.File;
1717
import java.io.IOException;
1818
import java.util.List;
19+
import java.util.Map;
1920

2021
import static edu.caltech.ipac.firefly.data.TableServerRequest.TBL_INDEX;
2122

@@ -59,7 +60,10 @@ public void prepareTableMeta(TableMeta defaults, List<DataType> columns, ServerR
5960
defaults.setAttribute(p.getName(), p.getValue());
6061
}
6162
}
62-
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
63+
Map reqMeta= ((TableServerRequest) request).getMeta();
64+
if (reqMeta==null || !reqMeta.containsKey(MetaConst.CATALOG_OVERLAY_TYPE)) {
65+
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
66+
}
6367
}
6468

6569

src/firefly/java/edu/caltech/ipac/firefly/server/query/tables/IpacTableFromSource.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.net.MalformedURLException;
3737
import java.net.URL;
3838
import java.util.List;
39+
import java.util.Map;
3940

4041
import static edu.caltech.ipac.firefly.data.TableServerRequest.TBL_INDEX;
4142
import static edu.caltech.ipac.firefly.server.query.tables.IpacTableFromSource.PROC_ID;
@@ -165,7 +166,10 @@ private File getSourceFile(String source, TableServerRequest request, boolean ch
165166
public void prepareTableMeta(TableMeta defaults, List<DataType> columns, ServerRequest request) {
166167
String type = request.getParam(TBL_TYPE);
167168
if (type == null || type.equals(TYPE_CATALOG)) {
168-
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
169+
Map reqMeta= ((TableServerRequest) request).getMeta();
170+
if (reqMeta==null || !reqMeta.containsKey(MetaConst.CATALOG_OVERLAY_TYPE)) {
171+
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
172+
}
169173
}
170174
}
171175

src/firefly/js/Firefly.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const defFireflyOptions = {
112112
irsaCatalogFilter: undefined,
113113
catalogSpacialOp: undefined,
114114
imageMasterSources: ['ALL'],
115+
showCatalogSearchTarget: true,
115116
imageMasterSourcesOrder: undefined,
116117
workspace : { showOptions: false},
117118
wcsMatchType: false,

src/firefly/js/api/ApiBuild.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ import {buildViewerApi} from './ApiViewer.js';
5353

5454
// CSS
5555
import './ApiStyle.css';
56+
import {startTTFeatureWatchers} from '../templates/common/ttFeatureWatchers.js';
57+
import {activeRowCenterDef} from '../visualize/saga/ActiveRowCenterWatcher.js';
58+
import {urlLinkWatcherDef} from '../visualize/saga/UrlLinkWatcher.js';
5659

5760

5861
/**
@@ -128,6 +131,7 @@ export function initApi() {
128131
dispatchOnAppReady(() => {
129132
window.onFireflyLoaded && window.onFireflyLoaded(firefly);
130133
});
134+
startTTFeatureWatchers([urlLinkWatcherDef.id, activeRowCenterDef.id]);
131135
initExpandedView();
132136
}
133137

src/firefly/js/core/MasterSaga.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export function dispatchAddActionWatcher({id, actions, callback, params={}}) {
127127
* list will force any watcher def with an id in the list to not watch
128128
* @param {boolean} p.stopPropagation - like excludes but if true not only watcher will be added
129129
* @param {boolean} p.enabled - if true this TableTypeWatcher will test and add, if false it will be skipped
130+
* @param {boolean} p.allowMultiples - multiple defs of this type are allowed.
130131
*
131132
* @see TableWatchFunc
132133
* @see TestWatchFunc
@@ -137,10 +138,10 @@ export function dispatchAddActionWatcher({id, actions, callback, params={}}) {
137138
*/
138139
export function dispatchAddTableTypeWatcherDef({id, actions, excludes= [], testTable= ()=>true,
139140
watcher, options={}, enabled= true, stopPropagation= false,
140-
sharedData}) {
141+
sharedData, allowMultiples}) {
141142
flux.process({
142143
type: ADD_TABLE_TYPE_WATCHER,
143-
payload: {id, actions, excludes, testTable, watcher, options, enabled, stopPropagation, sharedData}
144+
payload: {id, actions, excludes, testTable, watcher, options, enabled, stopPropagation, sharedData,allowMultiples}
144145
});
145146
}
146147

@@ -301,6 +302,7 @@ function addTableTypeWatcherDef(def) {
301302
setTimeout(() => {
302303
if (isEmpty(getTTWatcherDefList())) initTTWatcher();
303304
// validate and start
305+
if (!def.allowMultiples && ttWatcherDefList.find( (d) => d.id===def.id)) return;
304306
if (isFunction(def.watcher) && isArray(def.actions) && def.id) insertTTWatcherDef(def);
305307
else console.error('TableTypeWatcher: watcher, actions, and id are required.');
306308
retroactiveTTStart(def);

src/firefly/js/core/ReduxFlux.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {watchExtensionActions} from '../core/messaging/ExternalAccessWatcher.js'
3939

4040

4141
//--- import drawing Layers
42-
import ActiveTarget from '../drawingLayers/ActiveTarget.js';
42+
// import ActiveTarget from '../drawingLayers/ActiveTarget.js';
4343
import FixedMarker from '../drawingLayers/FixedMarker.js';
4444
import SelectArea from '../drawingLayers/SelectArea.js';
4545
import DistanceTool from '../drawingLayers/DistanceTool.js';
@@ -56,6 +56,7 @@ import RegionPlot from '../drawingLayers/RegionPlot.js';
5656
import MarkerTool from '../drawingLayers/MarkerTool.js';
5757
import FootprintTool from '../drawingLayers/FootprintTool.js';
5858
import ImageOutline from '../drawingLayers/ImageOutline.js';
59+
import ImageRoot from '../drawingLayers/ImageRoot.js';
5960
import {showExampleDialog} from '../ui/ExampleDialog.jsx';
6061
import ImageLineBasedFootprint from '../drawingLayers/ImageLineBasedFootprint.js';
6162

@@ -99,8 +100,8 @@ const actionCreators = new Map();
99100

100101

101102

102-
const drawLayerFactory= DrawLayerFactory.makeFactory(ActiveTarget,FixedMarker, SelectArea,DistanceTool,
103-
PointSelection, StatsPoint, NorthUpCompass,
103+
const drawLayerFactory= DrawLayerFactory.makeFactory(FixedMarker, SelectArea,DistanceTool,
104+
PointSelection, StatsPoint, NorthUpCompass, ImageRoot,
104105
Catalog, Artifact, WebGrid, RegionPlot,
105106
MarkerTool, FootprintTool, HiPSGrid, HiPSMOC,
106107
ImageOutline, ImageLineBasedFootprint);

src/firefly/js/data/MetaConst.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export const MetaConst = {
5757
/** the column name with the url or filename of the image data */
5858
DATA_SOURCE : 'DataSource',
5959

60+
/** a url for HiPS Image to use as the coverage - overrides firefly defaults */
61+
COVERAGE_HIPS : 'CoverageHiPS',
62+
6063
/** the column name with access rights info; true if (public, 1, or true), otherwise false */
6164
DATARIGHTS_COL : 'DATARIGHTS_COL',
6265

src/firefly/js/drawingLayers/ActiveTarget.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ import {makeDrawingDef} from '../visualize/draw/DrawingDef.js';
1313
import DrawLayer, {DataTypes,ColorChangeType} from '../visualize/draw/DrawLayer.js';
1414
import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
1515
import {formatPosForTextField} from '../data/form/PositionFieldDef.js';
16+
import {getUIComponent} from './ActiveTargetUI.jsx';
1617

1718
const ID= 'ACTIVE_TARGET';
1819
const TYPE_ID= 'ACTIVE_TARGET_TYPE';
1920

2021

2122

22-
const factoryDef= makeFactoryDef(TYPE_ID,creator,getDrawData,getLayerChanges,null,null);
23+
const factoryDef= makeFactoryDef(TYPE_ID,creator,getDrawData,getLayerChanges,null,getUIComponent);
2324

2425
export default {factoryDef, TYPE_ID}; // every draw layer must default export with factoryDef and TYPE_ID
2526

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
3+
*/
4+
5+
import React from 'react';
6+
import PropTypes from 'prop-types';
7+
import {FixedPtControl} from './CatalogUI.jsx';
8+
import {primePlot} from '../visualize/PlotViewUtil';
9+
import {PlotAttribute} from '../visualize/WebPlot.js';
10+
11+
12+
export const getUIComponent = (drawLayer,pv) => <ActiveTargetUI drawLayer={drawLayer} pv={pv}/>;
13+
14+
function ActiveTargetUI({pv}) {
15+
16+
const plot= primePlot(pv);
17+
return (
18+
<div>
19+
<FixedPtControl wp={plot.attributes[PlotAttribute.FIXED_TARGET]} pv={pv}/>
20+
</div>
21+
);
22+
}
23+
24+
ActiveTargetUI.propTypes= {
25+
drawLayer : PropTypes.object.isRequired,
26+
pv : PropTypes.object.isRequired
27+
};
28+

0 commit comments

Comments
 (0)