X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=d40fd5edd988240a2f38ff43d1fda38b4a95f770;hp=d3827f0e41a281b0833a42d1bf755ca3d6dd2d8a;hb=efc398029330f4d9170257db29e4420e50f25625;hpb=739e435359d44546dd812fff8c86b815a214d587 diff --git a/src/views.cpp b/src/views.cpp index d3827f0..d40fd5e 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.cpp,v 1.32 2000/12/20 14:39:09 kevin Exp $ +** $Id: views.cpp,v 1.33 2000/12/20 14:52:30 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 @@ -432,15 +432,17 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) sys_error (ERR_SEVERE, "Internal error: unable to create Plot file"); } else { PlotFile& rPlot = pPlotDoc->getPlotFile(); - rPlot.setTitle("Row Plot"); + std::ostringstream title; + title << "Row " << yCursor; + rPlot.setTitle(title.str()); rPlot.setXLabel("Column"); rPlot.setYLabel("Pixel Value"); rPlot.setCurveSize (2, nx); rPlot.addColumn (0, pX); rPlot.addColumn (1, pY); - delete pX; - delete pY; } + delete pX; + delete pY; } } @@ -460,16 +462,35 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) int ny = rIF.ny(); if (v != NULL && xCursor < nx) { - double* pVec = new double [ny]; + double* pX = new double [ny]; + double* pY = new double [ny]; double minVal = v[xCursor][0]; double maxVal = minVal; for (int i = 0; i < ny; i++) { - if (minVal < v[xCursor][i]) - minVal = v[xCursor][i]; - else if (maxVal > v[xCursor][i]) - maxVal = v[xCursor][i]; - pVec[i] = v[xCursor][i]; + double y = v[xCursor][i]; + if (minVal < y) + minVal = y; + else if (maxVal > y) + maxVal = y; + pX[i] = i; + pY[i] = y; + } + PlotFileDocument* pPlotDoc = dynamic_cast(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT)); + if (! pPlotDoc) { + sys_error (ERR_SEVERE, "Internal error: unable to create Plot file"); + } else { + PlotFile& rPlot = pPlotDoc->getPlotFile(); + std::ostringstream title; + title << "Column " << xCursor; + rPlot.setTitle(title.str()); + rPlot.setXLabel("Row"); + rPlot.setYLabel("Pixel Value"); + rPlot.setCurveSize (2, nx); + rPlot.addColumn (0, pX); + rPlot.addColumn (1, pY); } + delete pX; + delete pY; } }