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
72b2941f
Commit
72b2941f
authored
May 11, 2012
by
Anna Udovichenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
6f1ef4cd
0d68fec3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
58 deletions
+108
-58
release.linux.sh
release.linux.sh
+24
-19
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+2
-2
UBDrawingController.h
src/board/UBDrawingController.h
+1
-1
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+3
-3
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+11
-9
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+67
-24
No files found.
release.linux.sh
View file @
72b2941f
...
@@ -39,14 +39,18 @@ checkDirectory(){
...
@@ -39,14 +39,18 @@ checkDirectory(){
# path definition #
# path definition #
#######################################################################
#######################################################################
QT_PATH
=
"/usr/local/Trolltech/Qt-4.7.3"
QT_PATH
=
"/usr/local/Trolltech/Qt-4.7.3"
PLUGINS_PATH
=
"
$QT_PATH
/plugins"
QT_
PLUGINS_PATH
=
"
$QT_PATH
/plugins"
RELEASE_DIR
=
build/linux/release
RELEASE_DIR
=
build/linux/release
BUILD_DIR
=
$RELEASE_DIR
/product
BUILD_DIR
=
$RELEASE_DIR
/product
GUI_TRANSLATIONS_DIRECTORY_PATH
=
"../Qt-sankore3.1/translations"
GUI_TRANSLATIONS_DIRECTORY_PATH
=
"../Qt-sankore3.1/translations"
QT_LIBRARY_SOURCE_PATH
=
"
$QT_PATH
/lib"
QT_LIBRARY_SOURCE_PATH
=
"
$QT_PATH
/lib"
SANKORE_SRC_PLUGINS_PATH
=
"plugins"
SANKORE_DST_PLUGINS_PATH
=
build/linux/release/product/plugins
CFF_ADAPTOR_SRC_PLUGIN_PATH
=
$SANKORE_SRC_PLUGINS_PATH
/cffadaptor/build/linux/release/lib
QMAKE_PATH
=
"
$QT_PATH
/bin/qmake"
QMAKE_PATH
=
"
$QT_PATH
/bin/qmake"
LRELEASE
=
"/usr/local/Trolltech/Qt-4.7.3/bin/lrelease"
LRELEASE
=
"../Qt-sankore3.1/bin/lrelease"
#LRELEASE="/usr/local/Trolltech/Qt-4.7.3/bin/lrelease"
ARCHITECTURE
=
`
uname
-m
`
ARCHITECTURE
=
`
uname
-m
`
...
@@ -57,13 +61,15 @@ checkExecutable $QMAKE_PATH
...
@@ -57,13 +61,15 @@ checkExecutable $QMAKE_PATH
checkExecutable
$LRELEASE
checkExecutable
$LRELEASE
checkDirectory
$GUI_TRANSLATIONS_DIRECTORY_PATH
checkDirectory
$GUI_TRANSLATIONS_DIRECTORY_PATH
checkDirectory
$PLUGINS_PATH
checkDirectory
$
QT_
PLUGINS_PATH
checkDirectory
$QT_LIBRARY_SOURCE_PATH
checkDirectory
$QT_LIBRARY_SOURCE_PATH
checkDirectory
$CFF_ADAPTOR_PLUGIN_PATH
#######################################################################
#######################################################################
# cleaning #
# cleaning #
#######################################################################
#######################################################################
rm
-rf
$RELEASE_DIR
#
rm -rf $RELEASE_DIR
#######################################################################
#######################################################################
...
@@ -126,21 +132,26 @@ cp -R resources/linux/qtlinux/* $BUILD_DIR
...
@@ -126,21 +132,26 @@ cp -R resources/linux/qtlinux/* $BUILD_DIR
cp
-R
resources/customizations
$BUILD_DIR
cp
-R
resources/customizations
$BUILD_DIR
notify-send
"Sankore"
"Copying plugins..."
mkdir
"
$SANKORE_DST_PLUGINS_PATH
"
mkdir
"
$SANKORE_DST_PLUGINS_PATH
/cffadaptor"
cp
-R
$CFF_ADAPTOR_SRC_PLUGIN_PATH
/
*
.so
*
"
$SANKORE_DST_PLUGINS_PATH
/cffadaptor"
notify-send
"QT"
"Coping plugins and library ..."
notify-send
"QT"
"Coping plugins and library ..."
cp
-R
$PLUGINS_PATH
$BUILD_DIR
cp
-R
$
QT_
PLUGINS_PATH
$BUILD_DIR
#copying custom qt library
#copying custom qt library
QT_LIBRARY_DEST_PATH
=
"
$BUILD_DIR
/qtlib"
QT_LIBRARY_DEST_PATH
=
"
$BUILD_DIR
/qtlib"
mkdir
$QT_LIBRARY_DEST_PATH
mkdir
$QT_LIBRARY_DEST_PATH
copyQtLibrary
(){
copyQtLibrary
(){
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4
.7.3
"
]
;
then
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4"
]
;
then
notifyError
"
$1
library not found in path:
$QT_LIBRARY_SOURCE_PATH
"
notifyError
"
$1
library not found in path:
$QT_LIBRARY_SOURCE_PATH
"
fi
fi
cp
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4"
"
$QT_LIBRARY_DEST_PATH
/"
cp
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4.
*
$QT_LIBRARY_DEST_PATH
/
cp
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4.7.3"
"
$QT_LIBRARY_DEST_PATH
/"
}
}
copyQtLibrary libphonon
copyQtLibrary libQtWebKit
copyQtLibrary libQtWebKit
copyQtLibrary libQtDBus
copyQtLibrary libQtDBus
copyQtLibrary libQtScript
copyQtLibrary libQtScript
...
@@ -150,14 +161,8 @@ copyQtLibrary libQtNetwork
...
@@ -150,14 +161,8 @@ copyQtLibrary libQtNetwork
copyQtLibrary libQtXml
copyQtLibrary libQtXml
copyQtLibrary libQtGui
copyQtLibrary libQtGui
copyQtLibrary libQtCore
copyQtLibrary libQtCore
# uncomment for Qt 4.8
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4.4.0"
]
;
then
#copyQtLibrary libQtOpenGL
notifyError
"phonon library not found in path:
$QT_LIBRARY_SOURCE_PATH
"
else
cp
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4"
"
$QT_LIBRARY_DEST_PATH
/"
cp
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4.4.0"
"
$QT_LIBRARY_DEST_PATH
/"
fi
#######################################################################
#######################################################################
# Removing unwanted files #
# Removing unwanted files #
...
@@ -279,7 +284,7 @@ echo "Priority: optional" >> "$CONTROL_FILE"
...
@@ -279,7 +284,7 @@ echo "Priority: optional" >> "$CONTROL_FILE"
echo
"Architecture:
$ARCHITECTURE
"
>>
"
$CONTROL_FILE
"
echo
"Architecture:
$ARCHITECTURE
"
>>
"
$CONTROL_FILE
"
echo
"Essential: no"
>>
"
$CONTROL_FILE
"
echo
"Essential: no"
>>
"
$CONTROL_FILE
"
echo
"Installed-Size:
`
du
-s
$SANKORE_PACKAGE_DIRECTORY
|
awk
'{ print $1 }'
`
"
>>
"
$CONTROL_FILE
"
echo
"Installed-Size:
`
du
-s
$SANKORE_PACKAGE_DIRECTORY
|
awk
'{ print $1 }'
`
"
>>
"
$CONTROL_FILE
"
echo
"Maintainer: Open-Sankor
é
Developers team <dev@open-sankore.org>"
>>
"
$CONTROL_FILE
"
echo
"Maintainer: Open-Sankor
e
Developers team <dev@open-sankore.org>"
>>
"
$CONTROL_FILE
"
echo
"Homepage: http://dev.open-sankore.org"
>>
"
$CONTROL_FILE
"
echo
"Homepage: http://dev.open-sankore.org"
>>
"
$CONTROL_FILE
"
echo
-n
"Depends: "
>>
"
$CONTROL_FILE
"
echo
-n
"Depends: "
>>
"
$CONTROL_FILE
"
unset
tab
unset
tab
...
@@ -318,7 +323,7 @@ echo "Version=$VERSION" >> $SANKORE_SHORTCUT
...
@@ -318,7 +323,7 @@ echo "Version=$VERSION" >> $SANKORE_SHORTCUT
echo
"Encoding=UTF-8"
>>
$SANKORE_SHORTCUT
echo
"Encoding=UTF-8"
>>
$SANKORE_SHORTCUT
echo
"Name=Open-Sankore (
$VERSION
)"
>>
$SANKORE_SHORTCUT
echo
"Name=Open-Sankore (
$VERSION
)"
>>
$SANKORE_SHORTCUT
echo
"GenericName=Open-Sankore"
>>
$SANKORE_SHORTCUT
echo
"GenericName=Open-Sankore"
>>
$SANKORE_SHORTCUT
echo
"Comment=Logiciel de cr
éation de présentations pour tableau numé
rique interactif (TNI)"
>>
$SANKORE_SHORTCUT
echo
"Comment=Logiciel de cr
eation de presentations pour tableau nume
rique interactif (TNI)"
>>
$SANKORE_SHORTCUT
echo
"Exec=/usr/local/
$SANKORE_DIRECTORY_NAME
/run.sh"
>>
$SANKORE_SHORTCUT
echo
"Exec=/usr/local/
$SANKORE_DIRECTORY_NAME
/run.sh"
>>
$SANKORE_SHORTCUT
echo
"Icon=/usr/local/
$SANKORE_DIRECTORY_NAME
/sankore.png"
>>
$SANKORE_SHORTCUT
echo
"Icon=/usr/local/
$SANKORE_DIRECTORY_NAME
/sankore.png"
>>
$SANKORE_SHORTCUT
echo
"StartupNotify=true"
>>
$SANKORE_SHORTCUT
echo
"StartupNotify=true"
>>
$SANKORE_SHORTCUT
...
@@ -353,4 +358,4 @@ cd $RELEASE_DIR
...
@@ -353,4 +358,4 @@ cd $RELEASE_DIR
rm
../../../install/linux/Open-Sankore.tar.gz
rm
../../../install/linux/Open-Sankore.tar.gz
tar
cvzf ../../../install/linux/Open-Sankore.tar.gz Open-Sankore.
$VERSION
-C
.
tar
cvzf ../../../install/linux/Open-Sankore.tar.gz Open-Sankore.
$VERSION
-C
.
notify-send
"Open-Sankore"
"tar.gz Build done"
notify-send
"Open-Sankore"
"tar.gz Build done"
\ No newline at end of file
src/board/UBDrawingController.cpp
View file @
72b2941f
...
@@ -45,7 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
...
@@ -45,7 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
,
mActiveRuler
(
NULL
)
,
mActiveRuler
(
NULL
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mDrawingMode
(
DRAWING_MODE
)
,
mDrawingMode
(
/*DRAWING_MODE*/
eDrawingMode_Vector
)
{
{
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
...
@@ -114,7 +114,7 @@ void UBDrawingController::setStylusTool(int tool)
...
@@ -114,7 +114,7 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
){
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
){
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
mDrawingMode
=
eDrawingMode_Artistic
;
//
mDrawingMode = eDrawingMode_Artistic;
}
}
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
...
...
src/board/UBDrawingController.h
View file @
72b2941f
...
@@ -27,7 +27,7 @@ typedef enum{
...
@@ -27,7 +27,7 @@ typedef enum{
eDrawingMode_Vector
eDrawingMode_Vector
}
eDrawingMode
;
}
eDrawingMode
;
#define DRAWING_MODE eDrawingMode_
Artistic
#define DRAWING_MODE eDrawingMode_
Vector
class
UBDrawingController
:
public
QObject
class
UBDrawingController
:
public
QObject
{
{
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
72b2941f
...
@@ -583,9 +583,9 @@ void UBGraphicsDelegateFrame::positionHandles()
...
@@ -583,9 +583,9 @@ void UBGraphicsDelegateFrame::positionHandles()
{
{
QRectF
itemRect
=
delegated
()
->
boundingRect
();
QRectF
itemRect
=
delegated
()
->
boundingRect
();
if
(
mDelegate
->
getToolBarItem
()
->
isVisibleOnBoard
()
// if (mDelegate->getToolBarItem()->isVisibleOnBoard()
&&
mDelegate
->
getToolBarItem
()
->
isShifting
())
//
&& mDelegate->getToolBarItem()->isShifting())
itemRect
.
setHeight
(
itemRect
.
height
()
+
mDelegate
->
getToolBarItem
()
->
rect
().
height
()
*
mDelegate
->
antiScaleRatio
()
*
1.1
);
//
itemRect.setHeight(itemRect.height() + mDelegate->getToolBarItem()->rect().height() * mDelegate->antiScaleRatio() * 1.1);
QTransform
itemTransform
=
delegated
()
->
sceneTransform
();
QTransform
itemTransform
=
delegated
()
->
sceneTransform
();
QPointF
topLeft
=
itemTransform
.
map
(
itemRect
.
topLeft
());
QPointF
topLeft
=
itemTransform
.
map
(
itemRect
.
topLeft
());
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
72b2941f
...
@@ -117,7 +117,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
...
@@ -117,7 +117,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
void
UBGraphicsItemDelegate
::
init
()
void
UBGraphicsItemDelegate
::
init
()
{
{
mToolBarItem
=
new
UBGraphicsToolBarItem
(
delegated
());
//
mToolBarItem = new UBGraphicsToolBarItem(delegated());
mFrame
=
new
UBGraphicsDelegateFrame
(
this
,
QRectF
(
0
,
0
,
0
,
0
),
mFrameWidth
,
mRespectRatio
);
mFrame
=
new
UBGraphicsDelegateFrame
(
this
,
QRectF
(
0
,
0
,
0
,
0
),
mFrameWidth
,
mRespectRatio
);
mFrame
->
hide
();
mFrame
->
hide
();
...
@@ -167,7 +167,9 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
...
@@ -167,7 +167,9 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
QVariant
UBGraphicsItemDelegate
::
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
)
QVariant
UBGraphicsItemDelegate
::
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
{
if
(
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
{
if
(
change
==
QGraphicsItem
::
ItemChildAddedChange
){
}
else
if
(
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
{
bool
ok
;
bool
ok
;
bool
selected
=
value
.
toUInt
(
&
ok
);
bool
selected
=
value
.
toUInt
(
&
ok
);
if
(
ok
)
{
if
(
ok
)
{
...
@@ -321,17 +323,17 @@ void UBGraphicsItemDelegate::positionHandles()
...
@@ -321,17 +323,17 @@ void UBGraphicsItemDelegate::positionHandles()
updateButtons
(
true
);
updateButtons
(
true
);
if
(
mToolBarItem
->
isVisibleOnBoard
())
//
if (mToolBarItem->isVisibleOnBoard())
{
//
{
updateToolBar
();
//
updateToolBar();
mToolBarItem
->
show
();
//
mToolBarItem->show();
}
//
}
}
else
{
}
else
{
foreach
(
DelegateButton
*
button
,
mButtons
)
foreach
(
DelegateButton
*
button
,
mButtons
)
button
->
hide
();
button
->
hide
();
mFrame
->
hide
();
mFrame
->
hide
();
mToolBarItem
->
hide
();
//
mToolBarItem->hide();
}
}
}
}
...
@@ -371,7 +373,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
...
@@ -371,7 +373,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene
->
removeItem
(
mFrame
);
scene
->
removeItem
(
mFrame
);
scene
->
removeItem
(
mDelegated
);
scene
->
removeItem
(
mDelegated
);
scene
->
removeItem
(
mToolBarItem
);
//
scene->removeItem(mToolBarItem);
if
(
canUndo
)
if
(
canUndo
)
{
{
...
...
src/domain/UBGraphicsScene.cpp
View file @
72b2941f
...
@@ -308,9 +308,11 @@ UBGraphicsScene::~UBGraphicsScene()
...
@@ -308,9 +308,11 @@ UBGraphicsScene::~UBGraphicsScene()
void
UBGraphicsScene
::
selectionChangedProcessing
()
void
UBGraphicsScene
::
selectionChangedProcessing
()
{
{
if
(
selectedItems
().
count
())
if
(
selectedItems
().
count
()){
qDebug
()
<<
"Selected item bounding rect: "
<<
selectedItems
().
first
()
->
boundingRect
();
UBApplication
::
showMessage
(
"ZValue is "
+
QString
::
number
(
selectedItems
().
first
()
->
zValue
(),
'f'
)
+
"own z value is "
UBApplication
::
showMessage
(
"ZValue is "
+
QString
::
number
(
selectedItems
().
first
()
->
zValue
(),
'f'
)
+
"own z value is "
+
QString
::
number
(
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
(),
'f'
));
+
QString
::
number
(
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
(),
'f'
));
}
}
}
void
UBGraphicsScene
::
enableGroupingButton
()
void
UBGraphicsScene
::
enableGroupingButton
()
{
{
...
@@ -747,6 +749,8 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
...
@@ -747,6 +749,8 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
void
UBGraphicsScene
::
eraseLineTo
(
const
QPointF
&
pEndPoint
,
const
qreal
&
pWidth
)
void
UBGraphicsScene
::
eraseLineTo
(
const
QPointF
&
pEndPoint
,
const
qreal
&
pWidth
)
{
{
// QList<QGraphicsItem*> itemList;
const
QLineF
line
(
mPreviousPoint
,
pEndPoint
);
const
QLineF
line
(
mPreviousPoint
,
pEndPoint
);
const
QPolygonF
eraserPolygon
=
UBGeometryUtils
::
lineToPolygon
(
line
,
pWidth
);
const
QPolygonF
eraserPolygon
=
UBGeometryUtils
::
lineToPolygon
(
line
,
pWidth
);
...
@@ -793,24 +797,29 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -793,24 +797,29 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if
(
mShouldUseOMP
)
if
(
mShouldUseOMP
)
{
{
#pragma omp parallel for
//
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
{
{
UBGraphicsPolygonItem
*
collidingPolygonItem
=
dynamic
_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
UBGraphicsPolygonItem
*
collidingPolygonItem
=
qgraphicsitem
_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
if
(
NULL
!=
collidingPolygonItem
)
if
(
NULL
!=
collidingPolygonItem
)
{
{
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
green
));
UBGraphicsStrokesGroup
*
pGroup
=
collidingPolygonItem
->
strokesGroup
();
UBGraphicsStrokesGroup
*
pGroup
=
collidingPolygonItem
->
strokesGroup
();
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
{
{
#pragma omp critical
// #pragma omp critical
qDebug
()
<<
"case 1"
;
// Put the entire polygon into the remove list
// Put the entire polygon into the remove list
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
toBeRemovedItems
<<
collidingPolygonItem
;
}
}
else
else
{
{
// Here we get the polygon of the colliding item
// Here we get the polygon of the colliding item
QPolygonF
collidingPolygon
=
collidingPolygonItem
->
polygon
();
QPolygonF
collidingPolygon
=
collidingPolygonItem
->
polygon
();
QPainterPath
collidingPath
;
QPainterPath
collidingPath
;
collidingPath
.
addPolygon
(
collidingPolygon
);
collidingPath
.
addPolygon
(
collidingPolygon
);
...
@@ -819,32 +828,40 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -819,32 +828,40 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
QPainterPath
croppedPath
=
collidingPath
.
subtracted
(
eraserPath
);
QPainterPath
croppedPath
=
collidingPath
.
subtracted
(
eraserPath
);
QPainterPath
croppedPathSimplified
=
croppedPath
.
simplified
();
QPainterPath
croppedPathSimplified
=
croppedPath
.
simplified
();
if
(
croppedPath
==
collidingPath
)
/*
if (croppedPath == collidingPath)
{
{
// NOOP
// NOOP
qDebug() << "case 2";
toBeRemovedItems << collidingPolygonItem;
}
}
else
if
(
croppedPathSimplified
.
isEmpty
())
else
*/
if
(
croppedPathSimplified
.
isEmpty
())
{
{
#pragma omp critical
// #pragma omp critical
qDebug
()
<<
"case 3"
;
// Put the entire polygon into the remove list if the eraser removes all its visible content
// Put the entire polygon into the remove list if the eraser removes all its visible content
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
toBeRemovedItems
<<
collidingPolygonItem
;
}
}
else
else
{
{
//qDebug() << "case 4";
// Then we convert the remaining path to a list of polygons that will be converted in
// Then we convert the remaining path to a list of polygons that will be converted in
// UBGraphicsPolygonItems and added to the scene
// UBGraphicsPolygonItems and added to the scene
foreach
(
const
QPolygonF
&
pol
,
croppedPathSimplified
.
toFillPolygons
())
foreach
(
const
QPolygonF
&
pol
,
croppedPathSimplified
.
toFillPolygons
())
{
{
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
#pragma omp critical
croppedPolygonItem
->
setColor
(
QColor
(
Qt
::
black
));
// Add this new polygon to the 'added' list
// #pragma omp critical
toBeAddedItems
<<
croppedPolygonItem
;
if
(
NULL
!=
pGroup
){
if
(
NULL
!=
pGroup
){
croppedPolygonItem
->
setStrokesGroup
(
pGroup
);
croppedPolygonItem
->
setStrokesGroup
(
pGroup
);
// croppedPolygonItem->setTransform(pGroup->sceneTransform().inverted());
}
}
// Add this new polygon to the 'added' list
toBeAddedItems
<<
croppedPolygonItem
;
}
}
#pragma omp critical
//
#pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons
// Remove the original polygonitem because it has been replaced by many smaller polygons
collidingPolygonItem
->
setColor
(
QColor
(
Qt
::
blue
));
toBeRemovedItems
<<
collidingPolygonItem
;
toBeRemovedItems
<<
collidingPolygonItem
;
}
}
}
}
...
@@ -855,11 +872,12 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -855,11 +872,12 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
{
{
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
for
(
int
i
=
0
;
i
<
collidItemsSize
;
i
++
)
{
{
UBGraphicsPolygonItem
*
collidingPolygonItem
UBGraphicsPolygonItem
*
collidingPolygonItem
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
=
qgraphicsitem_cast
<
UBGraphicsPolygonItem
*>
(
collidItems
.
at
(
i
));
if
(
collidingPolygonItem
)
if
(
collidingPolygonItem
)
{
{
UBGraphicsStrokesGroup
*
pGroup
=
collidingPolygonItem
->
strokesGroup
();
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
if
(
eraserInnerRect
.
contains
(
collidingPolygonItem
->
boundingRect
()))
{
{
toBeRemovedItems
<<
collidingPolygonItem
;
toBeRemovedItems
<<
collidingPolygonItem
;
...
@@ -887,6 +905,9 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -887,6 +905,9 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
{
{
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
UBGraphicsPolygonItem
*
croppedPolygonItem
=
collidingPolygonItem
->
deepCopy
(
pol
);
toBeAddedItems
<<
croppedPolygonItem
;
toBeAddedItems
<<
croppedPolygonItem
;
if
(
NULL
!=
pGroup
){
croppedPolygonItem
->
setStrokesGroup
(
pGroup
);
}
}
}
toBeRemovedItems
<<
collidingPolygonItem
;
toBeRemovedItems
<<
collidingPolygonItem
;
...
@@ -896,28 +917,50 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
...
@@ -896,28 +917,50 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
}
}
}
addItems
(
toBeAddedItems
);
mAddedItems
+=
toBeAddedItems
;
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
foreach
(
QGraphicsItem
*
item
,
toBe
Add
edItems
){
foreach
(
QGraphicsItem
*
item
,
toBe
Remov
edItems
){
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
&&
NULL
!=
poly
->
strokesGroup
()){
if
(
NULL
!=
poly
){
poly
->
strokesGroup
()
->
addToGroup
(
poly
);
if
(
NULL
!=
poly
->
strokesGroup
()){
poly
->
strokesGroup
()
->
removeFromGroup
(
poly
);
removeItem
(
poly
);
}
else
{
qDebug
()
<<
"No group present"
;
}
}
}
}
}
}
else
{
removeItems
(
toBeRemovedItems
);
mRemovedItems
+=
toBeRemovedItems
;
}
}
removeItems
(
toBeRemovedItems
);
// bool hack = false;
mRemovedItems
+=
toBeRemovedItems
;
// UBGraphicsStrokesGroup* pG = new UBGraphicsStrokesGroup();
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
foreach
(
QGraphicsItem
*
item
,
toBe
Remov
edItems
){
foreach
(
QGraphicsItem
*
item
,
toBe
Add
edItems
){
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
UBGraphicsPolygonItem
*
poly
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
item
);
if
(
NULL
!=
poly
&&
NULL
!=
poly
->
strokesGroup
()){
if
(
NULL
!=
poly
&&
NULL
!=
poly
->
strokesGroup
()){
poly
->
strokesGroup
()
->
removeFromGroup
(
poly
);
// if(!hack){
// itemList = poly->strokesGroup()->childItems();
// removeItem(poly->strokesGroup());
// foreach(QGraphicsItem* it, itemList){
// pG->addToGroup(it);
// }
// hack = true;
// }
qreal
dx
=
-
poly
->
strokesGroup
()
->
sceneTransform
().
inverted
().
dx
();
qreal
dy
=
-
poly
->
strokesGroup
()
->
sceneTransform
().
inverted
().
dy
();
//poly->setTransform(QTransform().translate(20, 0));
poly
->
setTransform
(
QTransform
().
translate
(
dx
,
dy
));
poly
->
strokesGroup
()
/*pG*/
->
addToGroup
(
poly
);
}
}
}
}
//addItem(pG);
}
else
{
addItems
(
toBeAddedItems
);
mAddedItems
+=
toBeAddedItems
;
}
}
}
}
...
...
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