Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
f70eb5ee
Commit
f70eb5ee
authored
Nov 21, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added deleting selected primitive.
parent
503545c5
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
2 deletions
+38
-2
controller.cpp
helloqube/controller.cpp
+7
-1
controller.h
helloqube/controller.h
+1
-0
delete.png
helloqube/grapa-a2-iconset/delete.png
+0
-0
helloqube.pro.user
helloqube/helloqube.pro.user
+1
-1
helloqube.qrc
helloqube/helloqube.qrc
+1
-0
mainwindow.cpp
helloqube/mainwindow.cpp
+5
-0
mainwindow.h
helloqube/mainwindow.h
+2
-0
rigidbodytransformation.cpp
helloqube/rigidbodytransformation.cpp
+4
-0
rigidbodytransformation.h
helloqube/rigidbodytransformation.h
+1
-0
scenegraph.cpp
helloqube/scenegraph.cpp
+13
-0
scenegraph.h
helloqube/scenegraph.h
+3
-0
No files found.
helloqube/controller.cpp
View file @
f70eb5ee
...
...
@@ -233,7 +233,7 @@ void Controller::addBox(){
}
void
Controller
::
addCylinder
(){
currentTransform
=
scene
->
addCylinder
(
tesselation
);
currentTransform
=
scene
->
addCylinder
(
tesselation
);
}
void
Controller
::
addCone
(){
...
...
@@ -243,3 +243,9 @@ void Controller::addCone(){
void
Controller
::
addTorus
(){
currentTransform
=
scene
->
addTorus
(
tesselation
);
}
void
Controller
::
deletePrimitive
(){
qDebug
(
"try deleting"
);
if
(
currentTransform
)
currentTransform
=
scene
->
deleteNode
(
currentTransform
);
else
qDebug
(
"nothing selected. Did not call delete on scenegraph"
);
}
helloqube/controller.h
View file @
f70eb5ee
...
...
@@ -86,6 +86,7 @@ public slots:
void
addCylinder
();
void
addCone
();
void
addTorus
();
void
deletePrimitive
();
};
...
...
helloqube/grapa-a2-iconset/delete.png
0 → 100644
View file @
f70eb5ee
10 KB
helloqube/helloqube.pro.user
View file @
f70eb5ee
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-11-21T20:
37:36
. -->
<!-- Written by QtCreator 3.5.1, 2015-11-21T20:
51:27
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
helloqube/helloqube.qrc
View file @
f70eb5ee
...
...
@@ -11,6 +11,7 @@
<file>grapa-a2-iconset/camera.png</file>
<file>grapa-a2-iconset/cone.png</file>
<file>grapa-a2-iconset/cylinder.png</file>
<file>grapa-a2-iconset/delete.png</file>
<file>grapa-a2-iconset/select.png</file>
<file>grapa-a2-iconset/sphere.png</file>
<file>grapa-a2-iconset/torus.png</file>
...
...
helloqube/mainwindow.cpp
View file @
f70eb5ee
...
...
@@ -210,18 +210,21 @@ MainWindow::MainWindow(QWidget *parent)
addCylinder
=
new
QAction
(
"Add Cylinder"
,
toolBar
);
addCone
=
new
QAction
(
"Add Cone"
,
toolBar
);
addTorus
=
new
QAction
(
"Add Torus"
,
toolBar
);
deletePrimitive
=
new
QAction
(
"Delete"
,
toolBar
);
addSphere
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/sphere.png"
));
addBox
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/box.png"
));
addCylinder
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/cylinder.png"
));
addCone
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/cone.png"
));
addTorus
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/torus.png"
));
deletePrimitive
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/delete.png"
));
addSphere
->
setCheckable
(
false
);
addBox
->
setCheckable
(
false
);
addCylinder
->
setCheckable
(
false
);
addCone
->
setCheckable
(
false
);
addTorus
->
setCheckable
(
false
);
deletePrimitive
->
setCheckable
(
false
);
toolBar
->
addAction
(
addSphere
);
toolBar
->
insertSeparator
(
addSphere
);
...
...
@@ -229,12 +232,14 @@ MainWindow::MainWindow(QWidget *parent)
toolBar
->
addAction
(
addCylinder
);
toolBar
->
addAction
(
addCone
);
toolBar
->
addAction
(
addTorus
);
toolBar
->
addAction
(
deletePrimitive
);
connect
(
addSphere
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
addSphere
()));
connect
(
addBox
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
addBox
()));
connect
(
addCylinder
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
addCylinder
()));
connect
(
addCone
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
addCone
()));
connect
(
addTorus
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
addTorus
()));
connect
(
deletePrimitive
,
SIGNAL
(
triggered
(
bool
)),
controller
,
SLOT
(
deletePrimitive
()));
}
...
...
helloqube/mainwindow.h
View file @
f70eb5ee
...
...
@@ -85,6 +85,8 @@ private:
QAction
*
addCone
;
QAction
*
addTorus
;
QAction
*
deletePrimitive
;
public
slots
:
void
showAboutBox
(
)
;
};
...
...
helloqube/rigidbodytransformation.cpp
View file @
f70eb5ee
...
...
@@ -8,6 +8,10 @@ RigidBodyTransformation::RigidBodyTransformation(Primitive* child)
// qDebug() << "new rbt " << tx << "," << ty << "," << tz << ", rot " << rotation;
}
RigidBodyTransformation
::~
RigidBodyTransformation
(){
child
->~
Primitive
();
}
void
RigidBodyTransformation
::
addTranslation
(
QVector3D
diff
){
translation
+=
diff
;
...
...
helloqube/rigidbodytransformation.h
View file @
f70eb5ee
...
...
@@ -8,6 +8,7 @@ class RigidBodyTransformation
{
public
:
RigidBodyTransformation
(
Primitive
*
child
);
~
RigidBodyTransformation
();
void
addTranslation
(
QVector3D
diff
);
void
setRotation
(
QQuaternion
newRotation
);
...
...
helloqube/scenegraph.cpp
View file @
f70eb5ee
...
...
@@ -78,6 +78,19 @@ RigidBodyTransformation* SceneGraph::addPrimitive(Primitive* p){
return
r
;
}
RigidBodyTransformation
*
SceneGraph
::
deleteNode
(
RigidBodyTransformation
*
r
){
if
(
r
==
0
){
qDebug
(
"transform already 0"
);
return
0
;
}
bool
s
=
nodes
.
removeOne
(
r
);
if
(
!
s
)
qDebug
(
"could not remove this. Delete r anyways."
);
r
->~
RigidBodyTransformation
();
notifyViews
();
if
(
nodes
.
length
()
>
0
)
return
nodes
.
back
();
else
return
0
;
}
//transform something
void
SceneGraph
::
addRotation
(
RigidBodyTransformation
*
r
,
QQuaternion
diff
){
r
->
addRotation
(
diff
);
...
...
helloqube/scenegraph.h
View file @
f70eb5ee
...
...
@@ -26,6 +26,9 @@ public:
const
QList
<
RigidBodyTransformation
*>
getGraph
();
//automatically selects last added primitive. if none left, selects 0.
RigidBodyTransformation
*
deleteNode
(
RigidBodyTransformation
*
r
);
//Hallo. Todos:
//Log selected name in status bar
//add remaining primitive types
...
...
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