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
26f96b76
Commit
26f96b76
authored
May 14, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zvalue for strokes handled correctly
parent
849ed076
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
53 deletions
+59
-53
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+10
-3
UBGraphicsItemTransformUndoCommand.cpp
src/domain/UBGraphicsItemTransformUndoCommand.cpp
+0
-3
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+47
-45
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+1
-0
UBThumbnailWidget.h
src/gui/UBThumbnailWidget.h
+1
-2
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
26f96b76
...
...
@@ -571,12 +571,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mStrokesList
.
insert
(
parentId
,
group
);
currentStroke
=
new
UBGraphicsStroke
();
group
->
setTransform
(
polygonItem
->
transform
());
UBGraphicsItem
::
assignZValue
(
group
,
zFromSvg
);
}
else
group
=
mStrokesList
.
value
(
parentId
);
if
(
polygonItem
->
transform
().
isIdentity
())
polygonItem
->
setTransform
(
group
->
transform
());
group
->
addToGroup
(
polygonItem
);
polygonItem
->
setStrokesGroup
(
group
);
polygonItem
->
setStroke
(
currentStroke
);
...
...
@@ -602,12 +604,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
mStrokesList
.
insert
(
parentId
,
group
);
currentStroke
=
new
UBGraphicsStroke
();
group
->
setTransform
(
polygonItem
->
transform
());
UBGraphicsItem
::
assignZValue
(
group
,
zFromSvg
);
}
else
group
=
mStrokesList
.
value
(
parentId
);
if
(
polygonItem
->
transform
().
isIdentity
())
polygonItem
->
setTransform
(
group
->
transform
());
group
->
addToGroup
(
polygonItem
);
polygonItem
->
setStrokesGroup
(
group
);
polygonItem
->
setStroke
(
currentStroke
);
...
...
@@ -990,10 +994,13 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
qDebug
()
<<
"Number of detected strokes: "
<<
mStrokesList
.
count
();
QHashIterator
<
QString
,
UBGraphicsStrokesGroup
*>
iterator
(
mStrokesList
);
qreal
zValue
=
0
;
while
(
iterator
.
hasNext
())
{
iterator
.
next
();
zValue
=
iterator
.
value
()
->
zValue
();
qDebug
()
<<
"Number of polygons : "
<<
(
int
)(((
UBGraphicsStrokesGroup
*
)
iterator
.
value
())
->
childItems
().
count
());
mScene
->
addItem
(
iterator
.
value
());
iterator
.
value
()
->
setZValue
(
zValue
);
}
if
(
mScene
)
...
...
@@ -1229,12 +1236,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
items
.
removeOne
(
poly
);
}
if
(
resultPoly
)
{
resultPoly
->
setZValue
(
strokesGroupItem
->
zValue
());
//Claudio: the painter path simplification remove all the polygons overlap
QPainterPath
painterPath
;
painterPath
.
addPolygon
(
resultPoly
->
polygon
());
painterPath
=
painterPath
.
simplified
();
resultPoly
->
setPolygon
(
painterPath
.
toFillPolygon
());
polygonItemToSvgPolygon
(
resultPoly
,
tru
e
);
polygonItemToSvgPolygon
(
resultPoly
,
fals
e
);
items
.
removeOne
(
resultPoly
);
}
}
...
...
@@ -1701,8 +1709,7 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
if
(
!
svgPoints
.
isNull
())
{
QStringList
ts
=
svgPoints
.
toString
().
split
(
QLatin1Char
(
' '
),
QString
::
SkipEmptyParts
);
QStringList
ts
=
svgPoints
.
toString
().
split
(
QLatin1Char
(
' '
),
QString
::
SkipEmptyParts
);
foreach
(
const
QString
sPoint
,
ts
)
{
...
...
src/domain/UBGraphicsItemTransformUndoCommand.cpp
View file @
26f96b76
...
...
@@ -58,7 +58,6 @@ void UBGraphicsItemTransformUndoCommand::undo()
mItem
->
setPos
(
mPreviousPosition
);
mItem
->
setTransform
(
mPreviousTransform
);
mItem
->
setZValue
(
mPreviousZValue
);
// UBGraphicsItem::assignZValue(mItem, mPreviousZValue);
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
mItem
);
...
...
@@ -72,8 +71,6 @@ void UBGraphicsItemTransformUndoCommand::redo()
mItem
->
setTransform
(
mCurrentTransform
);
mItem
->
setZValue
(
mCurrentZValue
);
// UBGraphicsItem::assignZValue(mItem, /*mCurrentZValue*/mItem->data(UBGraphicsItemData::ItemOwnZValue).toReal());
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
mItem
);
if
(
resizableItem
)
...
...
src/domain/UBGraphicsScene.cpp
View file @
26f96b76
...
...
@@ -80,17 +80,17 @@ UBZLayerController::UBZLayerController(QGraphicsScene *scene) :
{
scopeMap
.
insert
(
itemLayerType
::
NoLayer
,
ItemLayerTypeData
(
errorNumber
,
errorNumber
));
scopeMap
.
insert
(
itemLayerType
::
BackgroundItem
,
ItemLayerTypeData
(
-
1000000
0.0
,
-
10
000000.0
));
scopeMap
.
insert
(
itemLayerType
::
ObjectItem
,
ItemLayerTypeData
(
-
1000000
0
.0
,
0.0
));
scopeMap
.
insert
(
itemLayerType
::
DrawingItem
,
ItemLayerTypeData
(
0.0
,
10
000000.0
));
scopeMap
.
insert
(
itemLayerType
::
ToolItem
,
ItemLayerTypeData
(
1000000
0.0
,
10
000100.0
));
scopeMap
.
insert
(
itemLayerType
::
CppTool
,
ItemLayerTypeData
(
1000
0100.0
,
10
000200.0
));
scopeMap
.
insert
(
itemLayerType
::
Curtain
,
ItemLayerTypeData
(
1000
0200.0
,
10
001000.0
));
scopeMap
.
insert
(
itemLayerType
::
Eraiser
,
ItemLayerTypeData
(
100
01000.0
,
10
001100.0
));
scopeMap
.
insert
(
itemLayerType
::
Pointer
,
ItemLayerTypeData
(
100
01100.0
,
10
001200.0
));
scopeMap
.
insert
(
itemLayerType
::
Cache
,
ItemLayerTypeData
(
100
01300.0
,
10
001400.0
));
scopeMap
.
insert
(
itemLayerType
::
BackgroundItem
,
ItemLayerTypeData
(
-
1000000
.0
,
-
1
000000.0
));
scopeMap
.
insert
(
itemLayerType
::
ObjectItem
,
ItemLayerTypeData
(
-
1000000.0
,
0.0
));
scopeMap
.
insert
(
itemLayerType
::
DrawingItem
,
ItemLayerTypeData
(
0.0
,
1
000000.0
));
scopeMap
.
insert
(
itemLayerType
::
ToolItem
,
ItemLayerTypeData
(
1000000
.0
,
1
000100.0
));
scopeMap
.
insert
(
itemLayerType
::
CppTool
,
ItemLayerTypeData
(
1000
100.0
,
1
000200.0
));
scopeMap
.
insert
(
itemLayerType
::
Curtain
,
ItemLayerTypeData
(
1000
200.0
,
1
001000.0
));
scopeMap
.
insert
(
itemLayerType
::
Eraiser
,
ItemLayerTypeData
(
100
1000.0
,
1
001100.0
));
scopeMap
.
insert
(
itemLayerType
::
Pointer
,
ItemLayerTypeData
(
100
1100.0
,
1
001200.0
));
scopeMap
.
insert
(
itemLayerType
::
Cache
,
ItemLayerTypeData
(
100
1300.0
,
1
001400.0
));
scopeMap
.
insert
(
itemLayerType
::
SelectedItem
,
ItemLayerTypeData
(
100
01000.0
,
10
001000.0
));
scopeMap
.
insert
(
itemLayerType
::
SelectedItem
,
ItemLayerTypeData
(
100
1000.0
,
1
001000.0
));
}
qreal
UBZLayerController
::
generateZLevel
(
itemLayerType
::
Enum
key
)
...
...
@@ -547,47 +547,47 @@ bool UBGraphicsScene::inputDeviceRelease()
{
if
(
mArcPolygonItem
){
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
// Add the arc
mAddedItems
.
remove
(
mArcPolygonItem
);
removeItem
(
mArcPolygonItem
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
mArcPolygonItem
);
// Add the arc
mAddedItems
.
remove
(
mArcPolygonItem
);
removeItem
(
mArcPolygonItem
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
mArcPolygonItem
);
mArcPolygonItem
->
setStrokesGroup
(
pStrokes
);
pStrokes
->
addToGroup
(
mArcPolygonItem
);
// Add the center cross
foreach
(
QGraphicsItem
*
item
,
mAddedItems
){
mAddedItems
.
remove
(
item
);
removeItem
(
item
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
item
);
mArcPolygonItem
->
setStrokesGroup
(
pStrokes
);
pStrokes
->
addToGroup
(
mArcPolygonItem
);
// Add the center cross
foreach
(
QGraphicsItem
*
item
,
mAddedItems
){
mAddedItems
.
remove
(
item
);
removeItem
(
item
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
item
);
mArcPolygonItem
->
setStrokesGroup
(
pStrokes
);
pStrokes
->
addToGroup
(
item
);
}
pStrokes
->
addToGroup
(
item
);
}
mAddedItems
.
clear
();
mAddedItems
<<
pStrokes
;
addItem
(
pStrokes
);
mDrawWithCompass
=
false
;
mAddedItems
.
clear
();
mAddedItems
<<
pStrokes
;
addItem
(
pStrokes
);
mDrawWithCompass
=
false
;
}
else
if
(
mCurrentStroke
){
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
// Remove the strokes that were just drawn here and replace them by a stroke item
foreach
(
UBGraphicsPolygonItem
*
poly
,
mCurrentStroke
->
polygons
()){
mPreviousPolygonItems
.
removeAll
(
poly
);
removeItem
(
poly
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
poly
);
poly
->
setStrokesGroup
(
pStrokes
);
pStrokes
->
addToGroup
(
poly
);
}
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
// Remove the strokes that were just drawn here and replace them by a stroke item
foreach
(
UBGraphicsPolygonItem
*
poly
,
mCurrentStroke
->
polygons
()){
mPreviousPolygonItems
.
removeAll
(
poly
);
removeItem
(
poly
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
poly
);
poly
->
setStrokesGroup
(
pStrokes
);
pStrokes
->
addToGroup
(
poly
);
}
// 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
<<
pStrokes
;
addItem
(
pStrokes
);
mAddedItems
.
clear
();
mAddedItems
<<
pStrokes
;
addItem
(
pStrokes
);
if
(
mCurrentStroke
->
polygons
().
empty
()){
delete
mCurrentStroke
;
...
...
@@ -1524,7 +1524,6 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
format
.
setForeground
(
QBrush
(
color
));
curCursor
.
mergeCharFormat
(
format
);
textItem
->
setTextCursor
(
curCursor
);
// textItem->setSelected(true);
textItem
->
contentsChanged
();
}
...
...
@@ -1619,7 +1618,10 @@ void UBGraphicsScene::addItem(QGraphicsItem* item)
{
UBCoreGraphicsScene
::
addItem
(
item
);
UBGraphicsItem
::
assignZValue
(
item
,
mZLayerController
->
generateZLevel
(
item
));
qDebug
()
<<
item
->
zValue
();
qreal
zvalue
=
mZLayerController
->
generateZLevel
(
item
);
UBGraphicsItem
::
assignZValue
(
item
,
zvalue
);
if
(
!
mTools
.
contains
(
item
))
++
mItemCount
;
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
26f96b76
...
...
@@ -43,6 +43,7 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent)
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
}
UBGraphicsStrokesGroup
::~
UBGraphicsStrokesGroup
()
...
...
src/gui/UBThumbnailWidget.h
View file @
26f96b76
...
...
@@ -97,7 +97,7 @@ class UBThumbnailWidget : public QGraphicsView
QList
<
QUrl
>
mItemsPaths
;
QStringList
mLabels
;
bool
bSelectionInProgress
;
bool
bCanDrag
;
bool
bCanDrag
;
private
:
void
selectAll
();
...
...
@@ -161,7 +161,6 @@ class UBThumbnail
{
item
->
scene
()
->
addItem
(
mSelectionItem
);
mSelectionItem
->
setZValue
(
item
->
zValue
()
-
1
);
// UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1);
mAddedToScene
=
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