Recent

Author Topic: wave simulation  (Read 12120 times)

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: wave simulation
« Reply #15 on: June 20, 2015, 07:03:40 am »
@howardpc:
You are right, i wanted to point that out on my last post that there is a mem-leak (i had not figured out where), but i was a little in a hurry.
So:
Code: [Select]
  [...]
  //Open pic
   bitmap := tbitmap.create;
   resizedbitmap := tbitmap.create;
   TRY  // <--
   bitmap.loadfromfile(FDataDir + DirectorySeparator+'WaveSim'+ DirectorySeparator+'Jakarta.bmp');
   newheight := Round(MapH/4);  //resize pic
   newwidth := Round(MapW/4);
[...]
   resizedbitmap.Canvas.StretchDraw(stretchrect, bitmap);
   Image1.picture.bitmap := resizedbitmap;


  ShowMessage(' MapW = '+FloatToStr(MapW)+ ' MapH = ' + FloatToStr(MapH)+' DataMax = '
       + FloatToStr(DataMax) + ' DataMin = '+ FloatToStr(DataMin));
  FINALLY // <---
    freeandnil(bitmap); // <---
    freeandnil(resizedbitmap); // <---
  end;
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Farida Basri

  • New member
  • *
  • Posts: 7
Re: wave simulation
« Reply #16 on: June 21, 2015, 04:50:01 am »
Hi jc99
Thank you for your help  :)
but, can you answer my question about :

1) Why i used this code :
 assert( fileExists (FDataDir + DirectorySeparator+'WaveSim'+ DirectorySeparator+'oki.txt'), 'No Oki.txt - File');

 AssignFile(F,FDataDir + DirectorySeparator+'WaveSim'+ DirectorySeparator+'oki.txt');
 
because normally when i want to put directory for my map i used :
AssignFile(F,'D:\\Smad-Lock(Brankas_Smadav)\\#MATH MODEL#\\JakartaOk7_Edit\\JakartaOk7\\JakartaOk\\oki.txt');


2) Could you explain, what you mean with directory separator? sorry, but i am confused  :(
     
« Last Edit: June 21, 2015, 04:52:54 am by Farida Basri »

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: wave simulation
« Reply #17 on: June 21, 2015, 05:40:49 am »
1) Why i used this code :
 assert( fileExists (FDataDir + DirectorySeparator+'WaveSim'+ DirectorySeparator+'oki.txt'), 'No Oki.txt - File');

 AssignFile(F,FDataDir + DirectorySeparator+'WaveSim'+ DirectorySeparator+'oki.txt');
 
because normally when i want to put directory for my map i used :
AssignFile(F,'D:\\Smad-Lock(Brankas_Smadav)\\#MATH MODEL#\\JakartaOk7_Edit\\JakartaOk7\\JakartaOk\\oki.txt');
Assert makes sure the some axioms are set.
Here: that the file exists.

You used an absolute path.
This is fine as long you are the only on to run your App.
But no one else can run your app.
And not even you when you move it to another computer.
So you should set it to something relative to your Exe , or your Home-Dir, or somthing more project related.

2) Could you explain, what you mean with directory separator? sorry, but i am confused  :(
DirectorySeparator is replacement for '\' on windows, and '/' on Linux or whatever character an operating system is using to separate directories in a path.

I have a strict separation between files.
Project, source, data and binary-files are each in separate folders. (So i can switch between compilers, computers, os's ... )
Project: .\fpc, .\dxe, .\d7 ...
Source: .\source
Data: ..\data\<pro>
Bin: ..\bin\<target>
   Units: ..\bin\<target>\units
To get the thing running I had to move your data-files.
in your case I suggest you initialize FBaseDir to 'D:\\Smad-Lock(Brankas_Smadav)\\#MATH MODEL#\\JakartaOk7_Edit' or whatever you see as your basic Project-path.
and fill the rest in like  + DirectorySeparator+'JakartaOk7'+ DirectorySeparator+ 'JakartaOk'+ DirectorySeparator+
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Farida Basri

  • New member
  • *
  • Posts: 7
Re: wave simulation
« Reply #18 on: July 01, 2015, 04:23:48 pm »
hi jc99
hi osddeitf
hi howardpc

hi friends, i really appreciate your help to me.
nice to know about all of you :)
thank you very much


 

TinyPortal © 2005-2018