@@ -16,7 +16,10 @@ import {SizeInputFields} from './SizeInputField.jsx';
16
16
import { InputAreaFieldConnected } from './InputAreaField.jsx' ;
17
17
import { FileUpload } from '../ui/FileUpload.jsx' ;
18
18
19
- import { getActiveTarget } from '../core/AppDataCntlr.js' ;
19
+ import CsysConverter from '../visualize/CsysConverter.js' ;
20
+ import { getActivePlotView } from '../visualize/PlotViewUtil.js' ;
21
+ import { makeImagePt } from '../visualize/Point.js' ;
22
+ import { visRoot } from '../visualize/ImagePlotCntlr.js' ;
20
23
21
24
import './CatalogSearchMethodType.css' ;
22
25
/*
@@ -269,78 +272,4 @@ var initRadiusArcSec = (max) => {
269
272
} else {
270
273
return parseFloat ( 1 / 3600 ) . toString ( ) ;
271
274
}
272
- } ;
273
-
274
-
275
- /**
276
- * Helper to get polygon from image
277
- */
278
- import CsysConverter from '../visualize/CsysConverter.js' ;
279
- import { getActivePlotView } from '../visualize/PlotViewUtil.js' ;
280
- import { makeImagePt } from '../visualize/Point.js' ;
281
- import { visRoot } from '../visualize/ImagePlotCntlr.js' ;
282
- import { MetaConst } from '../data/MetaConst.js' ;
283
- import { CoordinateSys } from '../visualize/CoordSys.js' ;
284
- import { doFetchTable , getTblById , getActiveTableId , getColumnIdx , getTableInGroup , isTableUsingRadians } from '../tables/TableUtil.js' ;
285
- const DEF_CORNER_COLS = [ 'ra1;dec1' , 'ra2;dec2' , 'ra3;dec3' , 'ra4;dec4' ] ;
286
- function getCovColumnsForQuery ( table ) {
287
- const cAry = [ ...getCornersColumns ( table ) , getCenterColumns ( table ) ] ;
288
- return cAry . reduce ( ( s , c , idx ) => s + `${ idx > 0 ? ',' : '' } ${ c . lonCol } ,${ c . latCol } ` , '' ) ;
289
- }
290
- function getCornersColumns ( table ) {
291
- if ( ! table ) return [ ] ;
292
- const { tableMeta} = table ;
293
- if ( ! tableMeta ) return [ ] ;
294
- if ( tableMeta [ MetaConst . ALL_CORNERS ] ) {
295
- return makeCoordColAry ( tableMeta [ MetaConst . ALL_CORNERS ] . split ( ',' ) , table ) ;
296
- }
297
- return makeCoordColAry ( DEF_CORNER_COLS , table ) ;
298
- }
299
-
300
- function getCenterColumns ( table ) {
301
- if ( ! table ) return [ ] ;
302
- const { tableMeta :meta } = table ;
303
- if ( ! meta ) return [ ] ;
304
-
305
- if ( meta [ MetaConst . CENTER_COLUMN ] ) return makeCoordCol ( meta [ MetaConst . CENTER_COLUMN ] , table ) ;
306
- if ( meta [ MetaConst . CATALOG_COORD_COLS ] ) return makeCoordCol ( meta [ MetaConst . CATALOG_COORD_COLS ] , table ) ;
307
- const defCol = guessDefColumns ( table ) ;
308
-
309
- return makeCoordCol ( defCol , table ) ;
310
- }
311
-
312
- function guessDefColumns ( table ) {
313
- const DEF_CENTER_COL = 'ra;dec;EQ_J2000' ;
314
- const { columns} = table . tableData ;
315
- const colList = columns . map ( ( c ) => c . name . toLowerCase ( ) ) ;
316
- if ( colList . includes ( 'ra' ) && colList . includes ( 'dec' ) ) return 'ra;dec;EQ_J2000' ;
317
- if ( colList . includes ( 'lon' ) && colList . includes ( 'lat' ) ) return 'lon;lat;EQ_J2000' ;
318
- // if (colList.includes('crval1') && colList.includes('crval2')) return 'crval1;crval2;EQ_J2000';
319
- return 'ra;dec;EQ_J2000' ;
320
- }
321
-
322
- function getBoxAryFromTable ( options , table , usesRadians ) {
323
- const cDefAry = getCornersColumns ( table ) ;
324
- return table . tableData . data
325
- . map ( ( row ) => cDefAry
326
- . map ( ( cDef ) => makeWorldPt ( row [ cDef . lonIdx ] , row [ cDef . latIdx ] , cDef . csys ) ) ) ;
327
- }
328
-
329
-
330
- const makeCoordColAry = ( cAry , table ) => cAry . map ( ( c ) => makeCoordCol ( c , table ) ) . filter ( ( cCol ) => cCol ) ;
331
-
332
- function makeCoordCol ( def , table ) {
333
- const s = def . split ( ';' ) ;
334
- if ( s . length !== 3 && s . length !== 2 ) return null ;
335
- const s0Idx = getColumnIdx ( table , s [ 0 ] ) ;
336
- const s1Idx = getColumnIdx ( table , s [ 1 ] ) ;
337
- if ( s0Idx === - 1 || s0Idx === - 1 ) return null ;
338
- return {
339
- lonCol : s [ 0 ] ,
340
- latCol : s [ 1 ] ,
341
- lonIdx : s0Idx ,
342
- latIdx : s1Idx ,
343
- csys : s [ 2 ] ? CoordinateSys . parse ( s [ 2 ] ) : CoordinateSys . EQ_J2000
344
- } ;
345
-
346
- }
275
+ } ;
0 commit comments