Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit 82c155ca28
  1. 32
      src/domain/UBGraphicsScene.cpp
  2. 2
      src/domain/UBGraphicsScene.h
  3. 3
      src/tools/UBGraphicsProtractor.cpp

@ -507,9 +507,32 @@ bool UBGraphicsScene::inputDeviceRelease()
} }
UBDrawingController *dc = UBDrawingController::drawingController(); UBDrawingController *dc = UBDrawingController::drawingController();
if (dc->isDrawingTool())
if (dc->isDrawingTool() || mDrawWithCompass)
{ {
if (mCurrentStroke) if(mArcPolygonItem){
if(eDrawingMode_Vector == dc->drawingMode()){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
// Add the arc
mAddedItems.remove(mArcPolygonItem);
removeItem(mArcPolygonItem);
UBCoreGraphicsScene::removeItemFromDeletion(mArcPolygonItem);
pStrokes->addToGroup(mArcPolygonItem);
// Add the center cross
foreach(QGraphicsItem* item, mAddedItems){
removeItem(item);
UBCoreGraphicsScene::removeItemFromDeletion(item);
pStrokes->addToGroup(item);
}
mAddedItems.clear();
mAddedItems << pStrokes;
addItem(pStrokes);
mDrawWithCompass = false;
}
}else if (mCurrentStroke)
{ {
if(eDrawingMode_Vector == dc->drawingMode()){ if(eDrawingMode_Vector == dc->drawingMode()){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup(); UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
@ -525,10 +548,7 @@ bool UBGraphicsScene::inputDeviceRelease()
// TODO LATER : Generate well pressure-interpolated polygons and create the line group with them // TODO LATER : Generate well pressure-interpolated polygons and create the line group with them
mAddedItems.clear(); mAddedItems.clear();
// Add the groupItem in mAddedItem
mAddedItems << pStrokes; mAddedItems << pStrokes;
addItem(pStrokes); addItem(pStrokes);
} }
@ -635,6 +655,7 @@ void UBGraphicsScene::moveTo(const QPointF &pPoint)
mPreviousWidth = -1.0; mPreviousWidth = -1.0;
mPreviousPolygonItems.clear(); mPreviousPolygonItems.clear();
mArcPolygonItem = 0; mArcPolygonItem = 0;
mDrawWithCompass = false;
} }
@ -817,6 +838,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle) void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle)
{ {
mDrawWithCompass = true;
if (mArcPolygonItem) if (mArcPolygonItem)
{ {
mAddedItems.remove(mArcPolygonItem); mAddedItems.remove(mArcPolygonItem);

@ -397,6 +397,8 @@ public slots:
UBZLayerController *mZLayerController; UBZLayerController *mZLayerController;
UBGraphicsPolygonItem* mpLastPolygon; UBGraphicsPolygonItem* mpLastPolygon;
bool mDrawWithCompass;
}; };

@ -79,8 +79,7 @@ void UBGraphicsProtractor::paint(QPainter *painter, const QStyleOptionGraphicsIt
painter->setFont(QFont("Arial")); painter->setFont(QFont("Arial"));
painter->setPen(drawColor()); painter->setPen(drawColor());
painter->setBrush(fillBrush()); painter->setBrush(fillBrush());
painter->drawPie(QRectF(rect().center().x() - radius(), rect().center().y() - radius(), painter->drawPie(QRectF(rect().center().x() - radius(), rect().center().y() - radius(), 2 * radius(), 2 * radius()), mStartAngle * 16, mSpan * 16);
2 * radius(), 2 * radius()), mStartAngle * 16, mSpan * 16);
paintGraduations(painter); paintGraduations(painter);
paintButtons(painter); paintButtons(painter);
paintAngleMarker(painter); paintAngleMarker(painter);

Loading…
Cancel
Save