Skip to content

Firefly-88: Improve coverage, catalog & Image layer handling #835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/firefly/html/images/20x20-center-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/firefly/html/images/20x20_clipboard-checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/firefly/html/images/20x20_clipboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/firefly/html/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ <h3>Firefly Test</h3>
<li class="test-item"><a href="tests-chart.html">Chart Tests</a>
<div class="test-desc">This page tests various charts. </div>
</li>
<li class="test-item"><a href="test-misc.html">Misc Tests</a>
<div class="test-desc">This page tests small API items. </div>
</li>
</ul>


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

Expand Down
2 changes: 1 addition & 1 deletion src/firefly/html/test/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

.tpl {
--tpl-height: 300px;
--tpl-height: 400px;
height: var(--tpl-height);
}
.tpl.xs {
Expand Down
25 changes: 14 additions & 11 deletions src/firefly/html/test/template_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@

window.onload = function () {
const tests = document.getElementsByTagName('template');
var cnt = 1;
Object.values(tests).forEach(function(test) {
const c = test.content;
const expected = c.querySelector('#expected');
const actual = c.querySelector('#actual');
const scpt = c.querySelector('script');

renderTest(cnt++, expected, actual, scpt, test);
});
let cnt = 1;
const allTest= Object.values(tests);
const exclusiveTest= allTest.filter( (test) => test.className && test.className.includes('exclusive'));
const activeTest= exclusiveTest.length ? exclusiveTest : allTest;
activeTest.forEach((test) => {
const c = test.content;
const expected = c.querySelector('#expected');
const actual = c.querySelector('#actual');
const scpt = c.querySelector('script');
renderTest(cnt++, expected, actual, scpt, test, Boolean(exclusiveTest.length));
});
};

function renderTest(cnt, expected, actual, script, testTmpl) {
const title = cnt + ' - ' + testTmpl.title;

function renderTest(cnt, expected, actual, script, testTmpl, onlyUsingExclusize) {
const title = (onlyUsingExclusize? 'EXCLUSIVE - ' : '') + cnt + ' - ' + testTmpl.title;
const iframe = document.createElement('iframe');
iframe.id = 'iframe';
iframe.src = './template.html';
Expand Down
101 changes: 101 additions & 0 deletions src/firefly/html/test/test-misc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<!doctype html>

<!--
~ License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
-->

<html>

<head>
<title>Firefly main tests</title>
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" src="template_loader.js"></script>
</head>

<body>

<!-- define all of your tests below -->

<template title="API 2 Table / Customized HiPS" style='height: 400px' class="tpl" >
<div id="expected" style="position: relative" >
<div class="source-code indent-3" style="position: absolute; bottom: 0; left: 0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text in "expected" is cut. May be add 'overflow: auto'?

- two tables, both wise catalogs
- Coverage display, HiPS, ALLWISE
- HiPS image is customized
- META_INFO contains
{CoverageHiPS: 'ivo://CDS/P/allWISE/color'}

- Testing:
- click on table to center catalog
- zoom in and click on rows to center
if off the screen
</div>
</div>
<div id="actual" class="flow-h">
<div id="tableDiv" style='width:500px;' class="box"></div>
<div id="coverageDiv" style='width:500px;' class="box"></div>
</div>
<script>
irsaviewer_init();

onFireflyLoaded = function (firefly) {

firefly.util.image.initAutoReadout(
firefly.ui.DefaultApiReadout,
{ MouseReadoutComponent:firefly.ui.PopupMouseReadoutMinimal,
showThumb:false,
showMag:false
}
);
table1Data = firefly.util.table.makeIrsaCatalogRequest('WISE catalog', 'WISE', 'allwise_p3as_psd',
{ position: '10.68479;41.26906;EQ_J2000',
SearchMethod: 'Cone',
radius: 100
},
{ META_INFO: {CENTER_COLUMN: 'ra;dec;EQJ2000', CatalogOverlayType: 'IRSA', CoverageHiPS: 'ivo://CDS/P/allWISE/color'}}
);

table2Data = firefly.util.table.makeIrsaCatalogRequest('WISE catalog', 'WISE', 'allwise_p3as_psd',
{ position: '0;0;GAL',
SearchMethod: 'Cone',
radius: 200
},
{ META_INFO: {CENTER_COLUMN: 'ra;dec;EQJ2000',
CatalogOverlayType: 'IRSA'}}
);

firefly.showTable('tableDiv', table1Data,
{ removable: true,
showTitle:false,
showUnits: true,
showFilters: false,
selectable: false,
expandable: true,
help_id: 'tables'
}
);

firefly.showTable('tableDiv', table2Data,
{ removable: true,
showTitle:false,
showUnits: true,
showFilters: false,
selectable: false,
expandable: true,
help_id: 'tables'
}
);


firefly.showCoverage('coverageDiv', {gridOn:'FALSE'});

}
</script>
</template>


<!-- this is where test cases will be attached-->
<div id="tst-container"/>


</body>
4 changes: 2 additions & 2 deletions src/firefly/html/test/tests-main.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
</script>
</template>

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

<template title="Two table coverage" class="tpl" style="height: 260px">
<template title="Two table coverage" class="tpl" >
<div id="expected" >
<div>Both tables cover similar area, HiPS coverage
<ul class='expected-list'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

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

Expand Down Expand Up @@ -59,7 +60,10 @@ public void prepareTableMeta(TableMeta defaults, List<DataType> columns, ServerR
defaults.setAttribute(p.getName(), p.getValue());
}
}
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
Map reqMeta= ((TableServerRequest) request).getMeta();
if (reqMeta==null || !reqMeta.containsKey(MetaConst.CATALOG_OVERLAY_TYPE)) {
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Map;

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

Expand Down
1 change: 1 addition & 0 deletions src/firefly/js/Firefly.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const defFireflyOptions = {
irsaCatalogFilter: undefined,
catalogSpacialOp: undefined,
imageMasterSources: ['ALL'],
showCatalogSearchTarget: true,
imageMasterSourcesOrder: undefined,
workspace : { showOptions: false},
wcsMatchType: false,
Expand Down
4 changes: 4 additions & 0 deletions src/firefly/js/api/ApiBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ import {buildViewerApi} from './ApiViewer.js';

// CSS
import './ApiStyle.css';
import {startTTFeatureWatchers} from '../templates/common/ttFeatureWatchers.js';
import {activeRowCenterDef} from '../visualize/saga/ActiveRowCenterWatcher.js';
import {urlLinkWatcherDef} from '../visualize/saga/UrlLinkWatcher.js';


/**
Expand Down Expand Up @@ -128,6 +131,7 @@ export function initApi() {
dispatchOnAppReady(() => {
window.onFireflyLoaded && window.onFireflyLoaded(firefly);
});
startTTFeatureWatchers([urlLinkWatcherDef.id, activeRowCenterDef.id]);
initExpandedView();
}

Expand Down
6 changes: 4 additions & 2 deletions src/firefly/js/core/MasterSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export function dispatchAddActionWatcher({id, actions, callback, params={}}) {
* list will force any watcher def with an id in the list to not watch
* @param {boolean} p.stopPropagation - like excludes but if true not only watcher will be added
* @param {boolean} p.enabled - if true this TableTypeWatcher will test and add, if false it will be skipped
* @param {boolean} p.allowMultiples - multiple defs of this type are allowed.
*
* @see TableWatchFunc
* @see TestWatchFunc
Expand All @@ -137,10 +138,10 @@ export function dispatchAddActionWatcher({id, actions, callback, params={}}) {
*/
export function dispatchAddTableTypeWatcherDef({id, actions, excludes= [], testTable= ()=>true,
watcher, options={}, enabled= true, stopPropagation= false,
sharedData}) {
sharedData, allowMultiples}) {
flux.process({
type: ADD_TABLE_TYPE_WATCHER,
payload: {id, actions, excludes, testTable, watcher, options, enabled, stopPropagation, sharedData}
payload: {id, actions, excludes, testTable, watcher, options, enabled, stopPropagation, sharedData,allowMultiples}
});
}

Expand Down Expand Up @@ -301,6 +302,7 @@ function addTableTypeWatcherDef(def) {
setTimeout(() => {
if (isEmpty(getTTWatcherDefList())) initTTWatcher();
// validate and start
if (!def.allowMultiples && ttWatcherDefList.find( (d) => d.id===def.id)) return;
if (isFunction(def.watcher) && isArray(def.actions) && def.id) insertTTWatcherDef(def);
else console.error('TableTypeWatcher: watcher, actions, and id are required.');
retroactiveTTStart(def);
Expand Down
7 changes: 4 additions & 3 deletions src/firefly/js/core/ReduxFlux.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {watchExtensionActions} from '../core/messaging/ExternalAccessWatcher.js'


//--- import drawing Layers
import ActiveTarget from '../drawingLayers/ActiveTarget.js';
// import ActiveTarget from '../drawingLayers/ActiveTarget.js';
import FixedMarker from '../drawingLayers/FixedMarker.js';
import SelectArea from '../drawingLayers/SelectArea.js';
import DistanceTool from '../drawingLayers/DistanceTool.js';
Expand All @@ -56,6 +56,7 @@ import RegionPlot from '../drawingLayers/RegionPlot.js';
import MarkerTool from '../drawingLayers/MarkerTool.js';
import FootprintTool from '../drawingLayers/FootprintTool.js';
import ImageOutline from '../drawingLayers/ImageOutline.js';
import ImageRoot from '../drawingLayers/ImageRoot.js';
import {showExampleDialog} from '../ui/ExampleDialog.jsx';
import ImageLineBasedFootprint from '../drawingLayers/ImageLineBasedFootprint.js';

Expand Down Expand Up @@ -99,8 +100,8 @@ const actionCreators = new Map();



const drawLayerFactory= DrawLayerFactory.makeFactory(ActiveTarget,FixedMarker, SelectArea,DistanceTool,
PointSelection, StatsPoint, NorthUpCompass,
const drawLayerFactory= DrawLayerFactory.makeFactory(FixedMarker, SelectArea,DistanceTool,
PointSelection, StatsPoint, NorthUpCompass, ImageRoot,
Catalog, Artifact, WebGrid, RegionPlot,
MarkerTool, FootprintTool, HiPSGrid, HiPSMOC,
ImageOutline, ImageLineBasedFootprint);
Expand Down
3 changes: 3 additions & 0 deletions src/firefly/js/data/MetaConst.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export const MetaConst = {
/** the column name with the url or filename of the image data */
DATA_SOURCE : 'DataSource',

/** a url for HiPS Image to use as the coverage - overrides firefly defaults */
COVERAGE_HIPS : 'CoverageHiPS',

/** the column name with access rights info; true if (public, 1, or true), otherwise false */
DATARIGHTS_COL : 'DATARIGHTS_COL',

Expand Down
3 changes: 2 additions & 1 deletion src/firefly/js/drawingLayers/ActiveTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import {makeDrawingDef} from '../visualize/draw/DrawingDef.js';
import DrawLayer, {DataTypes,ColorChangeType} from '../visualize/draw/DrawLayer.js';
import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
import {formatPosForTextField} from '../data/form/PositionFieldDef.js';
import {getUIComponent} from './ActiveTargetUI.jsx';

const ID= 'ACTIVE_TARGET';
const TYPE_ID= 'ACTIVE_TARGET_TYPE';



const factoryDef= makeFactoryDef(TYPE_ID,creator,getDrawData,getLayerChanges,null,null);
const factoryDef= makeFactoryDef(TYPE_ID,creator,getDrawData,getLayerChanges,null,getUIComponent);

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

Expand Down
28 changes: 28 additions & 0 deletions src/firefly/js/drawingLayers/ActiveTargetUI.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/

import React from 'react';
import PropTypes from 'prop-types';
import {FixedPtControl} from './CatalogUI.jsx';
import {primePlot} from '../visualize/PlotViewUtil';
import {PlotAttribute} from '../visualize/WebPlot.js';


export const getUIComponent = (drawLayer,pv) => <ActiveTargetUI drawLayer={drawLayer} pv={pv}/>;

function ActiveTargetUI({pv}) {

const plot= primePlot(pv);
return (
<div>
<FixedPtControl wp={plot.attributes[PlotAttribute.FIXED_TARGET]} pv={pv}/>
</div>
);
}

ActiveTargetUI.propTypes= {
drawLayer : PropTypes.object.isRequired,
pv : PropTypes.object.isRequired
};

Loading