|
|
|
|
|
#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)
|
|
|
|
|
|
{
|
|
|
|
|
|
nmObjRound::paintBack(painter, param);
|
|
|
|
|
|
|
|
|
|
|
|
if (m_vecPoints[1].x() != m_vecPoints[1].y())
|
|
|
|
|
|
{
|
|
|
|
|
|
double radius = qAbs(m_vecPoints[0].y() - m_vecPoints[2].y());
|
|
|
|
|
|
m_vecPoints[1] = QPointF(radius, radius);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QVector<QPointF> pts = getPosOf(m_vecPoints);
|
|
|
|
|
|
|
|
|
|
|
|
if (pts[1].x() != pts[1].y())
|
|
|
|
|
|
{
|
|
|
|
|
|
double radius = qAbs(pts[0].y() - pts[2].y());
|
|
|
|
|
|
pts[1] = QPointF(radius, radius);
|
|
|
|
|
|
|
|
|
|
|
|
QPointF center = pts[0];
|
|
|
|
|
|
pts[2] = QPointF(center.x(), center.y() - radius);
|
|
|
|
|
|
pts[3] = QPointF(center.x() + radius, center.y());
|
|
|
|
|
|
pts[4] = QPointF(center.x(), center.y() + radius);
|
|
|
|
|
|
pts[5] = QPointF(center.x() - radius, center.y());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 名称同步:setName 不发信号,在绘制时通过 Binder 同步到数据中心
|
|
|
|
|
|
if (m_pGraphicBinder) {
|
|
|
|
|
|
m_pGraphicBinder->syncOutlineName(this);
|
|
|
|
|
|
m_pGraphicBinder->syncOutlineVisual(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isSelected()) {
|
|
|
|
|
|
QPen pen(QBrush(Qt::black), 0.0f, Qt::DotLine);
|
|
|
|
|
|
painter->setPen(pen);
|
|
|
|
|
|
painter->drawEllipse(pts[0], pts[1].x(), pts[1].y());
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 2; i < pts.count(); i++) {
|
|
|
|
|
|
float w = 2.2f;
|
|
|
|
|
|
QPointF pt = pts[i];
|
|
|
|
|
|
QRectF rect(pt.x() - w * 0.5f, pt.y() - w * 0.5f, w, w);
|
|
|
|
|
|
painter->setPen(QColor(0, 0, 128));
|
|
|
|
|
|
painter->drawRect(rect);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_oHitOption == OHO_Inner) {
|
|
|
|
|
|
QPen pen;
|
|
|
|
|
|
pen.setWidth(1);
|
|
|
|
|
|
pen.setColor(Qt::green);
|
|
|
|
|
|
painter->setPen(pen);
|
|
|
|
|
|
painter->drawEllipse(pts[0], pts[1].x(), pts[1].y());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
painter->restore();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmObjRoundOutline::setCurOutlineFlowType(int flowType)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_oHitOption == OHO_Point || m_oHitOption == OHO_Bound || m_oHitOption == OHO_Inner) {
|
|
|
|
|
|
m_vFlowTypeList[0] = flowType;
|
|
|
|
|
|
emit sigOutlineFlowTypeChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int nmObjRoundOutline::getCurOutlineFlowType()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_vFlowTypeList[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmObjRoundOutline::afterCreated() {
|
|
|
|
|
|
if (m_pGraphicBinder) {
|
|
|
|
|
|
m_pGraphicBinder->createOutlineForGraphic(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmObjRoundOutline::removeData() {
|
|
|
|
|
|
if (m_pGraphicBinder) {
|
|
|
|
|
|
m_pGraphicBinder->removeOutlineBinding(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|