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
0c8154a9
Commit
0c8154a9
authored
Apr 29, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'OEFUniboard' of github.com:stayonshadow/PrivateBoard into OEFUniboard
parents
219089a2
a6ec6d7a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
15 deletions
+75
-15
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+33
-5
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+2
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+39
-9
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+1
-1
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
0c8154a9
...
...
@@ -1181,9 +1181,20 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
// Get the items from the scene
QList
<
QGraphicsItem
*>
items
=
mScene
->
items
();
int
strokes
=
0
;
int
polygons
=
0
;
foreach
(
QGraphicsItem
*
item
,
items
)
{
if
(
item
->
type
()
==
UBGraphicsPolygonItem
::
Type
)
{
polygons
++
;
}
else
if
(
item
->
type
()
==
UBGraphicsStrokesGroup
::
Type
)
{
strokes
++
;
}
}
qDebug
()
<<
"---Strokes count"
<<
strokes
<<
"Polygons count"
<<
polygons
;
qSort
(
items
.
begin
(),
items
.
end
(),
itemZIndexComp
);
UBGraphicsStroke
*
openStroke
=
0
;
int
nextStroke
=
0
;
bool
groupHoldsInfo
=
false
;
...
...
@@ -1192,18 +1203,35 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
QGraphicsItem
*
item
=
items
.
takeFirst
();
// Is the item a strokes group?
UBGraphicsStrokesGroup
*
strokesGroupItem
=
qgraphicsitem_cast
<
UBGraphicsStrokesGroup
*>
(
item
);
if
(
strokesGroupItem
&&
strokesGroupItem
->
isVisible
()){
// Add the polygons
foreach
(
QGraphicsItem
*
item
,
strokesGroupItem
->
childItems
()){
//parsing number of polygons into one polygon
qDebug
()
<<
"parsing stroke number"
<<
nextStroke
++
;
UBGraphicsPolygonItem
*
resultPoly
=
0
;
foreach
(
QGraphicsItem
*
item
,
strokesGroupItem
->
childItems
())
{
UBGraphicsPolygonItem
*
poly
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
){
polygonItemToSvgPolygon
(
poly
,
true
);
if
(
!
poly
)
{
continue
;
}
else
if
(
!
resultPoly
)
{
resultPoly
=
poly
;
continue
;
}
QPolygonF
newPolygon
=
poly
->
sceneTransform
().
map
(
poly
->
polygon
());
QPainterPath
strokePainterPath
;
strokePainterPath
.
addPolygon
(
resultPoly
->
sceneTransform
().
map
(
resultPoly
->
polygon
()));
QPolygonF
oldPolygons
=
strokePainterPath
.
simplified
().
toFillPolygon
(
resultPoly
->
sceneTransform
().
inverted
());
newPolygon
=
oldPolygons
.
united
(
newPolygon
);
resultPoly
->
setPolygon
(
newPolygon
);
//
items
.
removeOne
(
poly
);
}
if
(
resultPoly
)
{
polygonItemToSvgPolygon
(
resultPoly
,
true
);
items
.
removeOne
(
resultPoly
);
}
}
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
0c8154a9
...
...
@@ -208,6 +208,8 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi
if
(
mHasAlpha
&&
scene
()
&&
scene
()
->
isLightBackground
())
painter
->
setCompositionMode
(
QPainter
::
CompositionMode_Darken
);
painter
->
setRenderHints
(
QPainter
::
Antialiasing
);
QGraphicsPolygonItem
::
paint
(
painter
,
option
,
widget
);
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
0c8154a9
...
...
@@ -286,6 +286,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
,
magniferDisplayViewWidget
(
0
)
,
mZLayerController
(
new
UBZLayerController
(
this
))
,
mpLastPolygon
(
NULL
)
,
mCurrentPolygon
(
0
)
{
UBCoreGraphicsScene
::
setObjectName
(
"BoardScene"
);
#ifdef __ppc__
...
...
@@ -597,6 +598,7 @@ bool UBGraphicsScene::inputDeviceRelease()
delete
mCurrentStroke
;
mCurrentStroke
=
0
;
}
mCurrentPolygon
=
0
;
}
}
...
...
@@ -707,7 +709,7 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
if
(
mPreviousWidth
==
-
1.0
)
mPreviousWidth
=
pWidth
;
// UBGraphicsPolygonItem *polygonItem = lineToPolygonItem(QLineF(mPreviousPoint, pEndPoint), pWidth);
// UBGraphicsPolygonItem *polygonItem = lineToPolygonItem(QLineF(mPreviousPoint, pEndPoint), pWidth);
UBGraphicsPolygonItem
*
polygonItem
=
lineToPolygonItem
(
QLineF
(
mPreviousPoint
,
pEndPoint
),
mPreviousWidth
,
pWidth
);
...
...
@@ -723,6 +725,7 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
}
}
if
(
bLineStyle
)
{
QSetIterator
<
QGraphicsItem
*>
itItems
(
mAddedItems
);
...
...
@@ -735,18 +738,45 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
mAddedItems
.
clear
();
}
mpLastPolygon
=
polygonItem
;
mAddedItems
.
insert
(
polygonItem
);
// Here we add the item to the scene
addItem
(
polygonItem
);
if
(
!
mCurrentStroke
)
mCurrentStroke
=
new
UBGraphicsStroke
();
polygonItem
->
setStroke
(
mCurrentStroke
);
mPreviousPolygonItems
.
append
(
polygonItem
);
QPolygonF
newPolygon
=
UBGeometryUtils
::
lineToPolygon
(
QLineF
(
mPreviousPoint
,
pEndPoint
),
pWidth
);
if
(
!
mCurrentPolygon
)
{
mCurrentPolygon
=
new
UBGraphicsPolygonItem
();
mCurrentPolygon
->
setPolygon
(
newPolygon
);
initPolygonItem
(
mCurrentPolygon
);
addItem
(
mCurrentPolygon
);
mAddedItems
.
insert
(
mCurrentPolygon
);
mCurrentPolygon
->
setStroke
(
mCurrentStroke
);
mpLastPolygon
=
mCurrentPolygon
;
}
//newPolygon = newPolygon.united(mCurrentPolygon->polygon());
QPainterPath
strokePainterPath
;
strokePainterPath
.
addPolygon
(
mCurrentPolygon
->
sceneTransform
().
map
(
mCurrentPolygon
->
polygon
()));
//QList<QPolygonF>
QPolygonF
oldPolygons
=
strokePainterPath
.
simplified
().
toFillPolygon
(
mCurrentPolygon
->
sceneTransform
().
inverted
());
newPolygon
=
oldPolygons
.
united
(
newPolygon
);
/* foreach(QPolygonF polygon, oldPolygons)
{
newPolygon = polygon.united(newPolygon);
}
*/
mpLastPolygon
=
mCurrentPolygon
;
mCurrentPolygon
->
setPolygon
(
newPolygon
);
if
(
!
bLineStyle
)
{
...
...
src/domain/UBGraphicsScene.h
View file @
0c8154a9
...
...
@@ -426,7 +426,7 @@ public slots:
UBGraphicsPolygonItem
*
mpLastPolygon
;
bool
mDrawWithCompass
;
UBGraphicsPolygonItem
*
mCurrentPolygon
;
};
...
...
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