Skip to content

Commit 3256e95

Browse files
committed
Firefly-88: update, fixes, responds to feedback:
- Markers are wrong, sometimes an image marker show when it should not. - Catalog marker should be the new POINT_MARKER, it is currently circle - When you replace the coverage plot the settings are being lost with the new plot - The cut off text in image layer title, sizes correctly now. - clipboard target to j2000 - change center mouse over tool tip to ‘Center on this position’ - plot with search center mark hide/show to checkbox - don’t bold search object, use parents instead of by - make catalog center check box hide/show checkbox
1 parent 78adc7d commit 3256e95

19 files changed

+98
-51
lines changed
743 Bytes
Loading

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import edu.caltech.ipac.firefly.server.query.SearchManager;
1515
import edu.caltech.ipac.firefly.server.query.SearchProcessor;
1616
import edu.caltech.ipac.firefly.server.query.SearchProcessorImpl;
17-
import edu.caltech.ipac.firefly.server.query.UserCatalogQuery;
1817
import edu.caltech.ipac.firefly.server.util.QueryUtil;
1918
import edu.caltech.ipac.firefly.server.ws.WsServerUtils;
2019
import edu.caltech.ipac.firefly.visualize.WebPlotRequest;
@@ -35,6 +34,7 @@
3534
import java.net.MalformedURLException;
3635
import java.net.URL;
3736
import java.util.List;
37+
import java.util.Map;
3838

