本文整理汇总了C++中FPointArray::setMarker方法的典型用法代码示例。如果您正苦于以下问题:C++ FPointArray::setMarker方法的具体用法?C++ FPointArray::setMarker怎么用?C++ FPointArray::setMarker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPointArray
的用法示例。
在下文中一共展示了FPointArray::setMarker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawObj_Item
void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
{
if (!m_Doc->RePos && PoLine.size()>=4)
{
if (!m_Doc->layerOutline(LayerNr))
{
if ((fillColor() != CommonStrings::None) || (GrType != 0))
{
FPointArray cli;
FPoint Start;
bool firstp = true;
for (uint n = 0; n < PoLine.size()-3; n += 4)
{
if (firstp)
{
Start = PoLine.point(n);
firstp = false;
}
if (PoLine.point(n).x() > 900000)
{
cli.addPoint(PoLine.point(n-2));
cli.addPoint(PoLine.point(n-2));
cli.addPoint(Start);
cli.addPoint(Start);
cli.setMarker();
firstp = true;
continue;
}
cli.addPoint(PoLine.point(n));
cli.addPoint(PoLine.point(n+1));
cli.addPoint(PoLine.point(n+2));
cli.addPoint(PoLine.point(n+3));
}
if (cli.size() > 2)
{
FPoint l1 = cli.point(cli.size()-2);
cli.addPoint(l1);
cli.addPoint(l1);
cli.addPoint(Start);
cli.addPoint(Start);
}
p->setupPolygon(&cli);
p->fillPath();
}
p->setupPolygon(&PoLine, false);
if (NamedLStyle.isEmpty())
{
if (lineColor() != CommonStrings::None)
p->strokePath();
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
QColor tmp;
for (int it = ml.size()-1; it > -1; it--)
{
if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
{
SetQColor(&tmp, ml[it].Color, ml[it].Shade);
p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
p->strokePath();
}
}
}
}
if (m_startArrowIndex != 0)
{
FPoint Start = PoLine.point(0);
for (uint xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
QMatrix arrowTrans;
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(r);
drawArrow(p, arrowTrans, m_startArrowIndex);
break;
}
}
}
if (m_endArrowIndex != 0)
{
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
QMatrix arrowTrans;
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(r);
drawArrow(p, arrowTrans, m_endArrowIndex);
break;
}
}
}
}
//.........这里部分代码省略.........
示例2: run
bool SubdividePlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
double nearT = 0.5;
uint docSelectionCount = currDoc->m_Selection->count();
if (docSelectionCount != 0)
{
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
FPointArray points;
PageItem *currItem = currDoc->m_Selection->itemAt(aa);
if (currDoc->nodeEdit.isContourLine)
{
uint psize = currItem->ContourLine.size();
for (uint a = 0; a < psize-3; a += 4)
{
if (currItem->ContourLine.point(a).x() > 900000)
{
points.setMarker();
continue;
}
FPoint base = currItem->ContourLine.point(a);
FPoint c1 = currItem->ContourLine.point(a+1);
FPoint base2 = currItem->ContourLine.point(a+2);
FPoint c2 = currItem->ContourLine.point(a+3);
FPoint cn1 = (1.0 - nearT) * base + nearT * c1;
FPoint cn2 = (1.0 - nearT) * cn1 + nearT * ((1.0 - nearT) * c1 + nearT * c2);
FPoint cn3 = (1.0 - nearT) * ((1.0 - nearT) * c1 + nearT * c2) + nearT * ((1.0 - nearT) * c2 + nearT * base2);
FPoint cn4 = (1.0 - nearT) * c2 + nearT * base2;
FPoint bp1 = (1.0 - nearT) * cn2 + nearT * cn3;
if ((base == c1) && (base2 == c2))
{
points.addPoint(base);
points.addPoint(c1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(base2);
points.addPoint(c2);
}
else
{
points.addPoint(base);
points.addPoint(cn1);
points.addPoint(bp1);
points.addPoint(cn2);
points.addPoint(bp1);
points.addPoint(cn3);
points.addPoint(base2);
points.addPoint(cn4);
}
}
currItem->ContourLine = points;
}
else
{
uint psize = currItem->PoLine.size();
for (uint a = 0; a < psize-3; a += 4)
{
if (currItem->PoLine.point(a).x() > 900000)
{
points.setMarker();
continue;
}
FPoint base = currItem->PoLine.point(a);
FPoint c1 = currItem->PoLine.point(a+1);
FPoint base2 = currItem->PoLine.point(a+2);
FPoint c2 = currItem->PoLine.point(a+3);
FPoint cn1 = (1.0 - nearT) * base + nearT * c1;
FPoint cn2 = (1.0 - nearT) * cn1 + nearT * ((1.0 - nearT) * c1 + nearT * c2);
FPoint cn3 = (1.0 - nearT) * ((1.0 - nearT) * c1 + nearT * c2) + nearT * ((1.0 - nearT) * c2 + nearT * base2);
FPoint cn4 = (1.0 - nearT) * c2 + nearT * base2;
FPoint bp1 = (1.0 - nearT) * cn2 + nearT * cn3;
if ((base == c1) && (base2 == c2))
{
points.addPoint(base);
points.addPoint(c1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(base2);
points.addPoint(c2);
}
else
{
points.addPoint(base);
points.addPoint(cn1);
points.addPoint(bp1);
points.addPoint(cn2);
points.addPoint(bp1);
points.addPoint(cn3);
points.addPoint(base2);
points.addPoint(cn4);
}
}
currItem->PoLine = points;
//.........这里部分代码省略.........
示例3: drawControls
void CreateMode::drawControls(QPainter* p)
{
if (!inItemCreation) return;
QPointF topLeft(createObjectPos.x(), createObjectPos.y());
QPointF btRight(canvasCurrCoord.x(), canvasCurrCoord.y());
QColor drawColor = qApp->palette().color(QPalette::Active, QPalette::Highlight);
if (createObjectMode != modeDrawLine)
{
QRectF bounds = QRectF(topLeft, btRight).normalized();
//Lock Height to Width for Control Modifier for region drawing
if (modifiers==Qt::ControlModifier)
{
bounds.setHeight(bounds.width());
if (btRight.y()<topLeft.y())
bounds.moveBottom(topLeft.y());
if (btRight.x()<topLeft.x() && btRight.y()>topLeft.y())
bounds.moveTop(topLeft.y());
}
QRect localRect = m_canvas->canvasToLocal(bounds);
if (localRect.width() <= 0 || localRect.height() <= 0)
return;
p->setRenderHint(QPainter::Antialiasing);
p->save();
p->setPen(QPen(drawColor, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
drawColor.setAlpha(64);
p->setBrush(drawColor);
p->drawRect(localRect);
drawColor.setAlpha(255);
p->setBrush(Qt::NoBrush);
p->setPen(QPen(drawColor, 1, Qt::DashLine, Qt::FlatCap, Qt::MiterJoin));
int frameType = 0, itemType = 0;
getFrameItemTypes(itemType, frameType);
if (frameType == PageItem::Ellipse)
{
p->drawEllipse(localRect);
}
else if (createObjectMode == modeDrawArc)
{
QPainterPath path;
path.moveTo(localRect.width() / 2.0, localRect.height() / 2.0);
path.arcTo(0.0, 0.0, localRect.width(), localRect.height(), m_doc->itemToolPrefs().arcStartAngle, m_doc->itemToolPrefs().arcSweepAngle);
path.closeSubpath();
p->translate(localRect.left(), localRect.top());
p->drawPath(path);
}
else if (createObjectMode == modeDrawRegularPolygon)
{
QPainterPath path = RegularPolygonPath(localRect.width(), localRect.height(), m_doc->itemToolPrefs().polyCorners, m_doc->itemToolPrefs().polyUseFactor, m_doc->itemToolPrefs().polyFactor, m_doc->itemToolPrefs().polyRotation, m_doc->itemToolPrefs().polyCurvature, m_doc->itemToolPrefs().polyInnerRot, m_doc->itemToolPrefs().polyOuterCurvature);
p->translate(localRect.left(), localRect.top());
p->drawPath(path);
}
else if (createObjectMode == modeDrawSpiral)
{
QPainterPath path = SpiralPath(localRect.width(), localRect.height(), m_doc->itemToolPrefs().spiralStartAngle, m_doc->itemToolPrefs().spiralEndAngle, m_doc->itemToolPrefs().spiralFactor);
p->translate(localRect.left(), localRect.top());
p->drawPath(path);
}
else if ((createObjectMode == modeDrawShapes) && (createObjectSubMode > 1))
{
FPointArray poly;
int valCount = m_doc->ValCount;
double *vals = m_doc->ShapeValues;
for (int a = 0; a < valCount-3; a += 4)
{
if (vals[a] < 0)
{
poly.setMarker();
continue;
}
double x1 = localRect.width() * vals[a] / 100.0;
double y1 = localRect.height() * vals[a+1] / 100.0;
double x2 = localRect.width() * vals[a+2] / 100.0;
double y2 = localRect.height() * vals[a+3] / 100.0;
poly.addPoint(x1, y1);
poly.addPoint(x2, y2);
}
QPainterPath path = poly.toQPainterPath(false);
p->translate(localRect.left(), localRect.top());
p->drawPath(path);
}
p->restore();
}
else
{
QPoint p1 = m_canvas->canvasToLocal(topLeft);
QPoint p2 = m_canvas->canvasToLocal(btRight);
p->save();
p->setPen(QPen(drawColor, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
p->setBrush(drawColor);
p->drawLine(p1, p2);
p->restore();
}
}
示例4: DrawObj_Item
void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/)
{
if (!m_Doc->RePos && PoLine.size()>=4)
{
if (!m_Doc->layerOutline(LayerID))
{
if ((fillColor() != CommonStrings::None) || (GrType != 0))
{
FPointArray cli;
FPoint Start;
bool firstp = true;
for (uint n = 0; n < PoLine.size()-3; n += 4)
{
if (firstp)
{
Start = PoLine.point(n);
firstp = false;
}
if (PoLine.point(n).x() > 900000)
{
cli.addPoint(PoLine.point(n-2));
cli.addPoint(PoLine.point(n-2));
cli.addPoint(Start);
cli.addPoint(Start);
cli.setMarker();
firstp = true;
continue;
}
cli.addPoint(PoLine.point(n));
cli.addPoint(PoLine.point(n+1));
cli.addPoint(PoLine.point(n+2));
cli.addPoint(PoLine.point(n+3));
}
if (cli.size() > 2)
{
FPoint l1 = cli.point(cli.size()-2);
cli.addPoint(l1);
cli.addPoint(l1);
cli.addPoint(Start);
cli.addPoint(Start);
}
p->setupPolygon(&cli);
p->fillPath();
}
p->setupPolygon(&PoLine, false);
if (NamedLStyle.isEmpty())
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
if (patternStrokePath)
{
QPainterPath guidePath = PoLine.toQPainterPath(false);
DrawStrokePattern(p, guidePath);
}
else
{
p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
p->strokePath();
}
}
else if (GrTypeStroke > 0)
{
if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
gradientStrokeVal = "";
if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
{
if (lineColor() != CommonStrings::None)
{
p->setBrush(strokeQColor);
p->setStrokeMode(ScPainter::Solid);
}
else
p->setStrokeMode(ScPainter::None);
}
else
{
p->setStrokeMode(ScPainter::Gradient);
p->stroke_gradient = stroke_gradient;
if (GrTypeStroke == 6)
p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
else
p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
}
p->strokePath();
}
else if (lineColor() != CommonStrings::None)
{
p->setStrokeMode(ScPainter::Solid);
p->strokePath();
}
}
else
{
p->setStrokeMode(ScPainter::Solid);
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
QColor tmp;
for (int it = ml.size()-1; it > -1; it--)
//.........这里部分代码省略.........