Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
a289545d
Commit
a289545d
authored
Aug 24, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleared unused code
parent
2e7efcd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
210 deletions
+0
-210
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+0
-210
No files found.
src/domain/UBGraphicsScene.cpp
View file @
a289545d
...
@@ -802,216 +802,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -802,216 +802,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
setModified
(
true
);
setModified
(
true
);
}
}
/*
void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
{
const QLineF line(mPreviousPoint, pEndPoint);
const QPolygonF eraserPolygon = UBGeometryUtils::lineToPolygon(line, pWidth);
const QRectF eraserBoundingRect = eraserPolygon.boundingRect();
const QRectF eraserInnerRect = UBGeometryUtils::lineToInnerRect(line, pWidth);
QPainterPath eraserPathVar;
eraserPathVar.addPolygon(eraserPolygon);
const QPainterPath eraserPath = eraserPathVar;
// Get all the items that are intersecting with the eraser path
QList<QGraphicsItem*> collidItems = items(eraserBoundingRect, Qt::IntersectsItemBoundingRect);
if(eDrawingMode_Vector == UBDrawingController::drawingController()->drawingMode()){
// NOTE: I decided to reuse the 'artistic' eraser all the time in order to have a better eraser
// For this reason, the following code is not used but we will keep it for now, in case of
// futur requirements.
foreach(QGraphicsItem* poly, collidItems){
UBGraphicsStrokesGroup* pGroup = dynamic_cast<UBGraphicsStrokesGroup*>(poly);
if(NULL != pGroup){
// TODO: Ungroup the item, put back the polygons on the scene, deal with the
// eraser's bounding rect, remove the polygons that must be removed
// then create new groups.
// Get all substrokes and verify if they are part of the eraserpath then deal with it
foreach(QGraphicsItem* item, poly->childItems()){
UBGraphicsPolygonItem* polygon = dynamic_cast<UBGraphicsPolygonItem*>(item);
if(NULL != polygon){
if(eraserBoundingRect.intersects(polygon->boundingRect())){
pGroup->removeFromGroup(polygon);
removeItem(polygon);
}
}
}
}
}
}else{
QSet<QGraphicsItem*> toBeAddedItems;
QSet<QGraphicsItem*> toBeRemovedItems;
int collidItemsSize = collidItems.size();
toBeAddedItems.reserve(collidItemsSize);
toBeRemovedItems.reserve(collidItemsSize);
if (mShouldUseOMP)
{
#pragma omp parallel for
for (int i = 0; i < collidItemsSize; i++)
{
UBGraphicsPolygonItem *collidingPolygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(collidItems.at(i));
if(NULL != collidingPolygonItem)
{
UBGraphicsStrokesGroup* pGroup = collidingPolygonItem->strokesGroup();
if(eraserInnerRect.contains(collidingPolygonItem->boundingRect()))
{
#pragma omp critical
// Put the entire polygon into the remove list
toBeRemovedItems << collidingPolygonItem;
}
else
{
// Here we get the polygon of the colliding item
QPolygonF collidingPolygon = collidingPolygonItem->polygon();
QPainterPath collidingPath;
collidingPath.addPolygon(collidingPolygon);
// Then we substract the eraser path to the polygon and we simplify it
QTransform polyTransform = collidingPolygonItem->sceneTransform().inverted();
QPointF mTrPrevPoint = polyTransform.map(mPreviousPoint);
QPointF mTrEndPoint = polyTransform.map(pEndPoint);
const QLineF trLine(mTrPrevPoint, mTrEndPoint);
const QPolygonF trEraserPolygon = UBGeometryUtils::lineToPolygon(trLine, pWidth);
QPainterPath trEraser;
trEraser.addPolygon(trEraserPolygon);
QPainterPath croppedPath = collidingPath.subtracted(trEraser);
// Original
//QPainterPath croppedPath = collidingPath.subtracted(eraserPath);
QPainterPath croppedPathSimplified = croppedPath.simplified();
//if (croppedPath == collidingPath)
//{
// // NOOP
// toBeRemovedItems << collidingPolygonItem;
//}
//else
if (croppedPathSimplified.isEmpty())
{
#pragma omp critical
// Put the entire polygon into the remove list if the eraser removes all its visible content
toBeRemovedItems << collidingPolygonItem;
}
else
{
// Then we convert the remaining path to a list of polygons that will be converted in
// UBGraphicsPolygonItems and added to the scene
foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons())
{
UBGraphicsPolygonItem* croppedPolygonItem;
#pragma omp critical
{
croppedPolygonItem = collidingPolygonItem->deepCopy(pol);
if(NULL != pGroup){
croppedPolygonItem->setStrokesGroup(pGroup);
//pGroup->addToGroup(croppedPolygonItem);
}
// Add this new polygon to the 'added' list
toBeAddedItems << croppedPolygonItem;
}
}
#pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons
toBeRemovedItems << collidingPolygonItem;
}
}
}
}
}
else
{
for (int i = 0; i < collidItemsSize; i++)
{
UBGraphicsPolygonItem *collidingPolygonItem = dynamic_cast<UBGraphicsPolygonItem*> (collidItems.at(i));
if (collidingPolygonItem)
{
UBGraphicsStrokesGroup* pGroup = collidingPolygonItem->strokesGroup();
if(eraserInnerRect.contains(collidingPolygonItem->boundingRect()))
{
toBeRemovedItems << collidingPolygonItem;
}
else
{
QPolygonF collidingPolygon = collidingPolygonItem->polygon();
QPainterPath collidingPath;
collidingPath.addPolygon(collidingPolygon);
QPainterPath croppedPath = collidingPath.subtracted(eraserPath);
QPainterPath croppedPathSimplified = croppedPath.simplified();
if (croppedPath == collidingPath)
{
// NOOP
}
else if (croppedPathSimplified.isEmpty())
{
toBeRemovedItems << collidingPolygonItem;
}
else
{
foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons())
{
UBGraphicsPolygonItem* croppedPolygonItem = collidingPolygonItem->deepCopy(pol);
toBeAddedItems << croppedPolygonItem;
if(NULL != pGroup){
croppedPolygonItem->setStrokesGroup(pGroup);
}
}
toBeRemovedItems << collidingPolygonItem;
}
}
}
}
}
if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){
foreach(QGraphicsItem* item, toBeRemovedItems){
UBGraphicsPolygonItem* poly = dynamic_cast<UBGraphicsPolygonItem*>(item);
if(NULL != poly){
UBGraphicsStrokesGroup* group = poly->strokesGroup();
if(NULL != group){
group->removeFromGroup(poly);
removeItem(poly);
}else{
qDebug() << "No group present";
}
}
}
}else{
removeItems(toBeRemovedItems);
mRemovedItems += toBeRemovedItems;
}
if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){
foreach(QGraphicsItem* item, toBeAddedItems){
UBGraphicsPolygonItem* poly = dynamic_cast<UBGraphicsPolygonItem*>(item);
if(NULL != poly && NULL != poly->strokesGroup()){
poly->setTransform(poly->strokesGroup()->transform());
poly->strokesGroup()->addToGroup(poly);
}
}
}else{
addItems(toBeAddedItems);
mAddedItems += toBeAddedItems;
}
}
mPreviousPoint = pEndPoint;
}
*/
void
UBGraphicsScene
::
drawArcTo
(
const
QPointF
&
pCenterPoint
,
qreal
pSpanAngle
)
void
UBGraphicsScene
::
drawArcTo
(
const
QPointF
&
pCenterPoint
,
qreal
pSpanAngle
)
{
{
mDrawWithCompass
=
true
;
mDrawWithCompass
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment