You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.1 KiB
C++
111 lines
2.1 KiB
C++
|
|
#include <QMessageBox>
|
|
#include <QFileDialog>
|
|
#include "ZxBaseUtil.h"
|
|
#include "ZxPlot.h"
|
|
#include "ZxSubAxisX.h"
|
|
#include "ZxSubAxisY.h"
|
|
|
|
#include "ZxSubTitle.h"
|
|
#include "ZxSubLegend.h"
|
|
|
|
#include "ZxObjCurveBase.h"
|
|
#include "ZxCmdTool.h"
|
|
|
|
#include "nmPlotScene.h"
|
|
|
|
ZX_DEFINE_DYNAMIC(mPlotScene, nmPlotScene)
|
|
|
|
nmPlotScene::nmPlotScene()
|
|
{
|
|
}
|
|
|
|
void nmPlotScene::init(ZxRenderView* pView, QString sTitle,
|
|
QSize szDefault /*= QSize(265, 203)*/)
|
|
{
|
|
initMembers(pView, sTitle);
|
|
resetLayouts(szDefault);
|
|
}
|
|
|
|
void nmPlotScene::initMembers(ZxRenderView* pView, QString sTitle)
|
|
{
|
|
// ObjName
|
|
setObjectName(getTagName());
|
|
|
|
// Plot
|
|
if (NULL != m_pPlot)
|
|
{
|
|
this->getMainLayer()->remove(m_pPlot);
|
|
}
|
|
|
|
m_pPlot = new ZxPlot(pView);
|
|
Q_ASSERT (NULL != m_pPlot);
|
|
|
|
m_pPlot->setNeedLayout(false);
|
|
m_pPlot->setLegendVisible(false);
|
|
m_pPlot->setTitleVisible(false);
|
|
m_pPlot->getTitle()->setName(sTitle);
|
|
|
|
this->getMainLayer()->append(m_pPlot);
|
|
}
|
|
|
|
void nmPlotScene::freshToPlot(ZxPlot* pPlot, ZxRenderView* pView)
|
|
{
|
|
if (NULL == pPlot)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// Important
|
|
pPlot->bindSubMembers(pView);
|
|
|
|
QRectF rtBound = getBounds();
|
|
|
|
if (NULL != m_pPlot)
|
|
{
|
|
this->getMainLayer()->remove(m_pPlot);
|
|
m_pPlot->removeTools();
|
|
m_pPlot = NULL;
|
|
}
|
|
|
|
m_pPlot = pPlot;
|
|
|
|
m_pTheOnlyOwnerView = pView;
|
|
|
|
m_pPlot->setParent(NULL);
|
|
this->getMainLayer()->append(m_pPlot);
|
|
|
|
setBoundEx(rtBound.left(), rtBound.top(), \
|
|
rtBound.width(), rtBound.height());
|
|
}
|
|
|
|
void nmPlotScene::resetLayouts(QSize sz)
|
|
{
|
|
tCurvePlotScene::resetLayouts(sz);
|
|
}
|
|
|
|
void nmPlotScene::setBoundEx(int l, int t, int w, int h)
|
|
{
|
|
tCurvePlotScene::setBoundEx(l, t, w, h);
|
|
}
|
|
|
|
void nmPlotScene::onSerialize(ZxSerializer* ser)
|
|
{
|
|
tCurvePlotScene::onSerialize(ser);
|
|
|
|
ser->write("nmScenePlot", m_pPlot);
|
|
}
|
|
|
|
void nmPlotScene::onDeserialize(ZxSerializer* ser)
|
|
{
|
|
tCurvePlotScene::onDeserialize(ser);
|
|
|
|
m_pPlot = NULL;
|
|
ser->read("nmScenePlot", m_pPlot);
|
|
}
|
|
|
|
void nmPlotScene::onDeserialized()
|
|
{
|
|
|
|
}
|