Open johannespostler opened 6 years ago
I have made two changes. First one is, that when loading an IFD file, the NameList
will not be populated. The thing is, that the concept of "NameList" is different in IFD file and in the GUI.
The second and very important change is in the way the Clusters
dictionary is populated. Now, there is a Workspace.AddCluster(string id, IFData.Cluster cluster)
method, that does this, while keeping the Clusters
dictionary sorted by value. The type of this dictionary is actually SortedDictionary
which allow access by indices. Sortedness and index access is required by numerical functions.
Regarding filling the NameList
, when the AddCluster(...)
method is called, it checks if the resolution and mass offset values of the supplied cluster are non-zero. If yes, the ID of the cluster is added to the NameList
.
Important thing to note, that this is merely the first of the helper functions to provide a convenient way of populating the NameList
to the GUI. We will definitely have to cater for the use case of adding a cluster to the NameList
much later than when it was added to the Clusters
dictionary and also the case of removing a cluster from the NameList
. I suggest we discuss more about the possible user interactions with the NameList
and continue from there.
There is currently a major problem with the NameList
. The way is is built does not guarantee the entries are sorted by mass. As a consequence, when building the COMList
, MassOffsetList
and ResolutionList
, the values might become garbage. There are two options:
NameList
that ensure the sortedness by mass.COMList
along with the two other lists after they have been created.I marginally prefer the first option, because it eliminates the problem at its origin.
When manuall filling a workspace with data the Calibration.NameList is not populated. I propose to add a custom setter for Cluster.MassOffset und Cluster.Resolution which checks if both values are present and then adds the Cluster ID to Calibration.NameList