** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.52 2001/01/06 15:33:15 kevin Exp $
+** $Id: views.cpp,v 1.53 2001/01/07 22:53:36 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
ImageFileArrayConst v = rIF.getArray();
+ ImageFileArrayConst vImag = rIF.getImaginaryArray();
int nx = rIF.nx();
int ny = rIF.ny();
if (v != NULL && yCursor < ny) {
double* pX = new double [nx];
- double* pY = new double [nx];
+ double* pYReal = new double [nx];
+ double *pYImag, *pYMag;
+ if (rIF.isComplex()) {
+ pYImag = new double [nx];
+ pYMag = new double [nx];
+ }
for (int i = 0; i < nx; i++) {
pX[i] = i;
- pY[i] = v[i][yCursor];
+ pYReal[i] = v[i][yCursor];
+ if (rIF.isComplex()) {
+ pYImag[i] = vImag[i][yCursor];
+ pYMag[i] = ::sqrt (v[i][yCursor] * v[i][yCursor] + vImag[i][yCursor] * vImag[i][yCursor]);
+ }
}
PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
if (! pPlotDoc) {
rPlotFile.addEzsetCommand ("lxfrac 0");
rPlotFile.addEzsetCommand ("box");
rPlotFile.addEzsetCommand ("grid");
- rPlotFile.setCurveSize (2, nx);
+ rPlotFile.addEzsetCommand ("curve 1");
+ rPlotFile.addEzsetCommand ("color 1");
+ if (rIF.isComplex()) {
+ rPlotFile.addEzsetCommand ("dash 1");
+ rPlotFile.addEzsetCommand ("curve 2");
+ rPlotFile.addEzsetCommand ("color 4");
+ rPlotFile.addEzsetCommand ("dash 3");
+ rPlotFile.addEzsetCommand ("curve 3");
+ rPlotFile.addEzsetCommand ("color 0");
+ rPlotFile.addEzsetCommand ("solid");
+ rPlotFile.setCurveSize (4, nx);
+ } else
+ rPlotFile.setCurveSize (2, nx);
rPlotFile.addColumn (0, pX);
- rPlotFile.addColumn (1, pY);
+ rPlotFile.addColumn (1, pYReal);
+ if (rIF.isComplex()) {
+ rPlotFile.addColumn (2, pYImag);
+ rPlotFile.addColumn (3, pYMag);
+ }
+ for (int iL = 0; iL < rIF.nLabels(); iL++)
+ rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str());
+ os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
}
delete pX;
- delete pY;
+ delete pYReal;
+ if (rIF.isComplex()) {
+ delete pYImag;
+ delete pYMag;
+ }
if (theApp->getSetModifyNewDocs())
pPlotDoc->Modify(true);
pPlotDoc->UpdateAllViews();
const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
ImageFileArrayConst v = rIF.getArray();
+ ImageFileArrayConst vImag = rIF.getImaginaryArray();
int nx = rIF.nx();
int ny = rIF.ny();
if (v != NULL && xCursor < nx) {
double* pX = new double [ny];
- double* pY = new double [ny];
+ double* pYReal = new double [nx];
+ double *pYImag, *pYMag;
+ if (rIF.isComplex()) {
+ pYImag = new double [nx];
+ pYMag = new double [nx];
+ }
for (int i = 0; i < ny; i++) {
pX[i] = i;
- pY[i] = v[xCursor][i];
+ pYReal[i] = v[xCursor][i];
+ if (rIF.isComplex()) {
+ pYImag[i] = vImag[xCursor][i];
+ pYMag[i] = ::sqrt (v[xCursor][i] * v[xCursor][i] + vImag[xCursor][i] * vImag[xCursor][i]);
+ }
}
PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
if (! pPlotDoc) {
rPlotFile.addEzsetCommand ("lxfrac 0");
rPlotFile.addEzsetCommand ("box");
rPlotFile.addEzsetCommand ("grid");
- rPlotFile.setCurveSize (2, nx);
+ rPlotFile.addEzsetCommand ("curve 1");
+ rPlotFile.addEzsetCommand ("color 1");
+ if (rIF.isComplex()) {
+ rPlotFile.addEzsetCommand ("dash 1");
+ rPlotFile.addEzsetCommand ("curve 2");
+ rPlotFile.addEzsetCommand ("color 4");
+ rPlotFile.addEzsetCommand ("dash 3");
+ rPlotFile.addEzsetCommand ("curve 3");
+ rPlotFile.addEzsetCommand ("color 0");
+ rPlotFile.addEzsetCommand ("solid");
+ rPlotFile.setCurveSize (4, nx);
+ } else
+ rPlotFile.setCurveSize (2, nx);
rPlotFile.addColumn (0, pX);
- rPlotFile.addColumn (1, pY);
+ rPlotFile.addColumn (1, pYReal);
+ if (rIF.isComplex()) {
+ rPlotFile.addColumn (2, pYImag);
+ rPlotFile.addColumn (3, pYMag);
+ }
+ for (int iL = 0; iL < rIF.nLabels(); iL++)
+ rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str());
+ os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
}
delete pX;
- delete pY;
+ delete pYReal;
+ if (rIF.isComplex()) {
+ delete pYImag;
+ delete pYMag;
+ }
if (theApp->getSetModifyNewDocs())
pPlotDoc->Modify(true);
pPlotDoc->UpdateAllViews();
rPlotFile.addEzsetCommand ("lxfrac 0");
rPlotFile.addEzsetCommand ("curve 1");
rPlotFile.addEzsetCommand ("color 1");
- rPlotFile.addEzsetCommand ("curve 2");
- rPlotFile.addEzsetCommand ("color 2");
- rPlotFile.addEzsetCommand ("dash 1");
- rPlotFile.addEzsetCommand ("curve 3");
- rPlotFile.addEzsetCommand ("dash 2");
- rPlotFile.addEzsetCommand ("color 3");
- rPlotFile.addEzsetCommand ("box");
+ rPlotFile.addEzsetCommand ("dash 1");
+ rPlotFile.addEzsetCommand ("curve 2");
+ rPlotFile.addEzsetCommand ("color 4");
+ rPlotFile.addEzsetCommand ("dash 3");
+ rPlotFile.addEzsetCommand ("curve 3");
+ rPlotFile.addEzsetCommand ("color 0");
+ rPlotFile.addEzsetCommand ("solid");
+ rPlotFile.setCurveSize (4, nx);
+ rPlotFile.addEzsetCommand ("box");
rPlotFile.addEzsetCommand ("grid");
- rPlotFile.setCurveSize (2, nx);
+ rPlotFile.setCurveSize (4, nx);
rPlotFile.addColumn (0, pX);
rPlotFile.addColumn (1, pYReal);
rPlotFile.addColumn (2, pYImag);
rPlotFile.addColumn (3, pYMag);
+ for (int iL = 0; iL < rIF.nLabels(); iL++)
+ rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str());
+ os << " FFT Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
}
delete pX;
delete pYReal;
rPlotFile.addColumn (0, pX);
rPlotFile.addColumn (1, pY1);
rPlotFile.addColumn (2, pY2);
+
+ unsigned int iL;
+ for (iL = 0; iL < rIF.nLabels(); iL++) {
+ std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+ s += ": ";
+ s += rIF.labelGet(iL).getLabelString();
+ rPlotFile.addDescription (s.c_str());
+ }
+ for (iL = 0; iL < rIF.nLabels(); iL++) {
+ std::string s = pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+ s += ": ";
+ s += rCompareIF.labelGet(iL).getLabelString();
+ rPlotFile.addDescription (s.c_str());
+ }
+ os << " Between " << GetDocument()->GetFirstView()->GetFrame()->GetTitle() << " and "
+ << pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
}
delete pX;
delete pY1;
rPlotFile.addColumn (0, pX);
rPlotFile.addColumn (1, pY1);
rPlotFile.addColumn (2, pY2);
+ unsigned int iL;
+ for (iL = 0; iL < rIF.nLabels(); iL++) {
+ std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+ s += ": ";
+ s += rIF.labelGet(iL).getLabelString();
+ rPlotFile.addDescription (s.c_str());
+ }
+ for (iL = 0; iL < rIF.nLabels(); iL++) {
+ std::string s = pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+ s += ": ";
+ s += rCompareIF.labelGet(iL).getLabelString();
+ rPlotFile.addDescription (s.c_str());
+ }
+ os << " Between " << GetDocument()->GetFirstView()->GetFrame()->GetTitle() << " and "
+ << pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
}
delete pX;
delete pY1;
rPlotFile.setCurveSize (2, nx);
rPlotFile.addColumn (0, pX);
rPlotFile.addColumn (1, pY);
+ for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) {
+ std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+ s += ": ";
+ s += rIF.labelGet(iL).getLabelString();
+ rPlotFile.addDescription (s.c_str());
+ }
+ os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+ *theApp->getLog() << os.str().c_str() << "\n";
+ rPlotFile.addDescription (os.str().c_str());
delete pX;
delete pY;
if (theApp->getSetModifyNewDocs())
const PlotFile& rPlot = GetDocument()->getPlotFile();
std::ostringstream os;
os << "Columns: " << rPlot.getNumColumns() << ", Records: " << rPlot.getNumRecords() << "\n";
- rPlot.printHeaders (os);
+ rPlot.printHeadersBrief (os);
*theApp->getLog() << os.str().c_str();
wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION);
dialogMsg.ShowModal();