Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
db6b56fc
Commit
db6b56fc
authored
3 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
member variable -> static local
parent
f180a80c
No related branches found
No related tags found
2 merge requests
!327
rename files and classes -> "Toolbar", "Toolbox"
,
!326
make DesignerScene code more compact
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Models/GUIExamplesFactory.cpp
+17
-19
17 additions, 19 deletions
GUI/Models/GUIExamplesFactory.cpp
GUI/Models/GUIExamplesFactory.h
+1
-5
1 addition, 5 deletions
GUI/Models/GUIExamplesFactory.h
with
18 additions
and
24 deletions
GUI/Models/GUIExamplesFactory.cpp
+
17
−
19
View file @
db6b56fc
...
@@ -17,36 +17,34 @@
...
@@ -17,36 +17,34 @@
#include
"Sample/Multilayer/MultiLayer.h"
#include
"Sample/Multilayer/MultiLayer.h"
#include
"Sample/StandardSamples/SampleBuilderFactory.h"
#include
"Sample/StandardSamples/SampleBuilderFactory.h"
#include
<memory>
#include
<memory>
#include
<QMap>
//! Defines correspondence between example name and real name of simulation from SimulationFactory
namespace
{
QMap
<
QString
,
QString
>
init_NameToRegistry
()
{
QMap
<
QString
,
QString
>
name2registry
=
{
QMap
<
QString
,
QString
>
result
;
{
"example01"
,
"CylindersAndPrismsBuilder"
},
result
[
"example01"
]
=
"CylindersAndPrismsBuilder"
;
{
"example02"
,
"RadialParaCrystalBuilder"
},
result
[
"example02"
]
=
"RadialParaCrystalBuilder"
;
{
"example03"
,
"HexParaCrystalBuilder"
},
result
[
"example03"
]
=
"HexParaCrystalBuilder"
;
{
"example04"
,
"CoreShellParticleBuilder"
},
result
[
"example04"
]
=
"CoreShellParticleBuilder"
;
{
"example05"
,
"MultiLayerWithRoughnessBuilder"
},
result
[
"example05"
]
=
"MultiLayerWithRoughnessBuilder"
;
{
"example06"
,
"SquareLattice2DBuilder"
},
result
[
"example06"
]
=
"SquareLattice2DBuilder"
;
{
"example07"
,
"RotatedPyramidsBuilder"
},
result
[
"example07"
]
=
"RotatedPyramidsBuilder"
;
{
"example09"
,
"ParticleCompositionBuilder"
},
result
[
"example09"
]
=
"ParticleCompositionBuilder"
;
{
"example10"
,
"MesoCrystalBuilder"
},
result
[
"example10"
]
=
"MesoCrystalBuilder"
;
};
return
result
;
}
QMap
<
QString
,
QString
>
GUIExamplesFactory
::
m_name_to_registry
=
init_NameToRegistry
();
}
// namespace
bool
GUIExamplesFactory
::
isValidExampleName
(
const
QString
&
name
)
bool
GUIExamplesFactory
::
isValidExampleName
(
const
QString
&
name
)
{
{
return
m_
name
_to_
registry
.
contains
(
name
);
return
name
2
registry
.
contains
(
name
);
}
}
//! Populate sample model with
//! Populate sample model with
SessionItem
*
GUIExamplesFactory
::
createSampleItems
(
const
QString
&
name
,
SampleModel
*
sampleModel
,
SessionItem
*
GUIExamplesFactory
::
createSampleItems
(
const
QString
&
name
,
SampleModel
*
sampleModel
,
MaterialModel
*
materialModel
)
MaterialModel
*
materialModel
)
{
{
QString
exampleName
=
m_
name
_to_
registry
[
name
];
QString
exampleName
=
name
2
registry
[
name
];
SampleBuilderFactory
factory
;
SampleBuilderFactory
factory
;
const
std
::
unique_ptr
<
MultiLayer
>
sample
(
factory
.
createSampleByName
(
exampleName
.
toStdString
()));
const
std
::
unique_ptr
<
MultiLayer
>
sample
(
factory
.
createSampleByName
(
exampleName
.
toStdString
()));
...
...
This diff is collapsed.
Click to expand it.
GUI/Models/GUIExamplesFactory.h
+
1
−
5
View file @
db6b56fc
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#ifndef BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
#ifndef BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
#define BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
#define BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
#include
<Q
Map
>
#include
<Q
String
>
class
SessionItem
;
class
SessionItem
;
class
SampleModel
;
class
SampleModel
;
...
@@ -28,10 +28,6 @@ public:
...
@@ -28,10 +28,6 @@ public:
static
SessionItem
*
createSampleItems
(
const
QString
&
name
,
SampleModel
*
sampleModel
,
static
SessionItem
*
createSampleItems
(
const
QString
&
name
,
SampleModel
*
sampleModel
,
MaterialModel
*
materialModel
);
MaterialModel
*
materialModel
);
private:
static
QMap
<
QString
,
QString
>
m_name_to_registry
;
//!< correspondence of GUI example name and name from StandardSamples registry
};
};
#endif // BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
#endif // BORNAGAIN_GUI_MODELS_GUIEXAMPLESFACTORY_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment