Skip to content

DM-8310: search Target match #252

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 2 commits into from
Dec 16, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
77 changes: 77 additions & 0 deletions src/firefly/html/demo/ffapi-highlevel-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@
<div>
<a href='../../firefly/;a=ImagePlotCntlr.PlotImage?wpRequest={%20%22File%22:%20%22http://ned.ipac.caltech.edu/img/1988MNRAS.230..345N/ARP_220:I:6cm:n1988.fits.gz%22,%20%22URL%22:%20%22http://ned.ipac.caltech.edu/img/1988MNRAS.230..345N/ARP_220:I:6cm:n1988.fits.gz%22,%20%22RangeValues%22:%20%2292,-2,92,8,1,0,1,2,44,25,600,120%22,%20%22PostTitle%22:%20%22ARP%20220%22,%20%22TitleFilenameModePfx%22:%20%22cutout%22,%20%22ColorTable%22:%201,%20%22TitleOptions%22:%20%22FILE_NAME%22,%20%22Type%22:%20%22TRY_FILE_THEN_URL%22%20}'>Show Fits by URL</a>
</div>
<div>
<a href="javascript:loadMoving()">load Moving Images</a>
</div>
<div>
<a href="javascript:loadMovingTable()">load Moving Table</a>
</div>
<div>
<div id="imageViewHere" style="display: inline-block; width: 550px; height: 550px; margin: 10px;"></div>
<div id="coverageHere" style="display: inline-block; width: 400px; height: 400px; margin: 10px;"></div>
</div>
<!--<div>-->
<!--<div id="movingDiv" style="display: inline-block; width: 400px; height: 400px; margin: 10px;"></div>-->
<!--</div>-->
<div>Tables from API calls:
<a href='javascript:firefly.getViewer().showTable(tblReq3)'>Open a table</a>
<a href='javascript:firefly.getViewer().showTable(tblReq1)'>Open allwise</a>
Expand Down Expand Up @@ -103,6 +112,74 @@
</div>
</div>

<script type="text/javascript">
{
function loadMoving() {
var m49025b_143_2= {
url: 'http://web.ipac.caltech.edu/staff/roby/demo/moving/49025b143-w2-int-1b.fits',
plotId: 'm49025b_143_2',
OverlayPosition : '330.347003;-2.774482;EQ_J2000',
ZoomType : 'TO_WIDTH_HEIGHT',
Title: '49025b143-w2',
plotGroupId : 'movingGroup',
};
var m49273b_134_2= {
url: 'http://web.ipac.caltech.edu/staff/roby/demo/moving/49273b134-w2-int-1b.fits',
plotId: 'm49273b_134_2',
OverlayPosition : '333.539702;-0.779310;EQ_J2000',
ZoomType : 'TO_WIDTH_HEIGHT',
Title: '49273b134-w2',
plotGroupId : 'movingGroup',
};
var m49277b_135_1= {
url: 'http://web.ipac.caltech.edu/staff/roby/demo/moving/49277b135-w1-int-1b.fits',
plotId: 'm49277b_135_1',
OverlayPosition : '333.589054;-0.747251;EQ_J2000',
ZoomType : 'TO_WIDTH_HEIGHT',
Title: '49277b135-w1',
plotGroupId : 'movingGroup',
};
var m49289b_134_2= {
url: 'http://web.ipac.caltech.edu/staff/roby/demo/moving/49289b134-w2-int-1b.fits',
plotId: 'm49289b_134_2',
OverlayPosition : '333.736578;-0.651222;EQ_J2000',
ZoomType : 'TO_WIDTH_HEIGHT',
Title: '49289b134-w2',
plotGroupId : 'movingGroup',
};

// firefly.showImage('movingDiv', m49025b_143_2);
// firefly.showImage('movingDiv', m49273b_134_2);
// firefly.showImage('movingDiv', m49277b_135_1);
// firefly.showImage('movingDiv', m49289b_134_2);

firefly.getViewer().showImage( m49025b_143_2);
firefly.getViewer().showImage( m49273b_134_2);
firefly.getViewer().showImage( m49277b_135_1);
firefly.getViewer().showImage( m49289b_134_2);
}
}
</script>

<script type="text/javascript">
{
function loadMovingTable() {
var req = firefly.util.table.makeFileRequest('A moving object table',
'http://web.ipac.caltech.edu/staff/roby/demo/moving/MOST_results-sample.tbl',null,
{ pageSize: 15,
META_INFO: {
datasetInfoConverterId : 'SimpleMoving',
MovingObjCoordColumns: 'ra_obj;dec_obj;EQ_J2000',
urlColumn : 'image_url'
}
});
firefly.getViewer().showTable( req, {removable: true, showUnits: false, showFilters: true});
}
}
</script>




