コード例 #1
0
ファイル: AspFrame.C プロジェクト: timburrow/ovj3
// this FOV should be exactly the same as "ds" or "dconi", so ROIs can be displayed correctly
void AspFrame::setDefaultFOV() {

   cellList->clearList();

   aspMode=false;

   spAspDataInfo_t dataInfo = getDefaultDataInfo(true);
   double vstx = dataInfo->haxis.start;
   double vsty = dataInfo->vaxis.start;
   double vwd = dataInfo->haxis.width;
   double vht = dataInfo->vaxis.width;

   getPlotBox_Pix(&pstx, &psty, &pwd, &pht);
   if(pwd<=0 || pht<=0) {
	pstx=0.0;
	psty=0.0;
	pwd=pixwd;
	pht=pixht;
   }
   // these are dfpnt,dnpnt,dfpnt2,dnpnt2, starting from lower left corner.
   // they need to be converted to upper left corner.
   // i.e. y is reversed. 
   //psty = pixht - (psty+pht);
   psty = mnumypnts - (psty+pht);

   // add 2.0*dispcalib for 1D display (so spectrum is a little above axis).
   if(dataInfo->rank == 1) {
      double dispcalib = (float) (mnumypnts-ymin) / (float) wc2max;
      pht = pht + 2.0*dispcalib;
   }

//Winfoprintf("### pixstx,pixsty,pixwd,pixht %f %f %f %f",pixstx,pixsty,pixwd,pixht);
   // DEBUG
   // AspUtil::drawBox(pixstx, pixsty, pixwd, pixht,2);
   // AspUtil::drawBox(pstx, psty, pwd, pht, 3);

//Winfoprintf("setDefaultFOV %f %f %f %f %f %f %f %f",pstx, psty, pwd, pht, vstx, vsty, vwd, vht);

   // Note, start values vstx,vsty should be upper left, otherwise the axis
   // is reversed, and vwd, vht will be negative. 
   spAspCell_t cell = spAspCell_t(new AspCell(pstx,psty,pwd,pht,vstx,vsty,vwd,vht));
   cell->setAxisNames(dataInfo->haxis.name,dataInfo->vaxis.name);
   cell->setDataInfo(dataInfo);

   cellList->addCell(0,cell); 
}
コード例 #2
0
ファイル: AspFrame.C プロジェクト: timburrow/ovj3
void AspFrame::setCellFOV(int rows, int cols) {
   Wclear(2); // clear graphics window
   Wsetgraphicsdisplay("");
   clearGraphFunc(); // so won't redo ds etc...
   
   if(!aspMode) setFullSize();
   cellList->clearList();

   aspMode=true;

   spAspDataInfo_t dataInfo = getDefaultDataInfo(true);
   double vstx = dataInfo->haxis.start;
   double vsty = dataInfo->vaxis.start;
   double vwd = dataInfo->haxis.width;
   double vht = dataInfo->vaxis.width;

   double mx,my,mw,mh;
   getFOVLimits(mx,my,mw,mh);

   if(pstx < mx) pstx=mx;
   if((pstx+pwd) > (mx+mw)) pwd=(mx+mw)-pstx;;
   if(psty < my) psty=my;
   if((psty+pht) > (my+mh)) pht=(my+mh)-psty;;

/*
// for now, use FOV of ds or dconi
   pstx  = ((double)(mnumxpnts-right_edge)*(wcmax-sc-wc)/wcmax);
   pwd  = ((double)(mnumxpnts-right_edge)*wc/wcmax);
   psty = ((double)(mnumypnts-ymin)*sc2/wc2max)+ymin;
   pht = ((double)(mnumypnts-ymin)*wc2/wc2max);
   psty = mnumypnts - (psty+pht);

   if(axisFlag & AX_SOUTH) {
   } else { 
	pht += ymin; 
   }

   if(pstx < xcharpixels) {
	pwd -= (xcharpixels - pstx);
	pstx = xcharpixels;
   }
   if((axisFlag & AX_WEST)) {
      double west = xcharpixels * 8;
      if (west > pstx && west < pwd) {
                 west = west - pstx;
                 pstx += west;
                 pwd -= west;
      }
   }
   if ((pstx + pwd) > (pixstx+pixwd-xcharpixels)) {
	pwd -= (pstx + pwd -pixstx - pixwd + xcharpixels); 
   }
   if(psty < ycharpixels) {
	pht -= (ycharpixels - psty);
	psty = ycharpixels;
   }
   if((psty + pht) > (pixsty+pixht-2*ycharpixels)) {
        pht -= (psty + pht -pixsty - pixht + 2*ycharpixels);
   }
*/

// divide into rows, cols.
   double wd = pwd/cols;
   double ht = pht/rows;
   int i,j,k;
   for(i=0;i<rows;i++) {
      for(j=0;j<cols;j++) {
        k=1 + i*cols + j;
   	spAspCell_t cell = spAspCell_t(new AspCell(pstx+j*wd,psty+i*ht,wd,ht,vstx,vsty,vwd,vht));
   	cell->setAxisNames(dataInfo->haxis.name,dataInfo->vaxis.name);
	cell->setDataInfo(dataInfo);
   	cellList->addCell(k,cell); 
   // DEBUG
   // 	AspUtil::drawBox(pstx+j*wd,psty+i*ht,wd,ht,3);
      }
   }
}
コード例 #3
0
ファイル: AspCell.C プロジェクト: DanIverson/OpenVnmrJ
#include <limits.h>
#include <float.h>
#include "AspUtil.h"
#include "AspCell.h"
#include "AspCursor.h"
#include "AspDis1D.h"
#include "graphics.h"

extern "C" {
void scale2d(int drawbox, int yoffset, int drawscale, int dcolor);
void set_vscale(int off, double vscale);
void set_vscaleMode(int mode);
void setAspMode(int mode);
}

spAspCell_t nullAspCell = spAspCell_t(NULL);

AspCell::AspCell(double px, double py, double pw, double ph, double vx, double vy, double vw, double vh) {

   pstx=px;
   psty=py;
   pwd=pw;
   pht=ph;
   pwd = (pwd > 0) ? pwd:100.0;
   pht = (pht > 0) ? pht:100.0;

   vstx=vx;
   vsty=vy;
   vwd=vw;
   vht=vh;
   vwd = (vwd != 0) ? vwd:1.0;