我有3分(QPointF)和QgsRubberBand(PolygonGeometry),在其中我添加了这3分。结果如图所示
该三角形具有非常细的白线。我想用颜色填充三角形。我期望setFillColor()方法可以做到,但事实并非如此。我该怎么做才能用给定的颜色填充多边形?
橡皮筋在类构造函数中声明为:
cameraFOV =新的QgsRubberBand(mapCanvas, QgsWkbTypes :: PolygonGeometry);
这是我用来显示三角形的代码:
void MapObject::setFovAngle(double angle){
cameraFOV->reset();
QPointF FOVLeftCorner = QPointF(mapOwnPosition.x() + 5000 * qSin(targetingDirection-angle/2), mapOwnPosition.y() + 5000 * qCos(targetingDirection-angle/2));
QPointF FOVRightCorner = QPointF(mapOwnPosition.x() + 5000 * qSin(targetingDirection+angle/2), mapOwnPosition.y() + 5000 * qCos(targetingDirection+angle/2));
cameraFOV->addPoint(mapOwnPosition);
cameraFOV->addPoint(FOVLeftCorner);
cameraFOV->addPoint(FOVRightCorner);
cameraFOV->closePoints();
cameraFOV->setColor(QColor(255,255,255, 128));
cameraFOV->setFillColor(QColor(0,0,0, 128));
cameraFOV->show();
}
我该怎么做才能用颜色填充三角形?