Skip to content

Commit 22a405a

Browse files
authored
Firefly-75: Merge PR #825 firefly-75-wcsmatch
Firefly-75: Implement new WCS matching scheme
2 parents b424085 + 42e452a commit 22a405a

Some content is hidden

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

47 files changed

+815
-439
lines changed

src/firefly/html/firefly-dev.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
catalogSpacialOp: 'polygonWhenPlotExist',
3030
workspace : {showOptions: true},
3131
imageMasterSourcesOrder: ['WISE', '2MASS', 'Spitzer'],
32+
wcsMatchType: 'Standard', // 'Standard', 'Target', 'Pixel', 'PixelCenter'
3233
charts: {
3334
singleTraceUI: false
3435
},
443 Bytes
Loading
459 Bytes
Loading
504 Bytes
Loading
442 Bytes
Loading
67 Bytes
Loading

src/firefly/js/Firefly.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
34
*/
@@ -25,6 +26,7 @@ import {ActionEventHandler} from './core/messaging/MessageHandlers.js';
2526
import {init} from './rpc/CoreServices.js';
2627
import {getPropsWith, mergeObjectOnly} from './util/WebUtil.js';
2728
import {initLostConnectionWarning} from './ui/LostConnection.jsx';
29+
import {dispatchWcsMatch} from './visualize/ImagePlotCntlr';
2830

2931
export const flux = reduxFlux;
3032

