Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
62bb905f
Commit
62bb905f
authored
Oct 08, 2013
by
Christian Schulte zu Berge
Browse files
Added GUI to dynamically add new pipelines to the app (canvas creation does not work yet however)
parent
213ae14c
Changes
5
Hide whitespace changes
Inline
Side-by-side
application/campvisapplication.cpp
View file @
62bb905f
...
...
@@ -249,9 +249,16 @@ namespace campvis {
}
void
CampVisApplication
::
addPipeline
(
const
std
::
string
&
name
,
AbstractPipeline
*
pipeline
)
{
tgtAssert
(
_initialized
==
false
,
"Adding pipelines after initialization is currently not supported."
);
tgtAssert
(
pipeline
!=
0
,
"Pipeline must not be 0."
);
// if CAMPVis is already fully initialized, we need to temporarily shut down its
// OpenGL job processor, since we need to create a new context.
if
(
_initialized
)
{
GLJobProc
.
pause
();
}
_mainWindow
->
addVisualizationPipelineWidget
(
"foobar"
,
new
QWidget
());
// create canvas and painter for the pipeline and connect all together
tgt
::
QtThreadedCanvas
*
canvas
=
CtxtMgr
.
createContext
(
name
,
"CAMPVis"
,
tgt
::
ivec2
(
512
,
512
));
GLJobProc
.
registerContext
(
canvas
);
...
...
@@ -264,8 +271,17 @@ namespace campvis {
_visualizations
.
push_back
(
std
::
make_pair
(
pipeline
,
painter
));
_pipelines
.
push_back
(
pipeline
);
CtxtMgr
.
releaseCurrentContext
();
if
(
_initialized
)
{
pipeline
->
setEnabled
(
false
);
pipeline
->
init
();
painter
->
init
();
pipeline
->
setEnabled
(
true
);
GLJobProc
.
resume
();
}
CtxtMgr
.
releaseCurrentContext
();
s_PipelinesChanged
();
}
...
...
application/campvisapplication.h
View file @
62bb905f
...
...
@@ -116,6 +116,11 @@ namespace campvis {
int
run
();
/**
* Creates a new DataContainer with the given name.
* \param name Name of the new DataContainer
* \return The newly created DataContainer
*/
DataContainer
*
createAndAddDataContainer
(
const
std
::
string
&
name
);
/// Signal emitted when the collection of pipelines has changed.
...
...
application/gui/mainwindow.cpp
View file @
62bb905f
...
...
@@ -38,9 +38,13 @@
#include
"core/datastructures/datacontainer.h"
#include
"core/pipeline/abstractpipeline.h"
#include
"core/pipeline/abstractprocessor.h"
#include
"core/tools/stringutils.h"
#include
"modules/pipelinefactory.h"
#include
<QMdiSubWindow>
#include
<QScrollBar>
#include
<QPushButton>
#include
<QComboBox>
namespace
campvis
{
...
...
@@ -48,6 +52,9 @@ namespace campvis {
:
QMainWindow
()
,
_application
(
application
)
,
_mdiArea
(
0
)
,
_containerWidget
(
0
)
,
_cbPipelineFactory
(
0
)
,
_btnPipelineFactory
(
0
)
,
_pipelineWidget
(
0
)
,
_propCollectionWidget
(
0
)
,
_dcInspectorWidget
(
0
)
...
...
@@ -56,6 +63,7 @@ namespace campvis {
,
_btnShowDataContainerInspector
(
0
)
,
_selectedPipeline
(
0
)
,
_selectedProcessor
(
0
)
,
_selectedDataContainer
(
0
)
,
_logViewer
(
0
)
{
tgtAssert
(
_application
!=
0
,
"Application must not be 0."
);
...
...
@@ -83,9 +91,24 @@ namespace campvis {
_mdiArea
->
tileSubWindows
();
setCentralWidget
(
_mdiArea
);
_containerWidget
=
new
QWidget
(
this
);
QGridLayout
*
_cwLayout
=
new
QGridLayout
(
_containerWidget
);
_cbPipelineFactory
=
new
QComboBox
(
_containerWidget
);
std
::
vector
<
std
::
string
>
registeredPipelines
=
PipelineFactory
::
getRef
().
getRegisteredPipelines
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
registeredPipelines
.
begin
();
it
!=
registeredPipelines
.
end
();
++
it
)
_cbPipelineFactory
->
addItem
(
QString
::
fromStdString
(
*
it
));
_cwLayout
->
addWidget
(
_cbPipelineFactory
,
0
,
0
);
_btnPipelineFactory
=
new
QPushButton
(
"Add Pipeline"
,
_containerWidget
);
_cwLayout
->
addWidget
(
_btnPipelineFactory
,
0
,
1
);
_pipelineWidget
=
new
PipelineTreeWidget
();
_pipelineWidget
->
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Maximum
);
ui
.
pipelineTreeDock
->
setWidget
(
_pipelineWidget
);
_containerWidget
->
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Maximum
);
_cwLayout
->
addWidget
(
_pipelineWidget
,
1
,
0
,
1
,
2
);
_containerWidget
->
setLayout
(
_cwLayout
);
ui
.
pipelineTreeDock
->
setWidget
(
_containerWidget
);
_pipelinePropertiesScrollArea
=
new
QScrollArea
();
_pipelinePropertiesScrollArea
->
setWidgetResizable
(
true
);
...
...
@@ -131,6 +154,10 @@ namespace campvis {
connect
(
_btnShowDataContainerInspector
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnShowDataContainerInspectorClicked
()));
connect
(
_btnPipelineFactory
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnPipelineFactoryClicked
()));
_application
->
s_PipelinesChanged
.
connect
(
this
,
&
MainWindow
::
onPipelinesChanged
);
_application
->
s_DataContainersChanged
.
connect
(
this
,
&
MainWindow
::
onDataContainersChanged
);
}
...
...
@@ -162,6 +189,7 @@ namespace campvis {
if
(
AbstractPipeline
*
pipeline
=
dynamic_cast
<
AbstractPipeline
*>
(
ptr
))
{
_selectedPipeline
=
pipeline
;
_selectedProcessor
=
0
;
_selectedDataContainer
=
&
pipeline
->
getDataContainer
();
}
else
if
(
AbstractProcessor
*
processor
=
dynamic_cast
<
AbstractProcessor
*>
(
ptr
))
{
_selectedProcessor
=
processor
;
...
...
@@ -170,6 +198,7 @@ namespace campvis {
HasPropertyCollection
*
pptr
=
static_cast
<
HasPropertyCollection
*>
(
parentItem
.
value
<
void
*>
());
if
(
AbstractPipeline
*
pipeline
=
dynamic_cast
<
AbstractPipeline
*>
(
pptr
))
{
_selectedPipeline
=
pipeline
;
_selectedDataContainer
=
&
pipeline
->
getDataContainer
();
}
}
...
...
@@ -177,15 +206,17 @@ namespace campvis {
}
else
{
emit
updatePropCollectionWidget
(
0
,
0
);
_selectedDataContainer
=
0
;
}
}
else
{
emit
updatePropCollectionWidget
(
0
,
0
);
_selectedDataContainer
=
0
;
}
}
QSize
MainWindow
::
sizeHint
()
const
{
return
QSize
(
8
00
,
45
0
);
return
QSize
(
10
00
,
60
0
);
}
void
MainWindow
::
onBtnExecuteClicked
()
{
...
...
@@ -251,4 +282,14 @@ namespace campvis {
return
dockWidget
;
}
void
MainWindow
::
onBtnPipelineFactoryClicked
()
{
std
::
string
name
=
this
->
_cbPipelineFactory
->
currentText
().
toStdString
();
DataContainer
*
dc
=
_selectedDataContainer
;
if
(
dc
==
0
)
{
dc
=
_application
->
createAndAddDataContainer
(
"DataContainer #"
+
StringUtils
::
toString
(
_application
->
_dataContainers
.
size
()
+
1
));
}
AbstractPipeline
*
p
=
PipelineFactory
::
getRef
().
createPipeline
(
name
,
dc
);
_application
->
addPipeline
(
name
,
p
);
}
}
application/gui/mainwindow.h
View file @
62bb905f
...
...
@@ -125,6 +125,9 @@ namespace campvis {
*/
void
onBtnShowDataContainerInspectorClicked
();
/// Slot to be called when _btnPipelineFactory was clicked;
void
onBtnPipelineFactoryClicked
();
private:
/**
...
...
@@ -160,6 +163,9 @@ namespace campvis {
CampVisApplication
*
_application
;
///< Pointer to the application hosting the whole stuff
QMdiArea
*
_mdiArea
;
///< MDI area (the window's central widget)
QWidget
*
_containerWidget
;
///< Widget to manage the app's DataContainers and pipelines
QComboBox
*
_cbPipelineFactory
;
///< Combobox for selecting the Pipelines from the PipelineFactory
QPushButton
*
_btnPipelineFactory
;
///< Button to add a Pipeline from the factory
PipelineTreeWidget
*
_pipelineWidget
;
///< Widget for browsing the active pipelines
QWidget
*
_pipelinePropertiesWidget
;
///< Widget showing the selected pipeline's properties
QScrollArea
*
_pipelinePropertiesScrollArea
;
///< Scroll area for _pipelinePropertiesWidget
...
...
@@ -172,6 +178,8 @@ namespace campvis {
AbstractPipeline
*
_selectedPipeline
;
///< currently selected pipeline
AbstractProcessor
*
_selectedProcessor
;
///< currently selected processor
DataContainer
*
_selectedDataContainer
;
///< currently selected DataContainer
LogViewerWidget
*
_logViewer
;
///< Widget displaying log messages
std
::
vector
<
QDockWidget
*>
_primaryDocks
;
///< Docks located in top docking area of the main window
};
...
...
application/ui/mainwindow.ui
View file @
62bb905f
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
903
</width>
<height>
435
</height>
<width>
1000
</width>
<height>
600
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -20,7 +20,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
903
</width>
<width>
1000
</width>
<height>
21
</height>
</rect>
</property>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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