<script type="text/javascript">
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class MetaConst {

public final static String CATALOG_TARGET_COL_NAME = "CatalogTargetColName";
public final static String CATALOG_COORD_COLS = "CatalogCoordColumns";
public final static String MOVING_COORD_COLS = "MovingObjCoordColumns";
public final static String DATASET_CONVERTER = "datasetInfoConverterId";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private static float computeZoomLevel(ImagePlot plot, ZoomChoice zoomChoice) {
if (retval>zoomChoice.getMaxZoomLevel()) retval=zoomChoice.getMaxZoomLevel();
}
}
else if (zoomChoice.getZoomType()== ZoomType.FULL_SCREEN) {
else if (zoomChoice.getZoomType()== ZoomType.FULL_SCREEN || zoomChoice.getZoomType()== ZoomType.TO_WIDTH_HEIGHT) {
retval= VisUtil.getEstimatedFullZoomFactor(VisUtil.FullType.WIDTH_HEIGHT,width, height,
zoomChoice.getWidth(), zoomChoice.getHeight());
if (zoomChoice.hasMaxZoomLevel()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum ZoomType {
SMART, // use smart zoom - this is deprecated, don't use anymore
FULL_SCREEN, // requires width & height specified
TO_WIDTH, // requires width
TO_WIDTH_HEIGHT, // requires width
TO_HEIGHT, // requires height, not yet implemented
ARCSEC_PER_SCREEN_PIX // arcsec
}
Expand Down
12 changes: 8 additions & 4 deletions src/firefly/js/core/ReduxFlux.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var collapsedLogging= [
ExternalAccessCntlr.EXTENSION_ACTIVATE
];

window.enableFireflyReduxLogging= true;
window.enableFireflyReduxLogging= false;


/**
Expand All @@ -184,7 +184,7 @@ window.enableFireflyReduxLogging= true;
* @param action
* @return {boolean}
*/
function logFilter(getState,action) {
function logFilter(getState,action) {
const {type}= action;
if (!type) return false;
if (type.startsWith('VisMouseCntlr')) return false;
Expand All @@ -195,9 +195,13 @@ function logFilter(getState,action) {
if (type.startsWith('tblstats')) return false;
if (type.startsWith('table_ui')) return false;
if (type.startsWith('app_data')) return false;
return true;
return window.enableFireflyReduxLogging;;
}

// function logFilter(getState,action) {
// return window.enableFireflyReduxLogging;
// }


function collapsedFilter(getState,action) {
return collapsedLogging.includes(action.type);
Expand All @@ -212,7 +216,7 @@ function createRedux() {
// create a rootReducer from all of the registered reducers
const rootReducer = combineReducers(reducers);
const sagaMiddleware = createSagaMiddleware();
const middleWare= applyMiddleware(thunkMiddleware, /*logger,*/ sagaMiddleware);
const middleWare= applyMiddleware(thunkMiddleware, logger, sagaMiddleware); //todo: turn off action logging
const store = createStore(rootReducer, middleWare);
sagaMiddleware.run(masterSaga);
return store;
Expand Down
1 change: 1 addition & 0 deletions src/firefly/js/data/MetaConst.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const MetaConst = {
DATA_PRIMARY : 'DataPrimary',
CATALOG_TARGET_COL_NAME : 'CatalogTargetColName',
CATALOG_COORD_COLS : 'CatalogCoordColumns',
MOVING_COORD_COLS : 'MovingObjCoordColumns',
DATASET_CONVERTER : 'datasetInfoConverterId',
DEFAULT_COLOR : 'DEFAULT_COLOR'
};
62 changes: 58 additions & 4 deletions src/firefly/js/metaConvert/ConverterFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/

/*
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/


import {get, has} from 'lodash';
import {makeWisePlotRequest} from './WiseRequestList.js';
Expand All @@ -15,7 +11,9 @@ import {WebPlotRequest, TitleOptions} from '../visualize/WebPlotRequest.js';
import {ZoomType} from '../visualize/ZoomType.js';
import {Band} from '../visualize/Band';
import {getCellValue} from '../tables/TableUtil.js';
import {makeWorldPt} from '../visualize/Point.js';
import {MetaConst} from '../data/MetaConst.js';
import {CoordinateSys} from '../visualize/CoordSys.js';


const URL= 'URL';
Expand Down Expand Up @@ -72,6 +70,13 @@ export const converters = {
canGrid : true,
maxPlots : 12,
makeRequest : makeRequestForUnknown
},
'SimpleMoving' : {
threeColor : false,
hasRelatedBands : false,
canGrid : true,
maxPlots : 12,
makeRequest : makeRequestSimpleMoving
}
};

Expand Down Expand Up @@ -119,6 +124,40 @@ function makeRequestForUnknown(table, row, includeSingle, includeStandard) {

}

function makeRequestSimpleMoving(table, row, includeSingle, includeStandard) {

const {tableMeta:meta}= table;
const dataSource= meta['DataSource'] || URL;



if (!meta[MetaConst.MOVING_COORD_COLS]) return [];


if (!meta['urlColumn']) return [];

const sAry= meta[MetaConst.MOVING_COORD_COLS].split(';');
if (!sAry || sAry.length!== 3) return [];

const lonCol= sAry[0];
const latCol= sAry[1];
const csys= CoordinateSys.parse(sAry[2]);
const urlCol= meta['urlColumn'];

const retval= {};
if (includeSingle) {
retval.single= makeMovingRequest(table,row,lonCol,latCol,urlCol,csys,'simple-moving-single-'+(row %24));
}

if (includeStandard) {
retval.standard= [makeMovingRequest(table,row,lonCol,latCol,urlCol,csys,'simple-moving-single')];
retval.highlightPlotId= retval.standard[0].getPlotId();
}

return retval;

}


function findAColumn(meta,columns) {
const dsCol= Object.keys(meta).find( (key) => key.toUpperCase()===dataSourceUpper);
Expand All @@ -127,6 +166,21 @@ function findAColumn(meta,columns) {
}


function makeMovingRequest(table, row, lonCol, latCol, urlCol, csys, plotId) {
const lon= Number(getCellValue(table,row,lonCol));
const lat= Number(getCellValue(table,row,latCol));
const url= getCellValue(table,row,urlCol);
const r = WebPlotRequest.makeURLPlotRequest(url, 'Fits Image');
const wp= makeWorldPt(lon,lat,csys);
r.setTitleOptions(TitleOptions.FILE_NAME);
r.setZoomType(ZoomType.TO_WIDTH_HEIGHT);
r.setOverlayPosition(wp);
r.setPlotId(plotId);
return r;

}


function makeRequest(table, dataColumn, dataSource, row) {
if (!dataColumn || !table || !dataSource) return null;

Expand Down
1 change: 1 addition & 0 deletions src/firefly/js/metaConvert/converterUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function isMetaDataTable(tbl_id) {
const tableMeta= get(table, 'tableMeta');
if (!tableMeta) return false;

if (MetaConst.DATASET_CONVERTER) return true;
if (tableMeta[MetaConst.CATALOG_OVERLAY_TYPE] || tableMeta[MetaConst.CATALOG_COORD_COLS]) return false;
const converter= converterFactory(table);
return Boolean(converter);
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/util/SimpleMemCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var SimpleMemCache= {


deleteCache(name) {
cacheContainer[name] = undefined;
Reflect.defineProperty(cacheContainer,name);
},


Expand Down
12 changes: 5 additions & 7 deletions src/firefly/js/visualize/CsysConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import CoordinateSys from './CoordSys.js';
import VisUtil from './VisUtil.js';
import SimpleMemCache from '../util/SimpleMemCache.js';
import {makeRoughGuesser} from './ImageBoundsData.js';
import Point, {makeImageWorkSpacePt, makeViewPortPt, makeImagePt,
makeScreenPt, makeWorldPt, isValidPoint} from './Point.js';
Expand Down Expand Up @@ -54,6 +53,7 @@ export class CysConverter {
this.zoomFactor= plot.zoomFactor;
this.imageCoordSys= plot.imageCoordSys;
this.inPlotRoughGuess= null;
this.conversionCache= plot.conversionCache;
}


Expand All @@ -63,8 +63,8 @@ export class CysConverter {
* @param {ImagePt} imp Image Point
*/
putInConversionCache(wp, imp) {
if (SimpleMemCache.size(this.plotImageId)<MAX_CACHE_ENTRIES) {
SimpleMemCache.set(this.plotImageId, wp.toString(), imp);
if (this.conversionCache.size<MAX_CACHE_ENTRIES) {
this.conversionCache.set(wp.toString(), imp);
}
}

Expand Down Expand Up @@ -291,7 +291,7 @@ export class CysConverter {
var checkedPt= convertToCorrect(wpt);
if (checkedPt.type===Point.W_PT) {
var originalWp= wpt;
retval= SimpleMemCache.get(this.plotImageId, checkedPt.toString() );
retval= this.conversionCache.get(checkedPt.toString() );
if (!retval) {
if (this.imageCoordSys!==wpt.getCoordSys()) {
wpt= VisUtil.convert(wpt,this.imageCoordSys);
Expand Down Expand Up @@ -365,7 +365,7 @@ export class CysConverter {
getViewPortCoordsOptimize(wpt, retPt) {
var success= false;

var imagePt= SimpleMemCache.get(this.plotImageId, wpt.toString);
var imagePt= this.conversionCache.get(wpt.toString());

if (!imagePt) {
const csys= wpt.getCoordSys();
Expand Down Expand Up @@ -666,5 +666,3 @@ export const CCUtil = {

export default CysConverter;



20 changes: 12 additions & 8 deletions src/firefly/js/visualize/ImagePlotCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import {wcsMatchActionCreator} from './task/WcsMatchTask.js';
/** can the 'COLLAPSE', 'GRID', 'SINGLE' */
export const ExpandType= new Enum(['COLLAPSE', 'GRID', 'SINGLE']);

/** can the 'NorthCenOnPt', 'NorthCenOnMoving', 'Standard', 'Off' */
export const WcsMatchType= new Enum(['NorthCenOnPt', 'NorthCenOnMoving', 'StandCenOnPt', 'StandCenOnMoving', 'Standard']);
/** can the 'Standard', 'Target' */
export const WcsMatchType= new Enum(['Standard', 'Target']);



Expand Down Expand Up @@ -395,7 +395,7 @@ export function dispatchStretchChange({plotId, stretchData,
* Enable / Disable WCS Match
* @param {Object} p
* @param {string} p.plotId
* @param {Enum|string} p.matchType one of 'NorthCenOnPt', 'NorthCenOnMoving', 'Standard', 'Off'
* @param {Enum|string} p.matchType one of 'Standard', 'Off'
* @param {Function} p.dispatcher
*/
export function dispatchWcsMatch({plotId, matchType, dispatcher= flux.process} ) {
Expand Down Expand Up @@ -486,15 +486,18 @@ export function dispatchProcessScroll({plotId,scrollPt, disableBoundCheck=false,
* Note - function parameter is a single object
* @param {Object} p
* @param {string} p.plotId
* @param {Point} p.centerPt
* @param {Point} p.centerPt Point to center on
* @param {boolean} p.centerOnImage only used if centerPt is not defined. If true then the centering will be
* the center of the image. If false, then the center point will be the
* FIXED_TARGET attribute, if defined. Otherwise it will be the center of the image.
* @param {Function} [p.dispatcher] only for special dispatching uses such as remote
*
* @public
* @function dispatchRecenter
* @memberof firefly.action
*/
export function dispatchRecenter({plotId, centerPt, dispatcher= flux.process}) {
dispatcher({type: RECENTER, payload: {plotId, centerPt} });
export function dispatchRecenter({plotId, centerPt, centerOnImage, dispatcher= flux.process}) {
dispatcher({type: RECENTER, payload: {plotId, centerPt, centerOnImage} });
}

/**
Expand Down Expand Up @@ -557,12 +560,13 @@ export function dispatchPlotImage({plotId,wpRequest, threeColor=isArray(wpReques
* @param {string} p.viewerId
* @param {Object} p.pvOptions PlotView init Options
* @param {boolean} [p.setNewPlotAsActive] the last completed plot will be active
* @param {boolean} [p.holdWcsMatch= false] if wcs match is on, then modify the request to hold the wcs match
* @param {Function} p.dispatcher only for special dispatching uses such as remote
*/
export function dispatchPlotGroup({wpRequestAry, viewerId, pvOptions= {},
setNewPlotAsActive= true,
setNewPlotAsActive= true, holdWcsMatch= false,
dispatcher= flux.process}) {
dispatcher( { type: PLOT_IMAGE, payload: { wpRequestAry, pvOptions, setNewPlotAsActive, viewerId} });
dispatcher( { type: PLOT_IMAGE, payload: { wpRequestAry, pvOptions, setNewPlotAsActive, holdWcsMatch, viewerId} });
}


Expand Down
Loading