Repository navigation
Expand file tree
/
Copy pathPiplt.pas
More file actions
240 lines (223 loc) · 8.09 KB
/
Copy pathPiplt.pas
File metadata and controls
240 lines (223 loc) · 8.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
unit Piplt;
interface
uses Types, Windows, Graphics, SysUtils, LowHem, Inspect, math, Results, Settings;
type
TPiPlot = class(TLHWin)
procedure FormCreate(Sender: TObject; const AFilename: string; const AExtension: TExtension); override;
procedure Compute(Sender: TObject); override;
procedure Angelier1Click(Sender: TObject); override;
procedure Paste1Click(Sender: TObject); override;
end;
TSmallCircleFm = class(TLHWin)
private
OpeningAngle, Azimuth, Plunge: Integer;
public
procedure Open(Sender: TObject; FOpeningAngle, FAzimuth, FPlunge: Integer; FLabel: String);
procedure Compute(Sender: TObject); override;
end;
var Piplot: TPiplot;
implementation
uses Fileops, Draw, TecMain;
procedure TSmallCircleFm.Compute(Sender: TObject);
begin
Screen.Cursor := CrHourGlass;
try
PrepareMetCan(LHMetCan, LHMetafile, LHEnhMetafile, LHWriteWMF);
SetBackground(Sender, LHMetCan.Handle);
North;
NumberLabel;
{**********************************************************************}
SmallCircle2(LHMetCan.Handle, Canvas, CenterX, CenterY, Radius, Azimuth, Plunge,
OpeningAngle, LHSymbSize, LHSymbfillflag, LHSymbType, LHFillBrush, LHPen.Handle);
LHPen.Style:=psSolid;
Lineation(LHMetCan.Handle,Nil,CenterX,CenterY,Radius,Azimuth,Plunge,LHSymbSize,
plunge ,False,LHSymbFillflag,LHSymbType,LHFillBrush, LHPen.Handle);
inherited;
finally
LHMetCan.Free;
Screen.Cursor := CrDefault;
end;
end;
procedure TSmallCircleFm.Open(Sender: TObject; FOpeningAngle, FAzimuth, FPlunge: Integer; FLabel: String);
begin
LHPlotType:=pt_SmallCircle;
Number1.Visible:=False;
TecmainWin.ArrangeMenu(Sender);
SetLHProperties(LHPlotType);
OpeningAngle:= FOpeningAngle;
Azimuth:=FAzimuth;
Plunge:=FPlunge;
LHLabel1:=FLabel;
Canvas.Font:=TecMainWin.Fontdialog1.font;
LHOnceClick := False;
LHPasteMode := False;
LHCopyMode := False;
LHWriteWMF:=WriteWmfGlobal;
CreateMetafile(LHMetafile, LHEnhMetafile, LHWriteWMF);
Label1.Checked:=GlobalLHLabel;
Compute(Sender);
Inc(GlobalLHPlots);
LHPlotNumber:=GlobalLHPlots;
Caption:='Plot '+IntToStr(LHPlotNumber)+': '+Caption;
if ResInsp<>nil then ResInsp.Initialize(Self);
if Inspectorform<>nil then InspectorForm.Initialize(Self);
if SetForm<>nil then SetForm.Initialize(Self);
end;
procedure TPiplot.FormCreate(Sender: TObject; const AFilename: string; const AExtension: TExtension);
begin
LHTectonicData:=td_unknown;
if Sender=TecMainWin.Lineations1 then
begin //data are lineations
LHPlotType:=pt_Lineation;
Angelier1.Checked:=False;
Angelier2.Checked:=Angelier1.Checked;
If (Pos('_fa', LowerCase(ExtractFilename(AFilename)))<>0) or (Pos('-fa', LowerCase(ExtractFilename(AFilename)))<>0) then
LHTectonicData:=td_FoldAxis; //fold axes
if RecognizeTectonicData then
case LHTectonicData of
td_FoldAxis: LinSymbType:=syTriangle;
td_unknown: PiSymbType:=syCross;
end;
end
else
begin //data are planes
If Pos('s0', LowerCase(ExtractFilename(AFilename)))<>0 then LHTectonicData:=td_BeddingPlane; //bedding planes
If Pos('_fap', LowerCase(ExtractFilename(AFilename)))<>0 then LHTectonicData:=td_FoldAxialPlane; //fold axial plane
If Pos('s1', LowerCase(ExtractFilename(AFilename)))<>0 then LHTectonicData:=td_Foliation1; //first foliation
If Pos('s2', LowerCase(ExtractFilename(AFilename)))<>0 then LHTectonicData:=td_Foliation2; //2nd foliation
If Pos('s3', LowerCase(ExtractFilename(AFilename)))<>0 then LHTectonicData:=td_Foliation3; //3rd foliation
Plottype1.Enabled:=True;
Plottype2.Enabled:=True;
Angelier1.Caption:='&Great circles';
Angelier2.Caption:=Angelier1.Caption;
Hoeppener1.Caption:='P&i Plot';
Hoeppener2.Caption:=Hoeppener1.Caption;
//******begin changes for demo-version**********
{PtAxes1.Caption:='Dip lines';
PtAxes2.Caption:=PtAxes1.Caption;}
ptaxes1.Enabled:=False;
ptaxes1.Visible:=False;
ptaxes2.Enabled:=ptaxes1.Enabled;
ptaxes2.Visible:=ptaxes1.Visible;
//******end changes for demo version*******
if Sender=TecMainWin.PiPlot1 then
begin //piplot
LHPlotType:=pt_PiPlot;
Hoeppener1.Checked:=True;
Hoeppener2.Checked:=True;
if RecognizeTectonicData then
case LHTectonicData of
td_BeddingPlane: PiSymbType:=syCircle;
else PiSymbType:=syStar;
end;
end
else If Sender=TecMainWin.GreatCircles1 then //greatcircle
begin
LHPlotType:=pt_GreatCircle;
if RecognizeTectonicData then
case LHTectonicData of
td_BeddingPlane: GreatPenStyle:=psDot;
td_FoldAxialPlane: GreatPenStyle:=psDashDot;
td_Foliation1: GreatPenStyle:=psDash;
td_unknown: GreatPenStyle:=psSolid;
end;
end
else
begin
PtAxes1.Checked:=True;
PtAxes2.Checked:=True;
LHPlotType:=pt_DipLine; //dip line
end;
end;
inherited;
if Sender=TecMainWin.PiPlot1 then LHPoleFlag:=true;
end;
procedure TPiPlot.Compute;
var
Azimuth, Plunge : Single;
F : TextFile;
Nocomment : boolean;
comment: String;
begin
Screen.Cursor := CrHourGlass;
try
PrepareMetCan(LHMetCan, LHMetafile, LHEnhMetafile, LHWriteWMF);
SetBackground(Sender, LHMetCan.Handle);
Try {Open file and get data}
AssignFile(F, LHFilename);
Reset(F);
if not Eof(F) then
begin
LHz := 0;
LHMetCanHandle:=LHMetCan.Handle;
North;
if Angelier1.Checked then LHMetCan.Pen.Style := LHPen.Style;
while not Eof(F) and not LHfailed do
begin
ReadPLNDataset(F, Azimuth, Plunge, LHFailed, NoComment, Comment);
if not LHfailed and NoComment then
begin
if Angelier1.Checked then //greatcircles
begin
//GreatCircle2(LHMetCanHandle,Canvas,CenterX,CenterY,Radius,Azimuth, Plunge,
// LHz, Number1.Checked, LHPen.Handle, LHLogPen);
GreatCircle(LHMetCanHandle,Canvas,CenterX,CenterY,Radius,Azimuth, Plunge,
LHz, Number1.Checked, LHPen.Handle, LHLogPen);
end
else
begin
if (LHPlotType<>pt_Lineation) and (LHPlotType<>pt_DipLine) then //bugfix 990818
begin //dipline added 000321
Azimuth:=Round((Azimuth+180)) mod 360;
Plunge:=90-Plunge;
end;
Lineation(LHMetCanHandle,Canvas,CenterX,CenterY,Radius,Azimuth,Plunge,
LHSymbSize,LHz,Number1.checked,LHSymbFillFlag,LHSymbType, LHFillBrush, LHPen.Handle);
end;
if not Eof(f) then Inc(LHz);
end else if not NoComment then dec(LHz);
end; {end of while-loop}
end else LHfailed:= true;
CloseFile(F);
if not LHfailed then
begin
NumberLabel;
inherited;
end;
except {can not open file}
On EInOutError do Fileused:=true;
end;
finally
LHMetCan.Free;
Screen.Cursor := CrDefault;
end;
if LHfailed or fileused then FileFailed(Piplot);
end;
procedure TPiPlot.Angelier1Click(Sender: TObject);
begin
if (Sender=Angelier1) or (Sender=Angelier2) then //Great Circle
begin
LHPoleFlag:=False;
Caption:='Great circle plot - [' +ExtractFileName(LHFilename) +']';
LHPlotType:=pt_GreatCircle;
end
else if (Sender=Hoeppener1) or (Sender=Hoeppener2) then //Pi Plot
begin
LHPoleFlag:=True;
Caption:= 'Pi-Plot - [' +ExtractFileName(LHFilename) +']';
LHPlotType:=pt_PiPlot;
end
else begin //Dip Lines
LHPoleFlag:=False;
Caption:= 'Dip lines - [' +ExtractFileName(LHFilename) +']';
LHPlotType:=pt_DipLine;
end;
inherited;
end;
procedure TPiPlot.Paste1Click(Sender: TObject);
begin
inherited;
Plottype1.Enabled:=False;
Plottype2.Enabled:=Plottype1.Enabled;
end;
end.