3939
import static edu.caltech.ipac.firefly.data.TableServerRequest.TBL_INDEX;
4040
import static edu.caltech.ipac.firefly.server.query.tables.IpacTableFromSource.PROC_ID;
@@ -157,7 +157,10 @@ private File getSourceFile(String source, TableServerRequest request, boolean ch
157157
public void prepareTableMeta(TableMeta defaults, List<DataType> columns, ServerRequest request) {
158158
String type = request.getParam(TBL_TYPE);
159159
if (type == null || type.equals(TYPE_CATALOG)) {
160-
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
160+
Map reqMeta= ((TableServerRequest) request).getMeta();
161+
if (reqMeta==null || !reqMeta.containsKey(MetaConst.CATALOG_OVERLAY_TYPE)) {
162+
defaults.setAttribute(MetaConst.CATALOG_OVERLAY_TYPE, "TRUE");
163+
}
161164
}
162165
}
163166

src/firefly/js/api/ApiBuild.js

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

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

5860

5961
/**
@@ -129,7 +131,7 @@ export function initApi() {
129131
dispatchOnAppReady(() => {
130132
window.onFireflyLoaded && window.onFireflyLoaded(firefly);
131133
});
132-
startTTFeatureWatchers();
134+
startTTFeatureWatchers([urlLinkWatcherDef.id, activeRowCenterDef.id]);
133135
initExpandedView();
134136
}
135137

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/drawingLayers/Catalog.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import SelectArea, {SelectedShape} from './SelectArea.js';
3232
import {detachSelectArea} from '../visualize/ui/SelectAreaDropDownView.jsx';
3333
import {CysConverter} from '../visualize/CsysConverter.js';
3434
import {parseObsCoreRegion} from '../util/ObsCoreSRegionParser.js';
35+
import {brighter, darker} from '../util/Color';
36+
import {isDefined} from '../util/WebUtil';
3537

3638

3739
const TYPE_ID= 'CATALOG_TYPE';
@@ -58,7 +60,7 @@ function creator(initPayload, presetDefaults={}) {
5860
symbol, size, tblId,
5961
dataTooBigForSelection=false, catalog=true,
6062
dataType=CatalogType.X.key, tableSelection, isFromRegion=false,
61-
searchTarget, searchTargetSymbol= DrawSymbol.CIRCLE,
63+
searchTarget, searchTargetSymbol= DrawSymbol.POINT_MARKER,
6264
}= initPayload;
6365

6466
const drawingDef= {...makeDrawingDef(),
@@ -72,9 +74,9 @@ function creator(initPayload, presetDefaults={}) {
7274

7375

7476
const searchTargetDrawingDef= {...makeDrawingDef(),
75-
size: drawingDef.size,
77+
size: 10,
7678
symbol: searchTargetSymbol,
77-
color: drawingDef.color
79+
color: darker(drawingDef.color)
7880
};
7981

8082
const helpText= `Click on ${(dataType == CatalogType.REGION.key) ? 'region' : 'point'} to highlight`;
@@ -112,6 +114,7 @@ function creator(initPayload, presetDefaults={}) {
112114
isFromRegion,
113115
tblId: tblId ? tblId : catalogId,
114116
searchTarget,
117+
searchTargetVisible: true,
115118
searchTargetDrawingDef,
116119
};
117120
}
@@ -200,6 +203,7 @@ function getLayerChanges(drawLayer, action) {
200203
dd[DataTypes.HIGHLIGHT_DATA]= null;
201204

202205
if (changes.tableData || changes.selectOption || changes.searchTargetDrawingDef ||
206+
isDefined(changes.searchTargetVisible) ||
203207
(changes.selectInfo && selectOption === TableSelectOptions.selected.key)) {
204208
dd[DataTypes.DATA]= null;
205209
}
@@ -276,7 +280,7 @@ function toAngle(d, radianToDegree) {
276280
}
277281

278282
function computeSearchTarget(drawLayer) {
279-
if (!drawLayer.searchTarget) return;
283+
if (!drawLayer.searchTarget || !drawLayer.searchTargetVisible) return;
280284
const {searchTargetDrawingDef:{symbol,size,color}}= drawLayer;
281285
const tSym= PointDataObj.make(drawLayer.searchTarget, size, symbol);
282286
tSym.color= color;

src/firefly/js/drawingLayers/CatalogUI.jsx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,32 @@
22
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
33
*/
44

5-
import React from 'react';
5+
import React, {useState} from 'react';
66
import PropTypes from 'prop-types';
77
import Enum from 'enum';
8-
import {DrawSymbol} from '../visualize/draw/PointDataObj.js';
98
import {isEmpty, startCase} from 'lodash';
109
import {RadioGroupInputFieldView} from '../ui/RadioGroupInputFieldView.jsx';
1110
import {dispatchModifyCustomField, dispatchChangeVisibility} from '../visualize/DrawLayerCntlr.js';
1211
import {isDrawLayerVisible} from '../visualize/PlotViewUtil.js';
13-
import {GroupingScope} from '../visualize/DrawLayerCntlr.js';
1412
import {DataTypes} from '../visualize/draw/DrawLayer.js';
1513
import {showInfoPopup, INFO_POPUP} from '../ui/PopupUtil.jsx';
14+
import {dispatchRecenter} from '../visualize/ImagePlotCntlr';
15+
import {GroupingScope} from '../visualize/DrawLayerCntlr.js';
1616
import {isDialogVisible, dispatchHideDialog} from '../core/ComponentCntlr.js';
17-
import EXCLAMATION from 'html/images/exclamation16x16.gif';
18-
import infoIcon from 'html/images/info-icon.png';
1917
import {formatLonLatToString, formatWorldPt, formatWorldPtToString} from '../visualize/ui/WorldPtFormat';
2018
import {copyToClipboard} from '../util/WebUtil';
2119
import {ToolbarButton} from '../ui/ToolbarButton';
2220
import {makeColorChange, makeShape} from '../visualize/ui/DrawLayerUIComponents';
2321
import {showColorPickerDialog} from '../ui/ColorPicker';
2422
import {showPointShapeSizePickerDialog} from '../ui/PointShapeSizePicker';
2523

24+
import infoIcon from 'html/images/info-icon.png';
25+
import EXCLAMATION from 'html/images/exclamation16x16.gif';
2626
import CLIPBOARD from 'html/images/20x20_clipboard.png';
27+
import CHECKED from 'html/images/20x20_clipboard-checked.png';
2728
import CENTER from 'html/images/20x20-center-small.png';
28-
import {dispatchRecenter} from '../visualize/ImagePlotCntlr';
29+
import {convert} from '../visualize/VisUtil';
30+
import CoordinateSys from '../visualize/CoordSys';
2931

3032
export const TableSelectOptions = new Enum(['all', 'selected', 'highlighted']);
3133
export const getUIComponent = (drawLayer,pv,maxTitleChars) =>
@@ -203,8 +205,13 @@ function SearchTargetUI({drawLayer:dl, PlotView:pv}) {
203205
<div style={{display: 'flex', justifyContent: 'space-between', alignItems:'center'}}>
204206
<div style={{display: 'flex', alignItems: 'center'}}>
205207
<span style={{paddingRight: 5}} >Search: </span>
206-
<div> {formatWorldPt(wp,0,true)} </div>
208+
<div> {formatWorldPt(wp,3,false)} </div>
207209
<FixedPtControl pv={pv} wp={wp} />
210+
<input type='checkbox'
211+
checked={dl.searchTargetVisible}
212+
onChange={() => dispatchModifyCustomField( dl.displayGroupId,
213+
{searchTargetVisible:!dl.searchTargetVisible}, pv.plotId )}
214+
/>
208215
</div>
209216
<div style={{paddingRight: 68}}>
210217
{makeColorChange(drawingDef.color, modifyColor, {paddingRight: 14})}
@@ -223,13 +230,24 @@ CatalogUI.propTypes= {
223230

224231

225232
export function FixedPtControl({pv, wp, style={}}) {
226-
const llStr= formatLonLatToString(wp);
233+
const llStr= formatLonLatToString(convert(wp, CoordinateSys.EQ_J2000));
234+
const [clipIcon, setClipIcon] = useState(CLIPBOARD);
235+
236+
const doCopy= (str) => {
237+
copyToClipboard(str);
238+
setTimeout( () => {
239+
setClipIcon(CHECKED);
240+
setTimeout( () => setClipIcon(CLIPBOARD),750);
241+
}, 10);
242+
243+
};
244+
227245
return (
228246
<div style={style}>
229-
<ToolbarButton icon={CLIPBOARD} tip={`Copy to the clipboard: ${llStr}`}
230-
horizontal={true} onClick={() => copyToClipboard(llStr)} />
247+
<ToolbarButton icon={clipIcon} tip={`Copy to the clipboard: ${llStr}`}
248+
horizontal={true} onClick={() => doCopy(llStr)} />
231249

232-
<ToolbarButton icon={CENTER} tip={`Center on on ${formatWorldPtToString(wp)}`}
250+
<ToolbarButton icon={CENTER} tip={'Center on this position'}
233251
horizontal={true}
234252
onClick={() => dispatchRecenter({plotId:pv.plotId, centerPt:wp}) } />
235253

src/firefly/js/drawingLayers/FixedMarker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function getDrawData(dataType, plotId, drawLayer, action, lastDataRet) {
5050
function getTitle(wp) {
5151
return (
5252
<div style={{display:'inline-flex', alignItems:'center', width: 100}} title={formatWorldPtToString(wp)}>
53-
{formatWorldPt(wp,5,true)}
53+
{formatWorldPt(wp,5,false)}
5454
{<FixedPtControl wp={wp} pv={getActivePlotView(visRoot())} style={{paddingLeft:7}}/>}
5555
</div>
5656
);

src/firefly/js/drawingLayers/ImageRoot.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ function getTitle(pv, plot, drawLayer) {
9292
if (!plot) return '';
9393
const {request:r}= pv;
9494
const showSize= Boolean(r.getSizeInDeg() && isImage(plot) );
95-
const minWidth= showSize || !drawLayer.isPointData ? '18em' : '10em';
95+
const titleEmLen= Math.min(plot.title.length+2,24);
96+
const minWidth= showSize || !drawLayer.isPointData ? (titleEmLen+6)+'em' : titleEmLen+'em';
9697
return (
9798
<div style={{
9899
display: 'inline-flex',
@@ -117,8 +118,9 @@ function getTitle(pv, plot, drawLayer) {
117118
function computeDrawData(drawLayer) {
118119
const {plotId}= drawLayer;
119120
if (!plotId) return null;
121+
const pv= getPlotViewById(visRoot(),plotId);
120122
const plot= primePlot(visRoot(),plotId);
121-
if (!plot || !drawLayer.searchTargetVisible) return [];
123+
if (!plot || !drawLayer.searchTargetVisible || !pv.plotViewCtx.displayFixedTarget) return [];
122124
const wp= plot.attributes[PlotAttribute.FIXED_TARGET];
123125
return wp ? [PointDataObj.make(wp)] : [];
124126
}

src/firefly/js/drawingLayers/ImageRootUI.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const options= [
2222

2323

2424
function changeSearchTargetVisibility(drawLayer,pv,value) {
25-
dispatchModifyCustomField(drawLayer.drawLayerId, {searchTargetVisible:value==='show'}, pv.plotId);
25+
// dispatchModifyCustomField(drawLayer.drawLayerId, {searchTargetVisible:value==='show'}, pv.plotId);
26+
dispatchModifyCustomField(drawLayer.drawLayerId, {searchTargetVisible:value}, pv.plotId);
2627
}
2728

2829

@@ -37,12 +38,10 @@ function ImageRootUI({drawLayer:dl, pv}) {
3738
<div style={{display: 'flex', justifyContent: 'space-between', alignItems:'center'}}>
3839
<div style={{display: 'flex', alignItems: 'center'}}>
3940
<span style={{paddingRight: 5}} >Search: </span>
40-
<div> {formatWorldPt(wp,0,true)} </div>
41+
<div> {formatWorldPt(wp,3,false)} </div>
4142
<FixedPtControl pv={pv} wp={wp} />
42-
<RadioGroupInputFieldView wrapperStyle={{paddingLeft:5}}
43-
options={options} value={dl.searchTargetVisible?'show':'hide'}
44-
buttonGroup={true}
45-
onChange={(ev) => changeSearchTargetVisibility(dl,pv,ev.target.value)} />
43+
<input type='checkbox' checked={dl.searchTargetVisible}
44+
onChange={() => changeSearchTargetVisibility(dl,pv,!dl.searchTargetVisible)} />
4645
</div>
4746
</div>
4847
);

src/firefly/js/ui/PopupPanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class PopupPanel extends PureComponent {
161161
onClick={this.askParentToClose} />
162162

163163
</div>
164-
<div style={{display:'table'}}>
164+
<div style={{display:'flex'}}>
165165
{this.props.children}
166166
</div>
167167
</div>

src/firefly/js/util/Color.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function min255(v) {return Math.min(Math.trunc(v), 255);}
5050
function max0(v) {return Math.max(Math.trunc(v), 0);}
5151

5252

53-
function brighter(colorStr,factor= .7) {
53+
export function brighter(colorStr,factor= .7) {
5454
var rgb= toRGB(colorStr);
5555
var r = rgb[0];
5656
var g = rgb[1];
@@ -68,7 +68,7 @@ function brighter(colorStr,factor= .7) {
6868
if ( g > 0 && g < i ) g = i;
6969
if ( b > 0 && b < i ) b = i;
7070

71-
return toHex(min255(r/factor), min255(g/factor), min255(b/factor) ); }
71+
return '#'+toHex(min255(r/factor), min255(g/factor), min255(b/factor) ); }
7272

7373
/**
7474
* Creates a new <code>Color</code> that is a darker version of this
@@ -86,12 +86,12 @@ function brighter(colorStr,factor= .7) {
8686
* a darker version of this <code>Color</code>.
8787
* @since JDK1.0
8888
*/
89-
function darker(colorStr, factor=.7) {
89+
export function darker(colorStr, factor=.7) {
9090
var rgb= toRGB(colorStr);
9191
var r = rgb[0];
9292
var g = rgb[1];
9393
var b = rgb[2];
94-
return toHex(max0(r *factor), max0(g *factor), max0(b *factor));
94+
return '#'+toHex(max0(r *factor), max0(g *factor), max0(b *factor));
9595
}
9696

9797

src/firefly/js/visualize/saga/ActiveRowCenterWatcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {getActivePlotView, getCenterOfProjection, getFoV, hasWCSProjection, prim
1212
import {computeDistance, toDegrees} from '../VisUtil';
1313
import {CysConverter} from '../CsysConverter';
1414
import {dispatchUseTableAutoScroll} from '../ImagePlotCntlr';
15-
import {dispatchAddTableTypeWatcherDef} from '../../core/MasterSaga';
1615

1716

1817

@@ -25,6 +24,7 @@ export const activeRowCenterDef = {
2524
testTable : (table) => {
2625
return Boolean(findTableCenterColumns(table));
2726
},
27+
allowMultiples: false,
2828
actions: [TABLE_LOADED, TABLE_SELECT, TABLE_HIGHLIGHT, TABLE_UPDATE, TBL_RESULTS_ACTIVE, TABLE_REMOVE]
2929
};
3030

src/firefly/js/visualize/saga/CatalogWatcher.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import {makeWorldPt} from '../Point';
2323
import {CoordinateSys} from '../CoordSys.js';
2424

2525

26-
/** type {TableWatcherDef} */
26+
/** @type {TableWatcherDef} */
2727
export const catalogWatcherDef = {
2828
id : 'CatalogWatcher',
2929
watcher : watchCatalogs,
3030
testTable : (table) => !isLsstFootprintTable(table) && isCatalog(table),
31+
allowMultiples: false,
3132
actions: [TABLE_LOADED, TABLE_SELECT, TABLE_HIGHLIGHT, TABLE_UPDATE, TBL_RESULTS_ACTIVE,
3233
TABLE_REMOVE, ImagePlotCntlr.PLOT_IMAGE, ImagePlotCntlr.PLOT_HIPS]
3334
};
@@ -193,7 +194,8 @@ function attachToCatalog(tbl_id, payload) {
193194
}
194195

195196

196-
export function getSearchTarget(r) {
197+
export function getSearchTarget(r, searchTargetStr) {
198+
if (searchTargetStr) return parseWorldPt(searchTargetStr);
197199
if (r.UserTargetWorldPt) return parseWorldPt(r.UserTargetWorldPt);
198200
if (!r.QUERY) return;
199201
const regEx= /CIRCLE\s?\(.*\)/;

src/firefly/js/visualize/saga/CoverageWatcher.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export const coverageWatcherDef = {
113113
testTable : (table) => hasCoverageData(table),
114114
sharedData: { preparedTables: {}, tblCatIdMap: {}},
115115
watcher : watchCoverage,
116+
allowMultiples: false,
116117
actions: [TABLE_LOADED, TABLE_SELECT,TABLE_HIGHLIGHT, TABLE_REMOVE, TBL_RESULTS_ACTIVE,
117118
ImagePlotCntlr.PLOT_IMAGE, ImagePlotCntlr.PLOT_HIPS,
118119
MultiViewCntlr.ADD_VIEWER, MultiViewCntlr.VIEWER_MOUNTED, MultiViewCntlr.VIEWER_UNMOUNTED]
@@ -484,7 +485,7 @@ function addToCoverageDrawing(plotId, options, table, allRowsTable, drawOp) {
484485
const dl = getDlAry().find((dl) => dl.drawLayerTypeId === Catalog.TYPE_ID && dl.catalogId === cId);
485486
if (!dl) {
486487
const {showCatalogSearchTarget}= getAppOptions();
487-
const searchTarget= showCatalogSearchTarget ? getSearchTarget(table.request) : undefined;
488+
const searchTarget= showCatalogSearchTarget ? getSearchTarget(table.request, lookupOption(options, 'searchTarget', cId)) : undefined;
488489
dispatchCreateDrawLayer(Catalog.TYPE_ID, {
489490
catalogId: cId,
490491
tblId: table.tbl_id,

0 commit comments

Comments
 (0)