[Kst] [Bug 252874] New: Change Data File creates too many duplicates

Nicolas Brisset nicolas.brisset at eurocopter.com
Thu Sep 30 16:24:36 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=252874

           Summary: Change Data File creates too many duplicates
           Product: kst
           Version: 2.0.1
          Platform: Compiled Sources
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: kst at kde.org
        ReportedBy: nicolas.brisset at eurocopter.com


Version:           2.0.1
OS:                Linux

Using the Tools->Change Data File tool, it should be possible to substitute the
current data with data coming from another file (seems to work), but also and
more interestingly to duplicate all curves depending on those data.
An example will surely be clearer...

Suppose you have vectors Y1, Y2, Y3 and X in data1.dat, and the same vectors in
data2.dat from the same experiments conducted under slightly different
conditions. You want to compare the two. 
- you load the vectors from data1.dat and create 3 curves (Y1 vs X, Y2 vs X, Y3
vs X). So far, so good. 
- now, you'd like to compare with results in data2.dat => you fire up the
"Change Data File" tool and select all vectors from data1.dat, then check
"duplicate selected vectors and matrices" and "Duplicate dependents" to also
get the new curves, not just the new vectors.
- hit apply: the vectors are duplicated correctly, but you also get a load of
new curves: Y1 vs X', Y1' vs X, Y1' vs X' and the same for the other vectors.
That's way too much!

The code is not completely trivial, so I'm not yet sure what it exactly does.
But what I think it should do is:
1) replace or duplicate all selected vectors and matrices - if duplicating,
store the correspondence between old and new (QMap<DataVectorPtr,
DataVectorPtr> duplicatedVectors; seems unused, maybe that's what it's for?) 
2) only when done treating primitive objects (vectors, matrices), and if
duplicating dependents call duplicateDependents(), passing it the list of
substitutions to perform
3) for each relation, iterate over its inputs
  3.1) for each input check whether it has been duplicated
    3.1.1) if the input has been duplicated, and the relation not yet =>
duplicate the relation and substitute that input with the new one
    3.1.2) if the input has been duplicated and the relation as well already =>
just substitute the input
4) add the substituted relations to plots ("render items")
5) call update()

This way, I think we cover all cases cleanly. In the example above, each curve
would be duplicated only once and it would even be possible to plot the new Y'
vectors against the old X (by not selecting X in the list).

Reproducible: Always

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Kst mailing list