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
fad20152
Commit
fad20152
authored
2 years ago
by
Mikhail Svechnikov
Committed by
Mikhail Svechnikov
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MaskContainerItem: use SelectionVector
parent
76750f7a
No related branches found
No related tags found
1 merge request
!1336
GUI: masks are not inherited from SessionItem anymore
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Data/ProjectionItems.cpp
+3
-3
3 additions, 3 deletions
GUI/Model/Data/ProjectionItems.cpp
GUI/Model/Device/MaskItems.cpp
+11
-21
11 additions, 21 deletions
GUI/Model/Device/MaskItems.cpp
GUI/Model/Device/MaskItems.h
+1
-2
1 addition, 2 deletions
GUI/Model/Device/MaskItems.h
with
15 additions
and
26 deletions
GUI/Model/Data/ProjectionItems.cpp
+
3
−
3
View file @
fad20152
...
...
@@ -47,9 +47,9 @@ void ProjectionContainerItem::verifyMask(MaskItem* maskItem) const
QVector
<
SessionItem
*>
ProjectionContainerItem
::
projectionsOfType
(
const
QString
&
projectionType
)
{
QVector
<
SessionItem
*>
projections
;
for
(
MaskItem
*
projection
:
m_maskItems
)
{
if
(
proj
ection
->
modelType
()
==
projectionType
)
projections
.
push_back
(
proj
ection
);
for
(
const
auto
&
proj
:
m_maskItems
)
{
if
(
proj
.
currentItem
()
->
modelType
()
==
projectionType
)
projections
.
push_back
(
proj
.
currentItem
()
);
}
return
projections
;
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Device/MaskItems.cpp
+
11
−
21
View file @
fad20152
...
...
@@ -58,24 +58,13 @@ MaskContainerItem::MaskContainerItem(const QString& modelType)
QVector
<
MaskItem
*>
MaskContainerItem
::
maskItems
()
const
{
return
m_maskItems
;
}
std
::
vector
<
SelectionProperty
<
MaskItemCatalog
>>
MaskContainerItem
::
maskItemSelections
()
const
{
std
::
vector
<
SelectionProperty
<
MaskItemCatalog
>>
maskSelections
;
for
(
MaskItem
*
maskItem
:
m_maskItems
)
{
SelectionProperty
<
MaskItemCatalog
>
newMaskSelection
;
newMaskSelection
.
setCurrentItem
(
maskItem
);
maskSelections
.
push_back
(
std
::
move
(
newMaskSelection
));
}
return
maskSelections
;
return
m_maskItems
.
toQVector
();
}
void
MaskContainerItem
::
insertMask
(
int
row
,
MaskItem
*
maskItem
)
{
maskItem
->
setParentAndModel
(
this
,
SessionItem
::
model
());
m_maskItems
.
insert
(
row
,
maskItem
);
m_maskItems
.
insert
_at
(
row
,
maskItem
);
}
void
MaskContainerItem
::
addMask
(
MaskItem
*
maskItem
)
...
...
@@ -91,19 +80,19 @@ void MaskContainerItem::moveMask(int from_row, int to_row)
void
MaskContainerItem
::
removeMaskAt
(
int
row
)
{
m_maskItems
.
removeA
t
(
row
);
m_maskItems
.
delete_a
t
(
row
);
}
void
MaskContainerItem
::
removeMask
(
MaskItem
*
maskItem
)
{
m_maskItems
.
removeOne
(
maskItem
);
m_maskItems
.
delete_element
(
maskItem
);
}
RegionOfInterestItem
*
MaskContainerItem
::
regionOfInterestItem
()
const
{
for
(
MaskItem
*
maskItem
:
m_maskItems
)
if
(
maskItem
->
modelType
()
==
RegionOfInterestItem
::
M_TYPE
)
return
dynamic_cast
<
RegionOfInterestItem
*>
(
maskItem
);
for
(
const
auto
&
maskSel
:
m_maskItems
)
if
(
mask
Sel
.
current
Item
()
->
modelType
()
==
RegionOfInterestItem
::
M_TYPE
)
return
dynamic_cast
<
RegionOfInterestItem
*>
(
mask
Sel
.
current
Item
()
);
return
nullptr
;
}
...
...
@@ -125,12 +114,12 @@ int MaskContainerItem::size() const
MaskItem
*
MaskContainerItem
::
at
(
const
int
idx
)
{
return
m_maskItems
.
at
(
idx
);
return
m_maskItems
.
at
(
idx
)
.
currentItem
()
;
}
int
MaskContainerItem
::
indexOfItem
(
MaskItem
*
maskItem
)
const
{
return
m_maskItems
.
index
O
f
(
maskItem
);
return
m_maskItems
.
index
_o
f
(
maskItem
);
}
void
MaskContainerItem
::
copy
(
const
MaskContainerItem
*
maskContainer
)
...
...
@@ -156,7 +145,7 @@ void MaskContainerItem::writeTo(QXmlStreamWriter* w) const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
for
(
const
SelectionProperty
<
MaskItemCatalog
>
&
sel
:
maskItem
Selections
()
)
{
for
(
const
auto
&
sel
:
m_
maskItem
s
)
{
w
->
writeStartElement
(
Tag
::
Mask
);
sel
.
writeTo
(
w
);
w
->
writeEndElement
();
...
...
@@ -948,6 +937,7 @@ void MaskContainerModel::setParent(QObject* parent)
void
MaskContainerModel
::
insertMask
(
int
row
,
MaskItem
*
maskItem
)
{
// TODO: unused method. Remove it?
QAbstractListModel
::
beginInsertRows
(
maskContainer
->
rootIndex
,
row
,
row
);
maskContainer
->
insertMask
(
row
,
maskItem
);
// QModelIndex idx = index(row, 0, {});
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Device/MaskItems.h
+
1
−
2
View file @
fad20152
...
...
@@ -230,7 +230,6 @@ public:
MaskContainerItem
(
const
QString
&
modelType
);
QVector
<
MaskItem
*>
maskItems
()
const
;
std
::
vector
<
SelectionProperty
<
MaskItemCatalog
>>
maskItemSelections
()
const
;
//! Insert mask at given row.
virtual
void
insertMask
(
int
row
,
MaskItem
*
maskItem
);
...
...
@@ -280,7 +279,7 @@ public:
const
QModelIndex
rootIndex
;
protected
:
Q
Vector
<
MaskItem
*
>
m_maskItems
;
Selection
Vector
<
MaskItem
Catalog
>
m_maskItems
;
MaskContainerModel
*
m_model
=
nullptr
;
};
...
...
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