SHARE
TWEET

Untitled

a guest Feb 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. interface
  2. uses
  3.   dialogs, math, dateutils, SysUtils, classes;
  4. type
  5.      //double = extended;  
  6.      TDoubleDoubleArray = array of array of double;
  7.      TSunPositionAlgorithm = class (TObject)
  8.          private
  9.            FLocationChanged: boolean;
  10.          public
  11.            Constructor Create;
  12.            Destructor Destroy;
  13.            procedure SetDefaults;
  14.          end;
  15.   Var
  16.     SunPositionAlgorithm : TSunPositionAlgorithm;
  17.            F_L0: Double;
  18.            F_L1: TDoubleDoubleArray;
  19.  
  20. implementation
  21.   {TSunPositionAlgorithm }
  22.  
  23. constructor TSunPositionAlgorithm.Create;
  24. begin
  25.   SetDefaults;
  26. end;
  27.  
  28. procedure TSunPositionAlgorithm.SetDefaults;
  29. Begin
  30. F_L0:= 1;                   // works ok
  31.   FLocationChanged:=true;  // throws eaccess violation error
  32. End;
  33.    
  34. procedure TSun.NRELPositionOfSun(const DateTime: TDateTime; var Azimuth, Elevation, Declination: double);
  35.   Var
  36.  
  37.     LSunPositionAlgorithm : TSunPositionAlgorithm;
  38.   Begin
  39.     LSunPositionAlgorithm := TSunPositionAlgorithm.Create;
  40.     Try
  41.       LSunPositionAlgorithm.SetDefaults;
  42.  
  43.   blah..
  44.  
  45.  
  46.     Finally
  47.       LSunPositionAlgorithm.Destroy;
  48.     End;
  49.   End;
  50.    
  51. procedure Test;
  52. var
  53.   spa: TSunPositionAlgorithm;
  54. begin
  55.   spa := TSunPositionAlgorithm.Create;
  56.   try
  57.     spa.SetDefaults;
  58.   finally
  59.     spa.Free;
  60.   end;
  61. end;
  62.    
  63. procedure Test;
  64. var
  65.   spa: TSunPositionAlgorithm;
  66. begin
  67.   spa.SetDefaults;//oops, spa has not been initialised yet  
  68. end;
  69.    
  70. procedure Test;
  71. var
  72.   spa: TSunPositionAlgorithm;
  73. begin
  74.   spa.Create;//oops, spa has not been initialised yet  
  75. end;
  76.    
  77. destructor Destroy; override;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top