Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KStars
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Education
KStars
Commits
3c5965ae
Commit
3c5965ae
authored
Oct 11, 2020
by
Akarsh Simha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement CatalogComponent::findByName method for custom catalogs.
parent
bcaa1304
Pipeline
#48400
passed with stages
in 63 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
kstars/skycomponents/catalogcomponent.cpp
kstars/skycomponents/catalogcomponent.cpp
+9
-0
kstars/skycomponents/catalogcomponent.h
kstars/skycomponents/catalogcomponent.h
+8
-0
kstars/skycomponents/deepskycomponent.h
kstars/skycomponents/deepskycomponent.h
+2
-0
No files found.
kstars/skycomponents/catalogcomponent.cpp
View file @
3c5965ae
...
...
@@ -128,11 +128,13 @@ void CatalogComponent::_loadData(bool includeCatalogDesignation)
if
(
!
dupName
)
{
objectLists
(
obj
->
type
()).
append
(
QPair
<
QString
,
const
SkyObject
*>
(
name
,
obj
));
nameHash
[
name
.
toLower
()]
=
obj
;
}
if
(
!
longname
.
isEmpty
()
&&
!
dupLongname
&&
name
!=
longname
)
{
objectLists
(
obj
->
type
()).
append
(
QPair
<
QString
,
const
SkyObject
*>
(
longname
,
obj
));
nameHash
[
longname
.
toLower
()]
=
obj
;
}
}
}
...
...
@@ -255,3 +257,10 @@ bool CatalogComponent::selected()
return
false
;
}
SkyObject
*
CatalogComponent
::
findByName
(
const
QString
&
name
)
{
if
(
nameHash
.
contains
(
name
.
toLower
()))
return
nameHash
[
name
.
toLower
()];
return
nullptr
;
}
kstars/skycomponents/catalogcomponent.h
View file @
3c5965ae
...
...
@@ -53,6 +53,8 @@ class CatalogComponent : public ListComponent
void
update
(
KSNumbers
*
num
)
override
;
SkyObject
*
findByName
(
const
QString
&
name
)
override
;
/** @return the name of the catalog */
inline
QString
name
()
const
{
return
m_catName
;
}
...
...
@@ -97,4 +99,10 @@ class CatalogComponent : public ListComponent
bool
m_Showerrs
{
false
};
int
m_ccIndex
{
0
};
quint32
updateID
{
0
};
private:
// FIXME: Keeping both the objectNames data structure and the
// nameHash seems overkill -- asimha
QHash
<
QString
,
SkyObject
*>
nameHash
;
};
kstars/skycomponents/deepskycomponent.h
View file @
3c5965ae
...
...
@@ -171,6 +171,8 @@ class DeepSkyComponent : public SkyComponent
void
appendIndex
(
DeepSkyObject
*
o
,
DeepSkyIndex
*
dsIndex
,
Trixel
trixel
);
// FIXME: Keeping both the objectNames data structure and the
// nameHash seems overkill -- asimha
QHash
<
QString
,
DeepSkyObject
*>
nameHash
;
/** @short adds a label to the lists of labels to be drawn prioritized by magnitude. */
...
...
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