本文整理汇总了C++中MultiLayer::activeGraph方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiLayer::activeGraph方法的具体用法?C++ MultiLayer::activeGraph怎么用?C++ MultiLayer::activeGraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiLayer
的用法示例。
在下文中一共展示了MultiLayer::activeGraph方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addResultCurve
void Correlation::addResultCurve()
{
int cols = d_table->tableCols();
int cols2 = cols+1;
d_table->addCol();
d_table->addCol();
int n = d_table->tableRows()/2;
for (int i = 0; i<d_table->tableRows(); i++)
{
double y = 0;
if(i < n)
y = d_x[d_n - n + i];
else
y = d_x[i-n];
d_table->setText(i, cols, QString::number(i - n));
d_table->setText(i, cols2, QString::number(y));
}
QStringList l = d_table->colNames().grep(tr("Lag"));
QString id = QString::number((int)l.size()+1);
QString label = name() + id;
d_table->setColName(cols, tr("Lag") + id);
d_table->setColName(cols2, label);
d_table->setColPlotDesignation(cols, Table::X);
d_table->setHeaderColType();
ApplicationWindow *app = (ApplicationWindow *)parent();
MultiLayer *ml = app->newGraph(name() + tr("Plot"));
ml->activeGraph()->insertCurve(d_table, d_table->name() + "_" + label, 0);
}
示例2: output
void FFT::output(QList<Column *> columns) {
ApplicationWindow *app = (ApplicationWindow *)parent();
QString tableName = app->generateUniqueName(objectName());
Table *t = app->newHiddenTable(tableName, d_explanation, columns);
MultiLayer *ml = app->multilayerPlot(
t, QStringList() << tableName + "_" + tr("Amplitude"), 0);
if (!ml) return;
Graph *g = ml->activeGraph();
if (g) {
g->setCurvePen(0, QPen(ColorBox::color(d_curveColorIndex), 1));
Plot *plot = g->plotWidget();
plot->setTitle(QString());
if (!d_inverse)
plot->setAxisTitle(QwtPlot::xBottom,
tr("Frequency") + " (" + tr("Hz") + ")");
else
plot->setAxisTitle(QwtPlot::xBottom, tr("Time") + +" (" + tr("s") + ")");
plot->setAxisTitle(QwtPlot::yLeft, tr("Amplitude"));
plot->replot();
}
ml->showMaximized();
}
示例3: addResultCurve
void Correlation::addResultCurve()
{
ApplicationWindow *app = (ApplicationWindow *)parent();
if (!app)
return;
int rows = d_table->numRows();
int cols = d_table->numCols();
int cols2 = cols+1;
d_table->addCol();
d_table->addCol();
int n = rows/2;
double x_temp[rows], y_temp[rows];
for (int i = 0; i<rows; i++)
{
x_temp[i] = i - n;
if(i < n)
y_temp[i] = d_x[d_n - n + i];
else
y_temp[i] = d_x[i-n];
d_table->column(cols)->setValueAt(i, x_temp[i]);
d_table->column(cols2)->setValueAt(i, y_temp[i]);
}
QStringList l = d_table->colNames().grep(tr("Lag"));
QString id = QString::number((int)l.size()+1);
QString label = name() + id;
d_table->setColName(cols, tr("Lag") + id);
d_table->setColName(cols2, label);
d_table->setColPlotDesignation(cols, SciDAVis::X);
MultiLayer *ml = app->newGraph(name() + tr("Plot"));
if (!ml)
return;
DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2));
c->setData(x_temp, y_temp, rows);
c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1));
ml->activeGraph()->insertPlotItem(c, Graph::Line);
ml->activeGraph()->updatePlot();
}
示例4: logic_error
MultiLayer * Filter::createOutputGraph()
{
ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(this->parent());
if (!app) {
throw std::logic_error("Parent of Filter is not ApplicationWindow as expected.");
}
MultiLayer *ml = app->newGraph(objectName() + tr("Plot"));
d_output_graph = ml->activeGraph();
return ml;
}
示例5: applicationWindow
/** Creates a MultiLayer graph and plots this MantidMatrix as a Spectrogram.
@param type :: The "curve" type.
@return Pointer to the created graph.
*/
MultiLayer *MantidMatrix::plotGraph2D(Graph::CurveType type) {
if (numRows() == 1) {
QMessageBox::critical(0, "MantidPlot - Error",
"Cannot plot a workspace with only one spectrum.");
return NULL;
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
ApplicationWindow *a = applicationWindow();
MultiLayer *g = a->multilayerPlot(a->generateUniqueName(tr("Graph")));
attachMultilayer(g);
//#799 fix for multiple dialog creation on double clicking/ on right click
// menu scale on 2d plot
// a->connectMultilayerPlot(g);
Graph *plot = g->activeGraph();
plotSpectrogram(plot, a, type, false, NULL);
// g->confirmClose(false);
QApplication::restoreOverrideCursor();
return g;
}
示例6: output
void FFT::output(const QString &text)
{
ApplicationWindow *app = (ApplicationWindow *)parent();
QString tableName = app->generateUniqueName(QString(name()));
Table *t = app->newHiddenTable(tableName, d_explanation, d_n, 5, text);
MultiLayer *ml = app->multilayerPlot(t, QStringList() << tableName + "_" + tr("Amplitude"), 0);
if (!ml)
return;
Graph* g = ml->activeGraph();
if ( g )
{
Plot* plot = g->plotWidget();
plot->setTitle(QString());
if (!d_inverse)
plot->setAxisTitle(QwtPlot::xBottom, tr("Frequency") + " (" + tr("Hz") + ")");
else
plot->setAxisTitle(QwtPlot::xBottom, tr("Time") + + " (" + tr("s") + ")");
plot->setAxisTitle(QwtPlot::yLeft, tr("Amplitude"));
plot->replot();
}
ml->showMaximized();
}
示例7: tr
MultiLayer * Filter::createOutputGraph()
{
MultiLayer *ml = ((ApplicationWindow *)parent())->newGraph(objectName() + tr("Plot"));
d_output_graph = ml->activeGraph();
return ml;
}
示例8: calculateLineProfile
void LineProfileTool::calculateLineProfile(const QPoint& start, const QPoint& end)
{
QRect rect = d_target->rect();
if (!rect.contains(start) || !rect.contains(end)){
QMessageBox::warning(d_graph, tr("QtiPlot - Pixel selection warning"),
tr("Please select the end line point inside the image rectangle!"));
return;
}
QPoint o = d_target->origin();
QPixmap pic = d_target->pixmap();
QImage image = pic.convertToImage();
int x1 = start.x()-o.x();
int x2 = end.x()-o.x();
int y1 = start.y()-o.y();
int y2 = end.y()-o.y();
QSize realSize = pic.size();
QSize actualSize = d_target->size();
if (realSize != actualSize){
double ratioX = (double)realSize.width()/(double)actualSize.width();
double ratioY = (double)realSize.height()/(double)actualSize.height();
x1 = int(x1*ratioX);
x2 = int(x2*ratioX);
y1 = int(y1*ratioY);
y2 = int(y2*ratioY);
}
QString text = tr("pixel") + "\tx\ty\t" + tr("intensity") + "\n";
//uses the fast Bresenham's line-drawing algorithm
#define sgn(x) ((x<0)?-1:((x>0)?1:0))
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py,n;
dx=x2-x1; //the horizontal distance of the line
dy=y2-y1; //the vertical distance of the line
dxabs=abs(dx);
dyabs=abs(dy);
sdx=sgn(dx);
sdy=sgn(dy);
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
if (dxabs>=dyabs){ //the line is more horizontal than vertical
for(i=0;i<dxabs;i++){
y+=dyabs;
if (y>=dxabs){
y-=dxabs;
py+=sdy;
}
px+=sdx;
n=dxabs;
text+=QString::number(i)+"\t";
text+=QString::number(px)+"\t";
text+=QString::number(py)+"\t";
text+=QString::number(averageImagePixel(image, px, py, true))+"\n";
}
} else {// the line is more vertical than horizontal
for(i=0;i<dyabs;i++){
x+=dxabs;
if (x>=dyabs){
x-=dyabs;
px+=sdx;
}
py+=sdy;
n=dyabs;
text+=QString::number(i)+"\t";
text+=QString::number(px)+"\t";
text+=QString::number(py)+"\t";
text+=QString::number(averageImagePixel(image, px, py, false))+"\n";
}
}
Table *t = d_app->newTable(tr("Table") + "1", n, 4, text);
MultiLayer* plot = d_app->multilayerPlot(t, QStringList(QString(t->objectName())+"_intensity"), 0);
Graph *g = (Graph*)plot->activeGraph();
if (g){
g->setTitle("");
g->setXAxisTitle(tr("pixels"));
g->setYAxisTitle(tr("pixel intensity (a.u.)"));
}
}