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.
134 lines
3.4 KiB
C++
134 lines
3.4 KiB
C++
#include <QPainter>
|
|
|
|
#include <ZxSerializer.h>
|
|
#include "IxPtyPano.h"
|
|
|
|
#include "ZxSubAxisX.h"
|
|
#include "ZxSubAxisY.h"
|
|
|
|
#include "nmObjRoundOutlineTool.h"
|
|
#include "nmObjRoundOutline.h"
|
|
|
|
#include "nmPlotGraphicBinder.h"
|
|
|
|
ZX_DEFINE_DYNAMIC(nObjRoundOutline, nmObjRoundOutline)
|
|
|
|
nmObjRoundOutline::nmObjRoundOutline()
|
|
{
|
|
m_sObjTag = "nObjRoundOutline";
|
|
m_pGraphicBinder = nullptr;
|
|
nmObjRoundOutline::init("", NULL, NULL);
|
|
}
|
|
|
|
nmObjRoundOutline::nmObjRoundOutline(const QString& sName, \
|
|
ZxSubAxisX* pAxisX, \
|
|
ZxSubAxisY* pAxisY)
|
|
{
|
|
m_sObjTag = "nObjRoundOutline";
|
|
m_pGraphicBinder = nullptr;
|
|
nmObjRoundOutline::init(sName, pAxisX, pAxisY);
|
|
}
|
|
|
|
nmObjRoundOutline::~nmObjRoundOutline()
|
|
{
|
|
}
|
|
|
|
void nmObjRoundOutline::init(const QString& sName, \
|
|
ZxSubAxisX* pAxisX, \
|
|
ZxSubAxisY* pAxisY)
|
|
{
|
|
nmObjRound::init(sName, pAxisX, pAxisY);
|
|
m_pGraphicBinder = nullptr;
|
|
}
|
|
|
|
void nmObjRoundOutline::initTools()
|
|
{
|
|
m_pTool = new nmObjRoundOutlineTool();
|
|
nmObjBase::initTools();
|
|
}
|
|
|
|
bool nmObjRoundOutline::hitTest(const QPointF& pt)
|
|
{
|
|
return nmObjRound::hitTest(pt);
|
|
}
|
|
|
|
bool nmObjRoundOutline::_runHitTest(const QPointF& pt, int& nOption, int& nSubIndex)
|
|
{
|
|
return nmObjRound::_runHitTest(pt, nOption, nSubIndex);
|
|
}
|
|
|
|
void nmObjRoundOutline::fillPtyPano(IxPtyPano* sheet)
|
|
{
|
|
nmObjRound::fillPtyPano(sheet);
|
|
IxPtyItem* pProp = ZX_PROP("ObjPolygonOutline.Type", getCurOutlineFlowType, setCurOutlineFlowType);
|
|
if (NULL != pProp) {
|
|
QStringList listTags;
|
|
listTags << tr("No Flow") << tr("Constant Pressure");
|
|
QList<QVariant> listIndexes;
|
|
listIndexes << 0 << 1 << 2;
|
|
pProp->getPtyPano();
|
|
pProp->setOptions(listTags, listIndexes);
|
|
}
|
|
}
|
|
|
|
void nmObjRoundOutline::setAllPos(QVector<QPointF> vecPoss, QVector<int> *pVecIndexes)
|
|
{
|
|
nmObjRound::setAllPos(vecPoss, pVecIndexes);
|
|
|
|
if (m_vFlowTypeList.count() < 1)
|
|
{
|
|
m_vFlowTypeList.append(NM_OIL_RESERVOIR_OUTLINE_TYPE::OIL_Reservoir_Outline_No_Flow);
|
|
}
|
|
|
|
emit sigOutlinePointsChanged();
|
|
}
|
|
|
|
void nmObjRoundOutline::paintBack(QPainter* painter, const ZxPaintParam& param)
|
|
{
|
|
Q_UNUSED(param);
|
|
// 保留内部命中时的绿色轮廓,控制点由基类在轮廓上方统一绘制。
|
|
const QPen selectionPen = m_oHitOption == OHO_Inner
|
|
? QPen(QBrush(Qt::green), 0.0, Qt::SolidLine)
|
|
: QPen(QBrush(Qt::black), 0.0, Qt::DotLine);
|
|
painter->save();
|
|
painter->setClipRect(getOuterRect(), Qt::IntersectClip);
|
|
paintCircle(painter, selectionPen);
|
|
painter->restore();
|
|
|
|
// 名称和样式仍由 Binder 同步,绘制不修改几何数据。
|
|
if (m_pGraphicBinder) {
|
|
m_pGraphicBinder->syncOutlineName(this);
|
|
m_pGraphicBinder->syncOutlineVisual(this);
|
|
}
|
|
}
|
|
|
|
void nmObjRoundOutline::setCurOutlineFlowType(int flowType)
|
|
{
|
|
if (m_oHitOption == OHO_Point || m_oHitOption == OHO_Bound || m_oHitOption == OHO_Inner) {
|
|
if (m_vFlowTypeList.isEmpty()) {
|
|
m_vFlowTypeList.append(flowType);
|
|
} else {
|
|
m_vFlowTypeList[0] = flowType;
|
|
}
|
|
emit sigOutlineFlowTypeChanged();
|
|
}
|
|
}
|
|
|
|
int nmObjRoundOutline::getCurOutlineFlowType()
|
|
{
|
|
// 旧成果可能没有类型记录,沿用新建边界的默认封闭类型。
|
|
return m_vFlowTypeList.value(0, NM_OIL_RESERVOIR_OUTLINE_TYPE::OIL_Reservoir_Outline_No_Flow);
|
|
}
|
|
|
|
void nmObjRoundOutline::afterCreated() {
|
|
if (m_pGraphicBinder) {
|
|
m_pGraphicBinder->createOutlineForGraphic(this);
|
|
}
|
|
}
|
|
|
|
void nmObjRoundOutline::removeData() {
|
|
if (m_pGraphicBinder) {
|
|
m_pGraphicBinder->removeOutlineBinding(this);
|
|
}
|
|
}
|