Skip to content

DM-11349 Time Series data display issues regarding overlay's position and overlay's rendering #433

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
Aug 4, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -303,27 +303,6 @@ protected String getFilePrefix(TableServerRequest request) {

}

/**
* get ra (or ra corners) column name given the database and table name
* @param database database name
* @param catalog table name
* @return ra related column(s)
*/
Object getRA(String database, String catalog) {
return LSSTQuery.getDatasetInfo(database, catalog, new String[]{"ra"});
}

/**
* get dec (or dec corners) columne name given the database and table name
* @param database database name
* @param catalog table name
* @return dec related column(s)
*/
Object getDEC(String database, String catalog) {
return LSSTQuery.getDatasetInfo(database, catalog, new String[]{"dec"});

}


@Override
public void prepareTableMeta(TableMeta meta, List<DataType> columns, ServerRequest request) {
Expand All @@ -333,8 +312,8 @@ public void prepareTableMeta(TableMeta meta, List<DataType> columns, ServerReque
String database = request.getParam("database");

if (LSSTQuery.isCatalogTable(database, catTable)) {
Object RA = getRA(database, catTable);
Object DEC = getDEC(database, catTable);
Object RA = LSSTQuery.getRA(database, catTable);
Object DEC = LSSTQuery.getDEC(database, catTable);

TableMeta.LonLatColumns llc = new TableMeta.LonLatColumns((String) RA, (String) DEC, CoordinateSys.EQ_J2000);
meta.setCenterCoordColumns(llc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ String buildExistingConstraints(TableServerRequest request, String objectIdConst
public void prepareTableMeta(TableMeta meta, List<DataType> columns, ServerRequest request) {
super.prepareTableMeta(meta, columns, request);
meta.setAttribute(MetaConst.DATASET_CONVERTER, "lsst_sdss");

String database = request.getParam("database");
String tableName = request.getParam("table_name");

// add ra&dec column name info
if (LSSTQuery.isCatalogTable(database, tableName)) {
Object RA = LSSTQuery.getRA(database, tableName);
Object DEC = LSSTQuery.getDEC(database, tableName);

TableMeta.LonLatColumns llc = new TableMeta.LonLatColumns((String) RA, (String) DEC);
meta.setCenterCoordColumns(llc);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private DataGroup getSearchResult(TableServerRequest request, String filename) t

String tableName = request.getParam("table_name");
String database = request.getParam("database");
return ConcurrentSearchUtil.doSearch(workers, nThread, inDg, (String)getRA(database, tableName), (String)getDEC(database, tableName));
return ConcurrentSearchUtil.doSearch(workers, nThread, inDg, (String)LSSTQuery.getRA(database, tableName), (String)LSSTQuery.getDEC(database, tableName));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,28 @@ public static String getTableColumn(String database, String tableName, String co
return null;
}

/**
* get ra (or ra corners) column name given the database and table name
* @param database database name
* @param catalog table name
* @return ra related column(s)
*/
public static Object getRA(String database, String catalog) {
return LSSTQuery.getDatasetInfo(database, catalog, new String[]{"ra"});
}

/**
* get dec (or dec corners) columne name given the database and table name
* @param database database name
* @param catalog table name
* @return dec related column(s)
*/
public static Object getDEC(String database, String catalog) {
return LSSTQuery.getDatasetInfo(database, catalog, new String[]{"dec"});

}


static String[] getDBTableNameFromRequest(TableServerRequest request) {
String tableName = request.getParam("table_name");
String catTable = request.getParam(CatalogRequest.CATALOG);
Expand Down
12 changes: 5 additions & 7 deletions src/firefly/js/drawingLayers/DistanceTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import numeral from 'numeral';
import {isBoolean} from 'lodash';
import {isBoolean, get} from 'lodash';
import DrawLayerCntlr, {DRAWING_LAYER_KEY} from '../visualize/DrawLayerCntlr.js';
import {getPreference} from '../core/AppDataCntlr.js';
import {visRoot,dispatchAttributeChange} from '../visualize/ImagePlotCntlr.js';
Expand All @@ -19,10 +19,6 @@ import ShapeDataObj from '../visualize/draw/ShapeDataObj.js';
import {primePlot, getDrawLayerById} from '../visualize/PlotViewUtil.js';
import {getUIComponent} from './DistanceToolUI.jsx';
import {makeFactoryDef} from '../visualize/draw/DrawLayerFactory.js';
import {flux} from '../Firefly.js';





const EDIT_DISTANCE= BrowserInfo.isTouchInput() ? 18 : 10;
Expand Down Expand Up @@ -103,7 +99,7 @@ function onDetach(drawLayer,action) {

function getCursor(plotView, screenPt) {
const plot= primePlot(plotView);
var cc= CsysConverter.make(plot);

var ptAry= getPtAry(plot);
if (!ptAry) return null;
var idx= findClosestPtIdx(ptAry,screenPt);
Expand All @@ -127,7 +123,9 @@ function getLayerChanges(drawLayer, action) {
return end(action);
break;
case DrawLayerCntlr.ATTACH_LAYER_TO_PLOT:
return attach();
if (!get(action.payload, 'isExistingDrawLayer', false)) {
return attach();
}
break;
case DrawLayerCntlr.MODIFY_CUSTOM_FIELD:
return dealWithMods(drawLayer,action);
Expand Down
84 changes: 72 additions & 12 deletions src/firefly/js/drawingLayers/FootprintTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import {ANGLE_UNIT, OutlineType, getWorldOrImage, findClosestIndex, makeFootprin
lengthSizeUnit, updateFootprintDrawobjAngle,
updateFootprintTranslate, updateFootprintOutline} from '../visualize/draw/MarkerFootprintObj.js';
import {markerInterval, getCC, cancelTimeoutProcess, initMarkerPos,
updateVertexInfo, updateMarkerText} from './MarkerTool.js';
updateVertexInfo, updateMarkerText, translateForRelocate, getMovement} from './MarkerTool.js';
import {getFootprintToolUIComponent} from './FootprintToolUI.jsx';
import ShapeDataObj from '../visualize/draw/ShapeDataObj.js';
import {clone} from '../util/WebUtil.js';
import {getDS9Region} from '../rpc/PlotServicesJson.js';
import {FootprintFactory} from '../visualize/draw/FootprintFactory.js';
import {makeImagePt} from '../visualize/Point.js';
import {get, set, isArray, has, isNil} from 'lodash';
import {get, set, isArray, has, isNil, isEmpty} from 'lodash';
import Enum from 'enum';


Expand Down Expand Up @@ -67,7 +67,7 @@ export function footprintCreateLayerActionCreator(rawAction) {
get(visRoot(), 'activePlotId') : isArray(plotId) ? plotId[0] : plotId;

if (pId) {
dispatchAttachLayerToPlot(drawLayerId, pId, attachPlotGroup);
dispatchAttachLayerToPlot(drawLayerId, pId, attachPlotGroup, attachPlotGroup);

var plot = primePlot(visRoot(), pId);
if (plot) {
Expand Down Expand Up @@ -102,6 +102,7 @@ export function footprintStartActionCreator(rawAction) {
const {footprintStatus, currentPt, timeoutProcess} = get(footprintObj, 'actionInfo', {});
var wpt, idx, refPt;
var nextStatus = null;
let move = {};

cancelTimeoutProcess(timeoutProcess);
// marker can move to anywhere the mouse click at while in 'attached' state
Expand All @@ -112,7 +113,8 @@ export function footprintStartActionCreator(rawAction) {
wpt = getWorldOrImage(currentPt, cc);
nextStatus = FootprintStatus.rotate;
} else {
wpt = getWorldOrImage(imagePt, cc); // relocate the footprint right after the layer is attached
wpt = getWorldOrImage(currentPt, cc); // relocate the footprint right after the layer is attached
move = getMovement(currentPt, imagePt, cc);
nextStatus = FootprintStatus.attached_relocate;
}
}
Expand All @@ -132,7 +134,7 @@ export function footprintStartActionCreator(rawAction) {
}
if (nextStatus) {
showFootprintByTimer(dispatcher, DrawLayerCntlr.FOOTPRINT_START, regions, plotId,
nextStatus, footprintInterval, drawLayerId, {isOutline: true, isRotate:true}, fpInfo, wpt, refPt);
nextStatus, footprintInterval, drawLayerId, {isOutline: true, isRotate:true}, fpInfo, wpt, refPt, move);
}
};
}
Expand Down Expand Up @@ -278,13 +280,13 @@ function getLayerChanges(drawLayer, action) {
if (!drawLayerId || drawLayerId !== drawLayer.drawLayerId) return null;

const dd = Object.assign({}, drawLayer.drawData);
var plotIdAry;
const {plotIdAry=[]} = drawLayer;
var retV = null;

switch (action.type) {

case DrawLayerCntlr.FOOTPRINT_CREATE:
plotIdAry = getPlotViewIdListInGroup(visRoot(), plotId);
//plotIdAry = getPlotViewIdListInGroup(visRoot(), plotId);
plotIdAry.forEach((pId) => {
const plot = primePlot(visRoot(), pId);
const cc = CsysConverter.make(plot);
Expand All @@ -300,17 +302,17 @@ function getLayerChanges(drawLayer, action) {
var wptObj;
const {wpt} = action.payload;

plotIdAry = getPlotViewIdListInGroup(visRoot(), plotId);
//plotIdAry = getPlotViewIdListInGroup(visRoot(), plotId);
plotIdAry.forEach((pId) => {
wptObj = (pId === plotId) ? wpt : get(dd, ['data', pId, 'pts', '0']);
retV = createFootprintObjs(action, drawLayer, pId, wptObj, retV);
});
return retV;

case DrawLayerCntlr.MODIFY_CUSTOM_FIELD:
const {fpText, fpTextLoc, angleDeg, activePlotId} = action.payload.changes;
const {fpText, fpTextLoc, angleDeg} = action.payload.changes;

plotIdAry = getPlotViewIdListInGroup(visRoot(), activePlotId);
//plotIdAry = getPlotViewIdListInGroup(visRoot(), activePlotId);
if (plotIdAry) {
if (!isNil(angleDeg)) {
return updateFootprintAngle(angleDeg, dd[DataTypes.DATA], plotIdAry);
Expand All @@ -319,6 +321,11 @@ function getLayerChanges(drawLayer, action) {
}
}
break;
case DrawLayerCntlr.ATTACH_LAYER_TO_PLOT:
if (get(action.payload, 'isExistingDrawLayer', false)) {
return attachToNewPlot(drawLayer, get(action.payload, ['plotIdAry', '0']));
}
break;
default:
return null;
}
Expand Down Expand Up @@ -437,8 +444,10 @@ function createFootprintObjs(action, dl, plotId, wpt, prevRet) {

if (footprintStatus === FootprintStatus.attached ||
footprintStatus === FootprintStatus.attached_relocate) { // position is relocated after the layer is attached

footprintObj = makeFootprint(regions, wpt, isHandle, cc, text, textLoc);
if (footprintStatus === FootprintStatus.attached_relocate) {
footprintObj = translateForRelocate(footprintObj, move, cc);
}
} else if (crtFpObj) {
if ((footprintStatus === FootprintStatus.rotate || footprintStatus === FootprintStatus.relocate) && move) {
var {apt} = move; // move to relocate or rotate
Expand Down Expand Up @@ -518,4 +527,55 @@ function resetRotateSide(footprintObj) {
outlineBox[rSide] = 1;
}
}
}
}

/**
* add the footprint drawing objects into the new plot reated after the drawing layer is created
* @param drawLayer
* @param newPlotId new plot
* @returns {*}
*/
function attachToNewPlot(drawLayer, newPlotId) {
const data = get(drawLayer, ['drawData', 'data'], {});
const existPlotId = !isEmpty(data) && Object.keys(data).find((pId) => {
return !isEmpty(drawLayer.drawData.data[pId]);
});

if (!existPlotId) return null;

const { text, textLoc, renderOptions, actionInfo, translation, angle, angleUnit,
drawData, regions} = get(drawLayer, ['drawData', 'data', existPlotId]);
const plot = primePlot(visRoot(), newPlotId);
const cc = CsysConverter.make(plot);
let wpt = initMarkerPos(plot, cc);
let footprintObj = makeFootprint(regions, wpt,
{isOutline: drawData? drawData.isOutline : false,
isRotate: drawData? drawData.isRorate : false},
cc, text, textLoc);

if (!isEmpty(translation)) {
footprintObj = updateFootprintTranslate(footprintObj, cc, translation);
footprintObj= updateFootprintOutline(footprintObj, cc);
resetRotateSide(footprintObj);
wpt = get(footprintObj, ['pts', '0']);
}

if (angle) {
footprintObj = updateFootprintDrawobjAngle(footprintObj, cc, wpt, angle, angleUnit);
footprintObj.angleFromUI = false;
}

const aInfo = Object.assign({}, actionInfo, {currentPt: wpt});
set(drawLayer.drawData, [DataTypes.DATA, newPlotId], Object.assign(footprintObj, {actionInfo: aInfo,
renderOptions, translation}));
const dlObj = {drawData: drawLayer.drawData, helpLine: editHelpText};

if (aInfo.footprintStatus) {
const {exclusiveDef, vertexDef} = updateVertexInfo(footprintObj, newPlotId, drawLayer, drawLayer);

if (exclusiveDef && vertexDef) {
return clone(dlObj, {footprintStatus: aInfo.footprintStatus, vertexDef, exclusiveDef});
}
}
return dlObj;
}
Loading