From 75bf3fdeb5a9800a29eacca28b7ab4eec8afe6c4 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 25 Oct 2018 15:54:34 -0400 Subject: new mask --- tksao/configure | 4 +- tksao/configure.ac | 4 +- tksao/frame/base.h | 18 +- tksao/frame/baseload.C | 719 +++++++++++++++++++++++++++++++++++++++++++++++ tksao/frame/frame.h | 2 +- tksao/frame/frameload.C | 15 - tksao/frame/frload.C | 730 ------------------------------------------------ 7 files changed, 733 insertions(+), 759 deletions(-) create mode 100644 tksao/frame/baseload.C delete mode 100644 tksao/frame/frload.C diff --git a/tksao/configure b/tksao/configure index 74ee0c1..ee6c875 100755 --- a/tksao/configure +++ b/tksao/configure @@ -5720,6 +5720,7 @@ frame/basebox.C frame/basecommand.C frame/baseellipse.C frame/baseline.C +frame/baseload.C frame/basemarker.C frame/basepolygon.C frame/box.C @@ -5762,13 +5763,13 @@ frame/fitsnrrd.C frame/fr3dcommand.C frame/fr3dmap.C frame/frame.C -frame/frameload.C frame/frame3d.C frame/frame3dbase.C frame/frame3dtruecolor16.C frame/frame3dtruecolor24.C frame/frame3dtruecolor8.C frame/framebase.C +frame/frameload.C frame/framergb.C frame/framergbtruecolor16.C frame/framergbtruecolor24.C @@ -5778,7 +5779,6 @@ frame/frametruecolor24.C frame/frametruecolor8.C frame/frblt.C frame/frcommand.C -frame/frload.C frame/frmap.C frame/frmarker.C frame/frmarkerxml.C diff --git a/tksao/configure.ac b/tksao/configure.ac index 2e565e0..73b58a2 100644 --- a/tksao/configure.ac +++ b/tksao/configure.ac @@ -149,6 +149,7 @@ frame/basebox.C frame/basecommand.C frame/baseellipse.C frame/baseline.C +frame/baseload.C frame/basemarker.C frame/basepolygon.C frame/box.C @@ -191,13 +192,13 @@ frame/fitsnrrd.C frame/fr3dcommand.C frame/fr3dmap.C frame/frame.C -frame/frameload.C frame/frame3d.C frame/frame3dbase.C frame/frame3dtruecolor16.C frame/frame3dtruecolor24.C frame/frame3dtruecolor8.C frame/framebase.C +frame/frameload.C frame/framergb.C frame/framergbtruecolor16.C frame/framergbtruecolor24.C @@ -207,7 +208,6 @@ frame/frametruecolor24.C frame/frametruecolor8.C frame/frblt.C frame/frcommand.C -frame/frload.C frame/frmap.C frame/frmarker.C frame/frmarkerxml.C diff --git a/tksao/frame/base.h b/tksao/frame/base.h index 17f9cea..e56b8dd 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -794,15 +794,15 @@ public: virtual void loadFitsSocketGZCmd(int, const char*, LayerType); virtual void loadFitsVarCmd(const char*, const char*, LayerType); - void loadArrAllocCmd(const char*, const char*, LayerType); - void loadArrAllocGZCmd(const char*, const char*, LayerType); - void loadArrChannelCmd(const char*, const char*, LayerType); - void loadArrMMapCmd(const char*, LayerType); - void loadArrMMapIncrCmd(const char*, LayerType); - void loadArrShareCmd(ShmType, int, const char*, LayerType); - void loadArrSocketCmd(int, const char*, LayerType); - void loadArrSocketGZCmd(int, const char*, LayerType); - void loadArrVarCmd(const char*, const char*, LayerType); + virtual void loadArrAllocCmd(const char*, const char*, LayerType); + virtual void loadArrAllocGZCmd(const char*, const char*, LayerType); + virtual void loadArrChannelCmd(const char*, const char*, LayerType); + virtual void loadArrMMapCmd(const char*, LayerType); + virtual void loadArrMMapIncrCmd(const char*, LayerType); + virtual void loadArrShareCmd(ShmType, int, const char*, LayerType); + virtual void loadArrSocketCmd(int, const char*, LayerType); + virtual void loadArrSocketGZCmd(int, const char*, LayerType); + virtual void loadArrVarCmd(const char*, const char*, LayerType); void loadENVISMMapCmd(const char*, const char*); diff --git a/tksao/frame/baseload.C b/tksao/frame/baseload.C new file mode 100644 index 0000000..bf40130 --- /dev/null +++ b/tksao/frame/baseload.C @@ -0,0 +1,719 @@ +// Copyright (C) 1999-2018 +// Smithsonian Astrophysical Observatory, Cambridge, MA, USA +// For conditions of distribution and use, see copyright notice in "copyright" + +#include "base.h" +#include "context.h" + +// *** Fits *** + +void Base::loadFitsAllocCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(ALLOC, fn, img)); +} + +void Base::loadFitsAllocGZCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(ALLOCGZ, fn, img)); +} + +void Base::loadFitsChannelCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsChannel(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(CHANNEL, fn, img)); +} + +void Base::loadFitsMMapCmd(const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMap(currentContext, interp, fn, 1); + loadDone(currentContext->load(MMAP, fn, img)); +} + +void Base::loadFitsSMMapCmd(const char* hdr, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, hdr, fn, 1); + loadDone(currentContext->load(SMMAP, fn, img)); +} + +void Base::loadFitsMMapIncrCmd(const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, fn, 1); + loadDone(currentContext->load(MMAPINCR, fn, img)); +} + +void Base::loadFitsShareCmd(ShmType stype, int id, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->load(SHARE, fn, img)); +} + +void Base::loadFitsSShareCmd(ShmType stype, int hdr, int id, + const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSShare(currentContext, interp, + stype, hdr, id, fn, 1); + loadDone(currentContext->load(SSHARE, fn, img)); +} + +void Base::loadFitsSocketCmd(int s, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocket(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->load(SOCKET, fn, img)); +} + +void Base::loadFitsSocketGZCmd(int s, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->load(SOCKETGZ, fn, img)); +} + +void Base::loadFitsVarCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsVar(currentContext, interp, ch, fn, 1); + loadDone(currentContext->load(VAR, fn, img)); +} + +// *** Array *** + +void Base::loadArrAllocCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(ALLOC, fn, img)); +} + +void Base::loadArrAllocGZCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(ALLOCGZ, fn, img)); +} + +void Base::loadArrChannelCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(CHANNEL, fn, img)); +} + +void Base::loadArrMMapCmd(const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->load(MMAP, fn, img)); +} + +void Base::loadArrMMapIncrCmd(const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->load(MMAPINCR, fn, img)); +} + +void Base::loadArrShareCmd(ShmType stype, int id, const char* fn, + LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->load(SHARE, fn, img)); +} + +void Base::loadArrSocketCmd(int s, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrSocket(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->load(SOCKET, fn, img)); +} + +void Base::loadArrSocketGZCmd(int s, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrSocketGZ(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->load(SOCKETGZ, fn, img)); +} + +void Base::loadArrVarCmd(const char* ch, const char* fn, LayerType ll) +{ + unloadFits(); + FitsImage* img = new FitsImageArrVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->load(VAR, fn, img)); +} + +// *** ENVI *** + +void Base::loadENVISMMapCmd(const char* hdr, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageENVISMMap(currentContext, interp, hdr, fn, 1); + loadDone(currentContext->load(SMMAP, fn, img)); +} + +// *** NRRD *** + +void Base::loadNRRDAllocCmd(const char* ch, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(ALLOC, fn, img), ll); +} + +void Base::loadNRRDChannelCmd(const char* ch, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->load(CHANNEL, fn, img), ll); +} + +void Base::loadNRRDMMapCmd(const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDMMap(currentContext, interp, fn, 1); + loadDone(currentContext->load(MMAP, fn, img), ll); +} + +void Base::loadNRRDShareCmd(ShmType stype, int id, const char* fn, + LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->load(SHARE, fn, img), ll); +} + +void Base::loadNRRDSocketCmd(int s, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDSocket(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->load(SOCKET, fn, img), ll); +} + +void Base::loadNRRDVarCmd(const char* ch, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageNRRDVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->load(VAR, fn, img), ll); +} + +// *** Photo *** + +void Base::loadPhotoCmd(const char* ph, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImagePhoto(currentContext, interp, + ph, fn, 1); + loadDone(currentContext->load(PHOTO, fn, img)); +} + +void Base::loadSlicePhotoCmd(const char* ph, const char* fn) +{ + FitsImage* img = new FitsImagePhoto(currentContext, interp, + ph, fn, 1); + loadDone(currentContext->loadSlice(PHOTO, fn, img)); +} + +// *** Data Cube *** + +void Base::loadExtCubeAllocCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadExtCube(ALLOC, fn, img)); +} + +void Base::loadExtCubeAllocGZCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadExtCube(ALLOCGZ, fn, img)); +} + +void Base::loadExtCubeChannelCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadExtCube(CHANNEL, fn, img)); +} + +void Base::loadExtCubeMMapCmd(const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->loadExtCube(MMAP, fn, img)); +} + +void Base::loadExtCubeMMapIncrCmd(const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->loadExtCube(MMAPINCR, fn, img)); +} + +void Base::loadExtCubeShareCmd(ShmType stype, int id, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->loadExtCube(SHARE, fn, img)); +} + +void Base::loadExtCubeSocketCmd(int s, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocket(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadExtCube(SOCKET, fn, img)); +} + +void Base::loadExtCubeSocketGZCmd(int s, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadExtCube(SOCKETGZ, fn, img)); +} + +void Base::loadExtCubeVarCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->loadExtCube(VAR, fn, img)); +} + +// *** Slice *** + +void Base::loadSliceAllocCmd(const char* ch, const char* fn) +{ + FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadSlice(ALLOC, fn, img)); +} + +void Base::loadSliceAllocGZCmd(const char* ch, const char* fn) +{ + FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadSlice(ALLOCGZ, fn, img)); +} + +void Base::loadSliceChannelCmd(const char* ch, const char* fn) +{ + FitsImage* img = new FitsImageFitsChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadSlice(CHANNEL, fn, img)); +} + +void Base::loadSliceMMapCmd(const char* fn) +{ + FitsImage* img = new FitsImageFitsMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->loadSlice(MMAP, fn, img)); +} + +void Base::loadSliceSMMapCmd(const char* hdr, const char* fn) +{ + FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, + hdr, fn, 1); + loadDone(currentContext->loadSlice(MMAP, fn, img)); +} + +void Base::loadSliceMMapIncrCmd(const char* fn) +{ + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->loadSlice(MMAPINCR, fn, img)); +} + +void Base::loadSliceShareCmd(ShmType stype, int id, const char* fn) +{ + FitsImage* img = new FitsImageFitsShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->loadSlice(SHARE, fn, img)); +} + +void Base::loadSliceSShareCmd(ShmType stype, int hdr, int id, const char* fn) +{ + FitsImage* img = new FitsImageFitsSShare(currentContext, interp, + stype, hdr, id, fn, 1); + loadDone(currentContext->loadSlice(SSHARE, fn, img)); +} + +void Base::loadSliceSocketCmd(int s, const char* fn) +{ + FitsImage* img = new FitsImageFitsSocket(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->loadSlice(SOCKET, fn, img)); +} + +void Base::loadSliceSocketGZCmd(int s, const char* fn) +{ + FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->loadSlice(SOCKETGZ, fn, img)); +} + +void Base::loadSliceVarCmd(const char* ch, const char* fn) +{ + FitsImage* img = new FitsImageFitsVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->loadSlice(VAR, fn, img)); +} + +// *** Mosaic Image *** + +void Base::loadMosaicImageAllocCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicImage(ALLOC, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageAllocGZCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, + LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicImage(ALLOCGZ, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageChannelCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, + LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicImage(CHANNEL, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageMMapCmd(MosaicType type, Coord::CoordSystem sys, + const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaicImage(MMAP, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageMMapIncrCmd(MosaicType type, Coord::CoordSystem sys, + const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaicImage(MMAPINCR, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageShareCmd(MosaicType type, Coord::CoordSystem sys, + ShmType stype, int id, const char* fn, + LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->loadMosaicImage(SHARE, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageSocketCmd(MosaicType type, Coord::CoordSystem sys, + int s, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicSocket(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicImage(SOCKET, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageSocketGZCmd(MosaicType type, + Coord::CoordSystem sys, + int s, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicSocketGZ(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicImage(SOCKETGZ, fn, img, type, sys), ll); +} + +void Base::loadMosaicImageVarCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, LayerType ll) +{ + if (ll == IMG) + unloadFits(); + FitsImage* img = new FitsImageMosaicVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->loadMosaicImage(VAR, fn, img, type, sys), ll); +} + +// *** Mosaic *** + +void Base::loadMosaicAllocCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaic(ALLOC, fn, img, type, sys), ll); +} + +void Base::loadMosaicAllocGZCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaic(ALLOCGZ, fn, img, type, sys), ll); +} + +void Base::loadMosaicChannelCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaic(CHANNEL, fn, img, type, sys), ll); +} + +void Base::loadMosaicMMapCmd(MosaicType type, Coord::CoordSystem sys, + const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaic(MMAP, fn, img, type, sys), ll); +} + +void Base::loadMosaicSMMapCmd(MosaicType type, Coord::CoordSystem sys, + const char* hdr, const char* fn, + LayerType ll) +{ + FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, + hdr, fn, 1); + loadDone(currentContext->loadMosaic(MMAP, fn, img, type, sys), ll); +} + +void Base::loadMosaicMMapIncrCmd(MosaicType type, Coord::CoordSystem sys, + const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaic(MMAPINCR, fn, img, type, sys), ll); +} + +void Base::loadMosaicShareCmd(MosaicType type, Coord::CoordSystem sys, + ShmType stype, int id, const char* fn, + LayerType ll) +{ + FitsImage* img = new FitsImageFitsShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->loadMosaic(SHARE, fn, img, type, sys), ll); +} + +void Base::loadMosaicSShareCmd(MosaicType type, Coord::CoordSystem sys, + ShmType stype, int hdr, int id, const char* fn, + LayerType ll) +{ + FitsImage* img = new FitsImageFitsSShare(currentContext, interp, + stype, hdr, id, fn, 1); + loadDone(currentContext->loadMosaic(SSHARE, fn, img, type, sys), ll); +} + +void Base::loadMosaicSocketCmd(MosaicType type, Coord::CoordSystem sys, + int s, const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsSocket(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->loadMosaic(SOCKET, fn, img, type, sys), ll); +} + +void Base::loadMosaicSocketGZCmd(MosaicType type, Coord::CoordSystem sys, + int s, const char* fn, LayerType ll) +{ + FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, + s, fn, FitsFile::FLUSH, 1); + loadDone(currentContext->loadMosaic(SOCKETGZ, fn, img, type, sys), ll); +} + +void Base::loadMosaicVarCmd(MosaicType type, Coord::CoordSystem sys, + const char* ch, const char* fn, + LayerType ll) +{ + FitsImage* img = new FitsImageFitsVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->loadMosaic(VAR, fn, img, type, sys), ll); +} + +// *** Mosaic Image WFPC2 *** + +void Base::loadMosaicImageWFPC2AllocCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicWFPC2(ALLOC, fn, img)); +} + +void Base::loadMosaicImageWFPC2AllocGZCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, + ch, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicWFPC2(ALLOCGZ, fn, img)); +} + +void Base::loadMosaicImageWFPC2ChannelCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsChannel(currentContext, interp, + ch, fn, + FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicWFPC2(CHANNEL, fn, img)); +} + +void Base::loadMosaicImageWFPC2MMapCmd(const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMap(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaicWFPC2(MMAP, fn, img)); +} + +void Base::loadMosaicImageWFPC2MMapIncrCmd(const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, + fn, 1); + loadDone(currentContext->loadMosaicWFPC2(MMAPINCR, fn, img)); +} + +void Base::loadMosaicImageWFPC2ShareCmd(ShmType stype, int id, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsShare(currentContext, interp, + stype, id, fn, 1); + loadDone(currentContext->loadMosaicWFPC2(SHARE, fn, img)); +} + +void Base::loadMosaicImageWFPC2SocketCmd(int s, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocket(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicWFPC2(SOCKET, fn, img)); +} + +void Base::loadMosaicImageWFPC2SocketGZCmd(int s, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, + s, fn, FitsFile::NOFLUSH, 1); + loadDone(currentContext->loadMosaicWFPC2(SOCKETGZ, fn, img)); +} + +void Base::loadMosaicImageWFPC2VarCmd(const char* ch, const char* fn) +{ + unloadFits(); + FitsImage* img = new FitsImageFitsVar(currentContext, interp, + ch, fn, 1); + loadDone(currentContext->loadMosaicWFPC2(VAR, fn, img)); +} + +// *** + +void Base::loadDone(int rr, LayerType ll) +{ + loadDone(rr); +} + +void Base::loadDone(int rr) +{ + if (rr) { + alignWCS(); + if (!preservePan) { + centerImage(); + crosshair = cursor; + } + } + else { + reset(); + Tcl_AppendResult(interp, "Unable to load file", NULL); + result = TCL_ERROR; + } + + // adjust current slice if needed + if (currentContext->fits && isCube() && + currentContext->secMode()==FrScale::CROPSEC) { + + // context->slice() IMAGE (ranges 1-n) + // params are in DATA coords, edge to edge + // setSlice() IMAGE (ranges 1-n) + double sl = currentContext->slice(2)-.5; + FitsZBound* zparams = + currentContext->getDataParams(currentContext->secMode()); + double ff = zparams->zmin+.5; + double tt = zparams->zmax-.5; + if (sltt) + setSlice(2,tt+.5); + } + + updateColorScale(); + update(MATRIX); +} + diff --git a/tksao/frame/frame.h b/tksao/frame/frame.h index d212af7..68fdb48 100644 --- a/tksao/frame/frame.h +++ b/tksao/frame/frame.h @@ -5,9 +5,9 @@ #ifndef __frame_h__ #define __frame_h__ +#include "framebase.h" #include "context.h" #include "fitsmask.h" -#include "framebase.h" #include "colorscale.h" // Frame diff --git a/tksao/frame/frameload.C b/tksao/frame/frameload.C index db15456..ff4323b 100644 --- a/tksao/frame/frameload.C +++ b/tksao/frame/frameload.C @@ -2,22 +2,7 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include - #include "frame.h" -#include "fitsimage.h" -#include "fitsmask.h" - -#include "alloc.h" -#include "allocgz.h" -#include "channel.h" -#include "mmap.h" -#include "mmapincr.h" -#include "share.h" -#include "sshare.h" -#include "socket.h" -#include "socketgz.h" -#include "var.h" // *** Fits *** diff --git a/tksao/frame/frload.C b/tksao/frame/frload.C deleted file mode 100644 index 1b6eb88..0000000 --- a/tksao/frame/frload.C +++ /dev/null @@ -1,730 +0,0 @@ -// Copyright (C) 1999-2018 -// Smithsonian Astrophysical Observatory, Cambridge, MA, USA -// For conditions of distribution and use, see copyright notice in "copyright" - -#include "context.h" -#include "fitsimage.h" - -#include "alloc.h" -#include "allocgz.h" -#include "channel.h" -#include "mmap.h" -#include "mmapincr.h" -#include "share.h" -#include "sshare.h" -#include "socket.h" -#include "socketgz.h" -#include "var.h" - -// *** Fits *** - -void Base::loadFitsAllocCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(ALLOC, fn, img)); -} - -void Base::loadFitsAllocGZCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(ALLOCGZ, fn, img)); -} - -void Base::loadFitsChannelCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsChannel(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(CHANNEL, fn, img)); -} - -void Base::loadFitsMMapCmd(const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMap(currentContext, interp, fn, 1); - loadDone(currentContext->load(MMAP, fn, img)); -} - -void Base::loadFitsSMMapCmd(const char* hdr, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, hdr, fn, 1); - loadDone(currentContext->load(SMMAP, fn, img)); -} - -void Base::loadFitsMMapIncrCmd(const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, fn, 1); - loadDone(currentContext->load(MMAPINCR, fn, img)); -} - -void Base::loadFitsShareCmd(ShmType stype, int id, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->load(SHARE, fn, img)); -} - -void Base::loadFitsSShareCmd(ShmType stype, int hdr, int id, - const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSShare(currentContext, interp, - stype, hdr, id, fn, 1); - loadDone(currentContext->load(SSHARE, fn, img)); -} - -void Base::loadFitsSocketCmd(int s, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocket(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->load(SOCKET, fn, img)); -} - -void Base::loadFitsSocketGZCmd(int s, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->load(SOCKETGZ, fn, img)); -} - -void Base::loadFitsVarCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsVar(currentContext, interp, ch, fn, 1); - loadDone(currentContext->load(VAR, fn, img)); -} - -// *** Array *** - -void Base::loadArrAllocCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(ALLOC, fn, img)); -} - -void Base::loadArrAllocGZCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(ALLOCGZ, fn, img)); -} - -void Base::loadArrChannelCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(CHANNEL, fn, img)); -} - -void Base::loadArrMMapCmd(const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->load(MMAP, fn, img)); -} - -void Base::loadArrMMapIncrCmd(const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->load(MMAPINCR, fn, img)); -} - -void Base::loadArrShareCmd(ShmType stype, int id, const char* fn, - LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->load(SHARE, fn, img)); -} - -void Base::loadArrSocketCmd(int s, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrSocket(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->load(SOCKET, fn, img)); -} - -void Base::loadArrSocketGZCmd(int s, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrSocketGZ(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->load(SOCKETGZ, fn, img)); -} - -void Base::loadArrVarCmd(const char* ch, const char* fn, LayerType ll) -{ - unloadFits(); - FitsImage* img = new FitsImageArrVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->load(VAR, fn, img)); -} - -// *** ENVI *** - -void Base::loadENVISMMapCmd(const char* hdr, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageENVISMMap(currentContext, interp, hdr, fn, 1); - loadDone(currentContext->load(SMMAP, fn, img)); -} - -// *** NRRD *** - -void Base::loadNRRDAllocCmd(const char* ch, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(ALLOC, fn, img), ll); -} - -void Base::loadNRRDChannelCmd(const char* ch, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->load(CHANNEL, fn, img), ll); -} - -void Base::loadNRRDMMapCmd(const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDMMap(currentContext, interp, fn, 1); - loadDone(currentContext->load(MMAP, fn, img), ll); -} - -void Base::loadNRRDShareCmd(ShmType stype, int id, const char* fn, - LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->load(SHARE, fn, img), ll); -} - -void Base::loadNRRDSocketCmd(int s, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDSocket(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->load(SOCKET, fn, img), ll); -} - -void Base::loadNRRDVarCmd(const char* ch, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageNRRDVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->load(VAR, fn, img), ll); -} - -// *** Photo *** - -void Base::loadPhotoCmd(const char* ph, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImagePhoto(currentContext, interp, - ph, fn, 1); - loadDone(currentContext->load(PHOTO, fn, img)); -} - -void Base::loadSlicePhotoCmd(const char* ph, const char* fn) -{ - FitsImage* img = new FitsImagePhoto(currentContext, interp, - ph, fn, 1); - loadDone(currentContext->loadSlice(PHOTO, fn, img)); -} - -// *** Data Cube *** - -void Base::loadExtCubeAllocCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadExtCube(ALLOC, fn, img)); -} - -void Base::loadExtCubeAllocGZCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadExtCube(ALLOCGZ, fn, img)); -} - -void Base::loadExtCubeChannelCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadExtCube(CHANNEL, fn, img)); -} - -void Base::loadExtCubeMMapCmd(const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->loadExtCube(MMAP, fn, img)); -} - -void Base::loadExtCubeMMapIncrCmd(const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->loadExtCube(MMAPINCR, fn, img)); -} - -void Base::loadExtCubeShareCmd(ShmType stype, int id, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->loadExtCube(SHARE, fn, img)); -} - -void Base::loadExtCubeSocketCmd(int s, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocket(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadExtCube(SOCKET, fn, img)); -} - -void Base::loadExtCubeSocketGZCmd(int s, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadExtCube(SOCKETGZ, fn, img)); -} - -void Base::loadExtCubeVarCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->loadExtCube(VAR, fn, img)); -} - -// *** Slice *** - -void Base::loadSliceAllocCmd(const char* ch, const char* fn) -{ - FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadSlice(ALLOC, fn, img)); -} - -void Base::loadSliceAllocGZCmd(const char* ch, const char* fn) -{ - FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadSlice(ALLOCGZ, fn, img)); -} - -void Base::loadSliceChannelCmd(const char* ch, const char* fn) -{ - FitsImage* img = new FitsImageFitsChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadSlice(CHANNEL, fn, img)); -} - -void Base::loadSliceMMapCmd(const char* fn) -{ - FitsImage* img = new FitsImageFitsMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->loadSlice(MMAP, fn, img)); -} - -void Base::loadSliceSMMapCmd(const char* hdr, const char* fn) -{ - FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, - hdr, fn, 1); - loadDone(currentContext->loadSlice(MMAP, fn, img)); -} - -void Base::loadSliceMMapIncrCmd(const char* fn) -{ - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->loadSlice(MMAPINCR, fn, img)); -} - -void Base::loadSliceShareCmd(ShmType stype, int id, const char* fn) -{ - FitsImage* img = new FitsImageFitsShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->loadSlice(SHARE, fn, img)); -} - -void Base::loadSliceSShareCmd(ShmType stype, int hdr, int id, const char* fn) -{ - FitsImage* img = new FitsImageFitsSShare(currentContext, interp, - stype, hdr, id, fn, 1); - loadDone(currentContext->loadSlice(SSHARE, fn, img)); -} - -void Base::loadSliceSocketCmd(int s, const char* fn) -{ - FitsImage* img = new FitsImageFitsSocket(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->loadSlice(SOCKET, fn, img)); -} - -void Base::loadSliceSocketGZCmd(int s, const char* fn) -{ - FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->loadSlice(SOCKETGZ, fn, img)); -} - -void Base::loadSliceVarCmd(const char* ch, const char* fn) -{ - FitsImage* img = new FitsImageFitsVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->loadSlice(VAR, fn, img)); -} - -// *** Mosaic Image *** - -void Base::loadMosaicImageAllocCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicImage(ALLOC, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageAllocGZCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, - LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicImage(ALLOCGZ, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageChannelCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, - LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicImage(CHANNEL, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageMMapCmd(MosaicType type, Coord::CoordSystem sys, - const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaicImage(MMAP, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageMMapIncrCmd(MosaicType type, Coord::CoordSystem sys, - const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaicImage(MMAPINCR, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageShareCmd(MosaicType type, Coord::CoordSystem sys, - ShmType stype, int id, const char* fn, - LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->loadMosaicImage(SHARE, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageSocketCmd(MosaicType type, Coord::CoordSystem sys, - int s, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicSocket(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicImage(SOCKET, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageSocketGZCmd(MosaicType type, - Coord::CoordSystem sys, - int s, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicSocketGZ(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicImage(SOCKETGZ, fn, img, type, sys), ll); -} - -void Base::loadMosaicImageVarCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, LayerType ll) -{ - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageMosaicVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->loadMosaicImage(VAR, fn, img, type, sys), ll); -} - -// *** Mosaic *** - -void Base::loadMosaicAllocCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaic(ALLOC, fn, img, type, sys), ll); -} - -void Base::loadMosaicAllocGZCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaic(ALLOCGZ, fn, img, type, sys), ll); -} - -void Base::loadMosaicChannelCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaic(CHANNEL, fn, img, type, sys), ll); -} - -void Base::loadMosaicMMapCmd(MosaicType type, Coord::CoordSystem sys, - const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaic(MMAP, fn, img, type, sys), ll); -} - -void Base::loadMosaicSMMapCmd(MosaicType type, Coord::CoordSystem sys, - const char* hdr, const char* fn, - LayerType ll) -{ - FitsImage* img = new FitsImageFitsSMMap(currentContext, interp, - hdr, fn, 1); - loadDone(currentContext->loadMosaic(MMAP, fn, img, type, sys), ll); -} - -void Base::loadMosaicMMapIncrCmd(MosaicType type, Coord::CoordSystem sys, - const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaic(MMAPINCR, fn, img, type, sys), ll); -} - -void Base::loadMosaicShareCmd(MosaicType type, Coord::CoordSystem sys, - ShmType stype, int id, const char* fn, - LayerType ll) -{ - FitsImage* img = new FitsImageFitsShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->loadMosaic(SHARE, fn, img, type, sys), ll); -} - -void Base::loadMosaicSShareCmd(MosaicType type, Coord::CoordSystem sys, - ShmType stype, int hdr, int id, const char* fn, - LayerType ll) -{ - FitsImage* img = new FitsImageFitsSShare(currentContext, interp, - stype, hdr, id, fn, 1); - loadDone(currentContext->loadMosaic(SSHARE, fn, img, type, sys), ll); -} - -void Base::loadMosaicSocketCmd(MosaicType type, Coord::CoordSystem sys, - int s, const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsSocket(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->loadMosaic(SOCKET, fn, img, type, sys), ll); -} - -void Base::loadMosaicSocketGZCmd(MosaicType type, Coord::CoordSystem sys, - int s, const char* fn, LayerType ll) -{ - FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, - s, fn, FitsFile::FLUSH, 1); - loadDone(currentContext->loadMosaic(SOCKETGZ, fn, img, type, sys), ll); -} - -void Base::loadMosaicVarCmd(MosaicType type, Coord::CoordSystem sys, - const char* ch, const char* fn, - LayerType ll) -{ - FitsImage* img = new FitsImageFitsVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->loadMosaic(VAR, fn, img, type, sys), ll); -} - -// *** Mosaic Image WFPC2 *** - -void Base::loadMosaicImageWFPC2AllocCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAlloc(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicWFPC2(ALLOC, fn, img)); -} - -void Base::loadMosaicImageWFPC2AllocGZCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsAllocGZ(currentContext, interp, - ch, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicWFPC2(ALLOCGZ, fn, img)); -} - -void Base::loadMosaicImageWFPC2ChannelCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsChannel(currentContext, interp, - ch, fn, - FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicWFPC2(CHANNEL, fn, img)); -} - -void Base::loadMosaicImageWFPC2MMapCmd(const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMap(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaicWFPC2(MMAP, fn, img)); -} - -void Base::loadMosaicImageWFPC2MMapIncrCmd(const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, - fn, 1); - loadDone(currentContext->loadMosaicWFPC2(MMAPINCR, fn, img)); -} - -void Base::loadMosaicImageWFPC2ShareCmd(ShmType stype, int id, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsShare(currentContext, interp, - stype, id, fn, 1); - loadDone(currentContext->loadMosaicWFPC2(SHARE, fn, img)); -} - -void Base::loadMosaicImageWFPC2SocketCmd(int s, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocket(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicWFPC2(SOCKET, fn, img)); -} - -void Base::loadMosaicImageWFPC2SocketGZCmd(int s, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsSocketGZ(currentContext, interp, - s, fn, FitsFile::NOFLUSH, 1); - loadDone(currentContext->loadMosaicWFPC2(SOCKETGZ, fn, img)); -} - -void Base::loadMosaicImageWFPC2VarCmd(const char* ch, const char* fn) -{ - unloadFits(); - FitsImage* img = new FitsImageFitsVar(currentContext, interp, - ch, fn, 1); - loadDone(currentContext->loadMosaicWFPC2(VAR, fn, img)); -} - -// *** - -void Base::loadDone(int rr, LayerType ll) -{ - loadDone(rr); -} - -void Base::loadDone(int rr) -{ - if (rr) { - alignWCS(); - if (!preservePan) { - centerImage(); - crosshair = cursor; - } - } - else { - reset(); - Tcl_AppendResult(interp, "Unable to load file", NULL); - result = TCL_ERROR; - } - - // adjust current slice if needed - if (currentContext->fits && isCube() && - currentContext->secMode()==FrScale::CROPSEC) { - - // context->slice() IMAGE (ranges 1-n) - // params are in DATA coords, edge to edge - // setSlice() IMAGE (ranges 1-n) - double sl = currentContext->slice(2)-.5; - FitsZBound* zparams = - currentContext->getDataParams(currentContext->secMode()); - double ff = zparams->zmin+.5; - double tt = zparams->zmax-.5; - if (sltt) - setSlice(2,tt+.5); - } - - updateColorScale(); - update(MATRIX); -} - -- cgit v0.12