Page 1 of 1

Tcontourseries

Posted: Thu Nov 05, 2015 7:43 am
by 16476632
Is it possible to extract le numerical values of a contourseries for each of the selected levels?

Re: Tcontourseries

Posted: Mon Nov 16, 2015 9:20 am
by yeray
Hello,

Excuse us for the delayed reply here.
Is this what you are trying to do?

Code: Select all

var i: Integer;
begin
  Chart1.Draw;

  for i:=0 to Series1.Levels.Count-1 do
    Memo1.Lines.Add(FormatFloat('#'+FormatSettings.ThousandSeparator+'##0'
      +FormatSettings.DecimalSeparator+'###', Series1.Levels[i].UpToValue));

Re: Tcontourseries

Posted: Tue Dec 01, 2015 8:20 pm
by 16476632
map.png
map.png (180.27 KiB) Viewed 31446 times
What I would like to retrive are to points for each of the above colored lines at the different selected levels.
In the above example, I have lines at Level=59.919 . Level=57.437, ... some levels can be splitted in diffent level curve (here for example L=42.544 or 47.508 or...)
The goal is to save the equipotential/isothrm/equi-xxx positions for an external use.
best regards

Re: Tcontourseries

Posted: Wed Dec 02, 2015 12:06 pm
by yeray
Hello,

I understand you are looking for the arrays of Points into the Segments into the Levels. Here you have a simple example printing all the X and Y values for each Points array in each Segment in each Level:

Code: Select all

var Series1: TContourSeries;

procedure TForm1.FormCreate(Sender: TObject);
var i, j, m: Integer;
    lvl: TContourLevel;
    seg: TLevelSegment;
begin
  Chart1.View3D:=false;
  Series1:=Chart1.AddSeries(TContourSeries) as TContourSeries;
  Series1.FillSampleValues();
  Series1.Marks.Visible:=true;

  Chart1.Draw;

  Memo1.ScrollBars:=ssVertical;
  Memo1.Lines.Clear;
  for i:=0 to Series1.Levels.Count-1 do
  begin
    lvl:=Series1.Levels.Items[i];
    Memo1.Lines.Add('Level: ' + IntToStr(i) + ', UpToValue: ' + FormatFloat('#,##0.###', lvl.UpToValue));

    for j:=0 to length(lvl.Segments)-1 do
    begin
      seg:=lvl.Segments[j];
      Memo1.Lines.Add('Segment: ' + IntToStr(j));

      for m:=0 to length(seg.Points)-1 do
      begin
        Memo1.Lines.Add('Point[' + IntToStr(m) + ']: (' + FormatFloat('#,##0.###', seg.Points[m].X) + ',' + FormatFloat('#,##0.###', seg.Points[m].Y) + ')');
      end;

      Memo1.Lines.Add('');
    end;

    Memo1.Lines.Add('');
  end;
end;

Re: Tcontourseries

Posted: Tue Dec 08, 2015 1:40 pm
by 16476632
Tank you very much! It is exactelly le answer I was loocking for.