@@ -112,6 +114,7 @@ const defFireflyOptions = {
112114
imageMasterSources: ['ALL'],
113115
imageMasterSourcesOrder: undefined,
114116
workspace : { showOptions: false},
117+
wcsMatchType: false,
115118

116119
charts: {
117120
defaultDeletable: undefined, // by default if there are more than one chart in container, all charts are deletable
@@ -179,6 +182,9 @@ function fireflyInit(props, options={}) {
179182
if (options.readoutDefaultPref) {
180183
dispatchChangeReadoutPrefs(options.readoutDefaultPref);
181184
}
185+
if (options.wcsMatchType) {
186+
dispatchWcsMatch({matchType:options.wcsMatchType, lockMatch:true});
187+
}
182188

183189
// initialize UI or API depending on entry mode.
184190
if (viewer) {

src/firefly/js/drawingLayers/DistanceTool.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import ShapeDataObj from '../visualize/draw/ShapeDataObj.js';
1919
import {primePlot, getDrawLayerById} from '../visualize/PlotViewUtil.js';
2020
import {getUIComponent} from './DistanceToolUI.jsx';
2121
import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
22+
import {hasWCSProjection} from '../visualize/PlotViewUtil';
2223

2324

2425
const EDIT_DISTANCE= BrowserInfo.isTouchInput() ? 18 : 10;
@@ -54,7 +55,7 @@ export function distanceToolEndActionCreator(rawAction) {
5455
drawLayer= getDrawLayerById(getState()[DRAWING_LAYER_KEY], drawLayer.drawLayerId);
5556

5657
var sel= {pt0:drawLayer.firstPt,pt1:drawLayer.currentPt};
57-
dispatchAttributeChange(plotId,true,PlotAttribute.ACTIVE_DISTANCE,sel,true);
58+
dispatchAttributeChange({plotId,attKey:PlotAttribute.ACTIVE_DISTANCE,attValue:sel});
5859
};
5960
}
6061

@@ -94,7 +95,10 @@ function creator() {
9495

9596
function onDetach(drawLayer,action) {
9697
var {plotIdAry}= action.payload;
97-
plotIdAry.forEach( (plotId) => dispatchAttributeChange(plotId,false,PlotAttribute.ACTIVE_DISTANCE,null,true));
98+
plotIdAry.forEach( (plotId) => dispatchAttributeChange({
99+
plotId,overlayColorScope:false,
100+
attKey:PlotAttribute.ACTIVE_DISTANCE,attValue:null
101+
}));
98102
}
99103

100104
function getCursor(plotView, screenPt) {
@@ -321,7 +325,7 @@ function makeSelectObj(firstPt,currentPt, posAngle,cc) {
321325
var anyPt1;
322326
var anyPt2;
323327
var dist;
324-
var world= cc.projection.isSpecified() && cc.projection.isImplemented();
328+
const world= hasWCSProjection(cc);
325329

326330
if (world) {
327331
anyPt1 = cc.getWorldCoords(ptAry[0]);

src/firefly/js/drawingLayers/HiPSGrid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
1616
import {makeImagePt} from '../visualize/Point.js';
1717
import CysConverter from '../visualize/CsysConverter';
1818
import {getUIComponent} from './HiPSGridlUI.jsx';
19-
import {getAllPlotViewId} from '../visualize/PlotViewUtil';
19+
import {getAllPlotViewIdByOverlayLock} from '../visualize/PlotViewUtil';
2020
import {clone} from '../util/WebUtil.js';
2121

2222
const ID= 'HIPS_GRID';
@@ -93,7 +93,7 @@ function dealWithMods(drawLayer,action) {
9393

9494
function computeDrawData(drawLayer,action, gridType, gridLockLevel, isVisible = false) {
9595
const {payload}= action;
96-
const plotIdAry= payload.plotId ? getAllPlotViewId(visRoot(), payload.plotId, false, true) : payload.plotIdAry;
96+
const plotIdAry= payload.plotId ? getAllPlotViewIdByOverlayLock(visRoot(), payload.plotId, false, true) : payload.plotIdAry;
9797
if (plotIdAry) {
9898
const drawData= {data: clone(drawLayer.drawData.data)};
9999

src/firefly/js/drawingLayers/HiPSMOC.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Enum from 'enum';
66
import {makeDrawingDef, TextLocation, Style} from '../visualize/draw/DrawingDef.js';
77
import DrawLayer, {DataTypes, ColorChangeType} from '../visualize/draw/DrawLayer.js';
88
import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
9-
import {primePlot, getDrawLayerById, getPlotViewIdListInGroup} from '../visualize/PlotViewUtil.js';
9+
import {primePlot, getDrawLayerById, getPlotViewIdList} from '../visualize/PlotViewUtil.js';
1010
import {visRoot} from '../visualize/ImagePlotCntlr.js';
1111
import DrawLayerCntlr, {DRAWING_LAYER_KEY, dispatchUpdateDrawLayer} from '../visualize/DrawLayerCntlr.js';
1212
import {get, set, isEmpty, cloneDeep, isString} from 'lodash';
@@ -406,7 +406,7 @@ function asyncComputeDrawData(drawLayer, action) {
406406
pIdAry = plotIdAry;
407407
} else if (action.type === ImagePlotCntlr.CHANGE_CENTER_OF_PROJECTION ) {
408408
if (plotId) {
409-
pIdAry = getPlotViewIdListInGroup(visRoot(), plotId);
409+
pIdAry = getPlotViewIdList(visRoot(), plotId);
410410
}
411411
} else if (plotId) {
412412
pIdAry = [plotId];

src/firefly/js/drawingLayers/MarkerTool.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {clone} from '../util/WebUtil.js';
2222
import ImagePlotCntlr from '../visualize/ImagePlotCntlr.js';
2323
import {get, set, has, isArray, isEmpty} from 'lodash';
2424
import Enum from 'enum';
25+
import {hasWCSProjection} from '../visualize/PlotViewUtil';
2526

2627
const editHelpText='Click the marker and drag to move, click corner and drag to resize';
2728

@@ -839,5 +840,5 @@ function ratioSize(oldSize, newSize, cc, toSize) {
839840
}
840841

841842
export function hasNoProjection(cc) {
842-
return !cc.projection.isSpecified()||!cc.projection.isImplemented();
843+
return !hasWCSProjection(cc);
843844
}

src/firefly/js/drawingLayers/NorthUpCompass.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {getPixScaleDeg} from '../visualize/WebPlot.js';
1818
import DrawLayerCntlr, { dispatchForceDrawLayerUpdate} from '../visualize/DrawLayerCntlr.js';
1919
import Color from '../util/Color.js';
2020
import {CoordinateSys} from '../visualize/CoordSys.js';
21+
import {hasWCSProjection} from '../visualize/PlotViewUtil';
2122

2223
const ID= 'NORTH_UP_COMPASS_TOOL';
2324
const TYPE_ID= 'NORTH_UP_COMPASS_TYPE';
@@ -108,7 +109,7 @@ function getDrawData(dataType, plotId, drawLayer, action, lastDataRet){
108109
function makeCompass(plotId, action){
109110
const plot= primePlot(visRoot(),plotId);
110111
if (!plot) return null;
111-
if (!plot.projection.isImplemented()) return null;
112+
if (!hasWCSProjection(plot)) return null;
112113

113114
const cc= CsysConverter.make(plot);
114115
if (!cc) return null;

src/firefly/js/drawingLayers/PointSelection.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,22 @@ export default {factoryDef, TYPE_ID}; // every draw layer must default export wi
3030
var idCnt=0;
3131

3232
function dispatchSelectPoint(mouseStatePayload) {
33-
var {plotId,screenPt,drawLayer}= mouseStatePayload;
33+
const {plotId,screenPt,drawLayer}= mouseStatePayload;
3434
if (drawLayer.drawData.data) {
3535
flux.process({type:DrawLayerCntlr.SELECT_POINT, payload:mouseStatePayload} );
36-
dispatchAttributeChange(plotId,true,PlotAttribute.ACTIVE_POINT,{pt:makeSelectedPt(screenPt,plotId)},true);
36+
dispatchAttributeChange(
37+
{plotId,
38+
attKey:PlotAttribute.ACTIVE_POINT,attValue:{pt:makeSelectedPt(screenPt,plotId)}
39+
});
3740
}
3841
}
3942

4043

4144
function onDetach(drawLayer,action) {
42-
var {plotIdAry}= action.payload;
43-
plotIdAry.forEach( (plotId) => dispatchAttributeChange(plotId,false,PlotAttribute.ACTIVE_POINT,null,true));
45+
const {plotIdAry}= action.payload;
46+
plotIdAry.forEach( (plotId) => dispatchAttributeChange(
47+
{ plotId ,overlayColorScope:false,attKey:PlotAttribute.ACTIVE_POINT,attValue:null }
48+
));
4449
}
4550

4651

src/firefly/js/drawingLayers/SelectArea.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ export function selectAreaEndActionCreator(rawAction) {
5858
if (drawLayer.drawData.data) {
5959
const selectBox= drawLayer.drawData.data.find( (drawObj) => drawObj.type===SelectBox.SELECT_BOX);
6060
const sel= {pt0:selectBox.pt1,pt1:selectBox.pt2};
61-
dispatchAttributeChange(plotId,true,PlotAttribute.SELECTION,sel,true);
61+
dispatchAttributeChange({plotId,attKey:PlotAttribute.SELECTION,attValue:sel});
6262
// const imBoundSel= pv.rotation ? getImageBoundsSelection(sel,CsysConverter.make(plot)) : sel;
6363
const imBoundSel= getImageBoundsSelection(sel,CsysConverter.make(plot), drawLayer.selectedShape,
6464
pv.rotation);
65-
dispatchAttributeChange(plotId,true,PlotAttribute.IMAGE_BOUNDS_SELECTION, imBoundSel,true);
65+
dispatchAttributeChange({plotId,attKey:PlotAttribute.IMAGE_BOUNDS_SELECTION, attValue:imBoundSel});
6666
}
6767
};
6868
}
@@ -108,8 +108,8 @@ function creator(initPayload) {
108108
function onDetach(drawLayer,action) {
109109
const {plotIdAry}= action.payload;
110110
plotIdAry.forEach( (plotId) => {
111-
dispatchAttributeChange(plotId, false, PlotAttribute.SELECTION, null, true);
112-
dispatchAttributeChange(plotId,false,PlotAttribute.IMAGE_BOUNDS_SELECTION,null,true);
111+
dispatchAttributeChange({plotId, overlayColorScope:false, attKey:PlotAttribute.SELECTION, attValue:null});
112+
dispatchAttributeChange({plotId,overlayColorScope:false,attKey:PlotAttribute.IMAGE_BOUNDS_SELECTION,attValue:null});
113113
});
114114
}
115115

src/firefly/js/ui/CatalogSearchMethodType.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {visRoot} from '../visualize/ImagePlotCntlr.js';
3030
import {getValueInScreenPixel} from '../visualize/draw/ShapeDataObj.js';
3131

3232
import './CatalogSearchMethodType.css';
33+
import {hasWCSProjection} from '../visualize/PlotViewUtil';
3334

3435
/*
3536
Component which suppose to handle the catalog method search such as cone, elliptical,etc.
@@ -156,7 +157,7 @@ const spatialSelection = (withPos, polyIsDef, searchOption) => {
156157
const maxHipsRadiusSearch = 5; //degrees
157158

158159
export function calcCornerString(pv, method) {
159-
if (method==='clear' || !pv) return '';
160+
if (method==='clear' || !pv || !hasWCSProjection(pv)) return '';
160161
const f5 = (v) => v.toFixed(5);
161162

162163
var pt1, pt2, pt3, pt4;

src/firefly/js/ui/ToolbarButton.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,9 @@
112112
.ff-vertical-separator {
113113
height: 4px;
114114
}
115+
116+
.ff-vertical-line-separator {
117+
height: 0;
118+
margin: 3px 0 3px 0;
119+
border-bottom: 1px solid rgba(0,0,0,.4);
120+
}

src/firefly/js/ui/ToolbarButton.jsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {dispatchHideDialog} from '../core/ComponentCntlr.js';
1010
import {DROP_DOWN_KEY} from './DropDownToolbarButton.jsx';
1111
import {ToolTipCtx} from '../visualize/ui/VisToolbar.jsx';
1212
import DROP_DOWN_ICON from 'html/images/dd-narrow.png';
13+
import CHECK_BOX from 'html/images/black_check-on_10x10.gif';
1314

1415

1516
export function makeBadge(cnt) {
@@ -103,15 +104,16 @@ export class ToolbarButton extends PureComponent {
103104
icon,text,tip,badgeCount=0,enabled=true,
104105
horizontal=true, bgDark, visible=true, active,
105106
imageStyle, lastTextItem=false, todo, additionalStyle,
106-
hasHorizontalLayoutSep, useDropDownIndicator} = this.props;
107+
hasHorizontalLayoutSep, useDropDownIndicator,
108+
hasCheckBox=false, checkBoxOn=false } = this.props;
107109

108110

109111
var s= { position: 'relative'};
110112
if (horizontal) {
111-
s.display='inline-block';
113+
s.display='inline-flex';
112114
}
113115
else {
114-
s.display= 'block';
116+
s.display= 'flex';
115117
}
116118

117119
var textCName= 'menuItemText';
@@ -168,10 +170,19 @@ export class ToolbarButton extends PureComponent {
168170
);
169171
} else {
170172
s.flex= '0 0 auto';
173+
let cb= '';
174+
if (hasCheckBox) {
175+
cb= ( checkBoxOn ?
176+
<img style={{width: 10, height: 10, paddingRight: 4, alignSelf: 'center', ...imageStyle}}
177+
src={CHECK_BOX}/> :
178+
<span style={{width:14}}/>
179+
);
180+
}
171181
return (
172182
<div title={tip} style={s} className={cName}
173183
ref={this.setupRef}
174184
onClick={this.click} onMouseOver={this.mouseOver} onMouseOut={this.mouseOut}>
185+
{hasCheckBox && cb}
175186
{icon ? <img style={imageStyle} src={icon}/> : <div className={textCName}>{text}</div>}
176187
{badgeCount ? makeBadge(badgeCount) : ''}
177188
{todo?<div style={todoStyle}>ToDo</div> : false}
@@ -204,7 +215,9 @@ ToolbarButton.propTypes= {
204215
imageStyle : PropTypes.object,
205216
lastTextItem : PropTypes.bool,
206217
useDropDownIndicator: PropTypes.bool,
207-
additionalStyle : PropTypes.object
218+
additionalStyle : PropTypes.object,
219+
hasCheckBox: PropTypes.bool,
220+
checkBoxOn: PropTypes.bool,
208221
};
209222

210223
ToolbarButton.DefaultProps= {
@@ -235,9 +248,11 @@ ToolbarHorizontalSeparator.propTypes= {
235248

236249

237250

238-
export function DropDownVerticalSeparator() {
239-
return <div className='ff-vertical-separator'/>;
251+
export function DropDownVerticalSeparator({useLine=false}) {
252+
return <div className={useLine? 'ff-vertical-line-separator' : 'ff-vertical-separator'}/>;
240253
}
241254

242-
255+
DropDownVerticalSeparator.propTypes= {
256+
useLine: PropTypes.bool
257+
};
243258

src/firefly/js/visualize/DrawLayerCntlr.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import {flux} from '../Firefly.js';
66
import Enum from 'enum';
7-
import {getPlotViewIdListInGroup, getPlotViewById, getDrawLayerById,
8-
getConnectedPlotsIds, getAllPlotViewId} from './PlotViewUtil.js';
7+
import {getPlotViewIdList, getPlotViewById, getDrawLayerById,
8+
getConnectedPlotsIds, getAllPlotViewIdByOverlayLock} from './PlotViewUtil.js';
99
import ImagePlotCntlr, {visRoot} from './ImagePlotCntlr.js';
1010
import DrawLayerReducer from './reducer/DrawLayerReducer.js';
1111
import {flatten, uniqBy, without,union,isEmpty} from 'lodash';
@@ -230,7 +230,7 @@ export function dispatchCreateDrawLayer(drawLayerTypeId, params={}) {
230230
* @function dispatchChangeVisibility
231231
*/
232232
export function dispatchChangeVisibility({id,visible, plotId, useGroup= true, subGroupId, matchTitle= false}) {
233-
let plotIdAry= useGroup ? getPlotViewIdListInGroup(visRoot(), plotId) : [plotId];
233+
let plotIdAry= useGroup ? getPlotViewIdList(visRoot(), plotId) : [plotId];
234234
if (subGroupId) {
235235
const vr= visRoot();
236236
plotIdAry= plotIdAry.filter( (plotId) => {
@@ -258,7 +258,7 @@ export function dispatchChangeVisibility({id,visible, plotId, useGroup= true, su
258258
* @function dispatchChangeDrawingDef
259259
*/
260260
export function dispatchChangeDrawingDef(id,drawingDef, plotId, matchTitle= false) {
261-
const plotIdAry= getPlotViewIdListInGroup(visRoot(), plotId);
261+
const plotIdAry= getPlotViewIdList(visRoot(), plotId);
262262

263263
getDrawLayerIdAry(dlRoot(),id, matchTitle)
264264
.forEach( (drawLayerId) => {
@@ -278,7 +278,7 @@ export function dispatchChangeDrawingDef(id,drawingDef, plotId, matchTitle= fals
278278
*/
279279
export function dispatchModifyCustomField(id,changes, plotId) {
280280

281-
const plotIdAry= getPlotViewIdListInGroup(visRoot(), plotId);
281+
const plotIdAry= getPlotViewIdList(visRoot(), plotId);
282282

283283
getDrawLayerIdAry(dlRoot(),id)
284284
.forEach( (drawLayerId) => {
@@ -304,7 +304,7 @@ export function dispatchUpdateDrawLayer(drawLayer) {
304304
*/
305305
export function dispatchForceDrawLayerUpdate(id,plotId) {
306306

307-
const plotIdAry= getPlotViewIdListInGroup(visRoot(), plotId);
307+
const plotIdAry= getPlotViewIdList(visRoot(), plotId);
308308

309309
getDrawLayerIdAry(dlRoot(),id)
310310
.forEach( (drawLayerId) => {
@@ -357,7 +357,7 @@ export function dispatchAttachLayerToPlot(id,plotId, attachAllPlot=false, visib
357357
plotIdAry= plotId;
358358
}
359359
else {
360-
plotIdAry = attachAllPlot ? getAllPlotViewId(visRoot(), plotId, false, plotTypeMustMatch) : [plotId];
360+
plotIdAry = attachAllPlot ? getAllPlotViewIdByOverlayLock(visRoot(), plotId, false, plotTypeMustMatch) : [plotId];
361361
}
362362

363363
getDrawLayerIdAry(dlRoot(),id)
@@ -384,7 +384,7 @@ export function dispatchDetachLayerFromPlot(id,plotId, detachAllPlot=false, dest
384384
plotIdAry= plotId;
385385
}
386386
else {
387-
plotIdAry= detachAllPlot ? getAllPlotViewId(visRoot(), plotId) : [plotId];
387+
plotIdAry= detachAllPlot ? getAllPlotViewIdByOverlayLock(visRoot(), plotId) : [plotId];
388388
}
389389

390390
getDrawLayerIdAry(dlRoot(),id)

0 commit comments

Comments
 (0)