диссертация модальная логика
.pdf-321 -
Приложение 1
writeln(faLisp,'(setq ShekW (* DCyl '+qweStr+'))'); readln(faParam,qweStr);
writeln(faLisp,'(setq ShekTol (* DCyl '+qweStr+'))'); closefile(faParain);
reset(faTelo);
while eof(faTelo)=false do begin readln(faTelo,qweStr); writeln(faLisp,qweStr);
end;
closefile(faLisp);
closefile(faTelo); end; {if}
if NewPatt.lbSelForce.Items.Count=0 then exit;
//вычисляем количество значений по Z CurBeg:=NewPatt.seMinOb.VaIue; CurEnd:=NewPatt.seMaxOb.Value; CurStep:=NewPatt.seStepOb.Value; qweReal:=(CurEnd-CurBeg)/CurStep;
if frac(qweReal)=0
then ResolZ:=trunc(qweReal)+l else ResolZ:=trunc(qweReal)+2;
//определяем положение паттерна на экране XPatt:=0; YPatt:=PanelTools.Height+45; BeMouseClick:=false;
repeat
Cursor:=crMultiDrag; getniessage(Mess,getactivewindow,WM_MOUSEFIRST,WM_MOUSELAST); if Mess.message=WM_RBUTTONDOWN then begin
Cursor:=crDefauh;
exit;
end;
if Mess.message=WM_LBUTTONDOWN then begin XPatt:=Mess.pt.x; YPatt:=Mess.pt.y-PanelTools.Height-45; Cursor:=crDefault;
BeMouseClick:=true;
end;
until BeMouseClick;
//
CurRow:=l;
-322-
Приложение 1
CurCol:=l;
//делаем необходимые расчеты Oboroty—CurBeg; MemoFull.Lines.Clear; pbNewPatt:=TProgressBar.Create(sbInfo); pbNewPatt.Parent:=sbInfo; pbNewPatt.Top:=5;
pbNewPatt.Left:=0; pbNewPatt.Height:== 13; pbNewPatt.Visible:=true; pbNewPatt.Max:=ResolZ*2+l; pbNewPatt.Min:=0; pbNewPatt.Step:=2; pbNewPatt.Position:=l; Cursor:=crHourGlass;
while Oboroty<=CurEnd do begin MemoFull.Lines.Append(GetBankName(Oboroty,DiamCyl)); pbNewPatt.StepIt;
Oboroty:=Oboroty+CurStep;
if (Oboroty>CurEnd)and(Oborotyo(CurEnd+CiirStep)) then Oboroty:=CurEnd;
end; {while} Cursor:=crDefault; pbNewPatt.Visible;=false; pbNewPatt.Free;
//организовываем цикл перебора всех выбранных новых диаграмм for NumbDiag:=0 to NewPatt.ibSelForce.Items.Count-1 do begin
///определяем уникальный номер диаграммы inc(NumberOfPattem);
///определяем название силы qweStr:=NewPatt.lbSelForce.Items.Strings[NumbDiag]; IndexOfP:=copy(qweStr,pos('[',qweStr)+l,
pos(T,qweStr)-pos('[',qweStr)-1); if(copy(IndexOfP,l,l)o'5')and(copy(IndexOfP,l,l)o'7') then begin
TypeOfP:-Force'; NameOfF:=copy(qweStr,l,pos(',',qweStr)-l); EdinOfF:=copy(qweStr,pos(',',qweStr)+l,
posC ',qweStr)-pos(',',qweStr)-1);
end {if}
-323 -
Приложение 1
else begin TypeOiP:='Iznos';
NameOfF:=copy(qweStr, 1 ,pos(' ',qweStr)-1); end; {else}
NPartBFile:=strtoint(copy(IndexOfP,3,length(IndexOfP)-2));
///вычисляем размер копируемого куска банковского файла SizeOfPart:=lrunc(TAU/2*360)+l;
if TypeOfP='Force' then begin SizeOfPart:=SizeOfPart*sizeof(real); end {if}
else begin if(copy(NameOfF,l,2))-mm'
then SizeOfPart:=( 1 +(SizeOfPart-1)*2+12)*sizeof(real) else SizeOfPart:=((SizeOfPart-l)*2+12)*sizeof(real);
end; {else}
///создание нового паттерна
NewForm:=nil;
if TypeOfP='Force'then begin NewForm:= TForce.Create(Application); with (NewForm as TForce) do begin
SourceFile:='patt'+inttostr(NumberOfPattern)+'.tmp';
faRes:=TFileStream.Create(SourceFile,fmCreate);
faRes.Free;
NameOfForce:=NameOfF;
EdinOfForce:=EdinOfF;
Taktnost:=TAU;
NBeg:=CurBeg;
NEnd:=CurEnd;
NStep:=CurStep;
NOfZ-ResolZ;
DCyl:=DiamCyl; sbVar.Font.Name:='Times New Roman'; sbVar.Font.Size:=8;
sbVar.Panels[0] .Text;='D-+inttostr(round(DCy1* 1000))+'мм'; NewName:='Cилa '+NameOfF+'';
end; {with} end; {if}
if TypeOfP-Iznos' then begin NewForm:=TIznos.Create(Application); with (NewForm as TIznos) do begin
-324-
Приложение 1
SourceFile:='patt'+inttostr(NumberOfPattern)+'.tmp';
faRes:=TFileStream.Create(SourceFile,finCreate);
faRes.Free;
NameOfForce:=NameOfF;
Ta]ctnost:=TAU;
NOfZ:=ResolZ;
CurNOb:=CurBeg;
with NObTraclc do begin Max:=CurEnd; Mm:=CurBeg; Frequency:=CurStep; LineSize:=CurStep; PageSize:=CurStep; Position:=CurNOb;
end; {with} DCyI:=DiamCyl;
sbVar.Font.Name:='Tinies New Roman'; sbVar.Font.Size:=8; sbVar.Panels[0].Text:-'D='+inttostr(round(DCyl*1000))+'MM'; NewName:='H3Hoc '+NameOfF+'';
end; {with} end; {if}
///определяем габариты новой диаграммы NewForm.Height:=HeightForm;
NewForm. Width:=WidthForm;
///определяем координаты новой диаграммы NewForm.Left:=XPatt+(CurCol-1 )*WidthForm; NewForm.Top:=YPatt+(CurRow-1 )*HeightFonn;
///цикл перебора определяющих переменных NumbZ:=0;
Oboroty:=CurBeg;
while Oboroty<=CurEnd do begin
////определяем полное имя банковского файла BName:=MemoFull.Lines.Strings[NumbZ]; NameBankFile:='bankV+BName+copy(IndexOfP,l,l);
////добавляем новые данные в файл-ресурс по текущим опр-щим перемif TypeOfP='Force' then begin
///// открываем файлы faBank:=TFileStream.Create(NameBankFile,fmOpenRead); faRes:=TFiIeStream.Create((NewForm as TForce).SourceFile,
- 325 -
Приложение 1
fmOpenReadWrite);
///// устанавливаем указатели файлов faBank.Seek(SizeOfPart*(NPartBFile-1 ),soFromBeginning); faRes.Seek(0,soFromEnd);
///// копируем кусок банковского файла faRes.CopyFrom(faBank,SizeOfPart);
///// закрываем файлы
faBank.Free;
faRes.Free;
end;
if TypeOfP-Iznos'then begin
//// / открываем файлы faBank:=TFileStream.Create(NameBankFile,fmOpenRead); faRes:=TFileStream.Create((NewForm as TIznos).SourceFile,
fmOpenReadWrite);
///// устанавливаем указатели файлов faBank.Seek(SizeOfPart*(NPartBFile-l),soFromBeginning); faRes.Seek(0,soFromEnd);
///// копируем кусок банковского файла faRes.CopyFrom(faBank,SizeOfPart);
///// закрываем файлы
faBank.Free;
faRes.Free;
end;
inc(NumbZ);
Oboroty:=Oboroty+CurStep;
if(Oboroty>CurEnd)and(Oborotyo(CurEnd+CurStep)) then Oboroty:=CurEnd;
end; {while}
/// расчитываем остальные хаактеристики новой диаграммы if TypeOfP='Force' then begin
with (NewForm as TForce) do begin GetArray3D;
CalculGabarit;
CreateArrayScreen;
CalculArray2D;
CreateArrayPlane; end; {with}
end; {if}
if TypeOfP='Iznos' then begin
-326- Приложение 1
with (NewForm as TIznos) do begin GetArrayBase;
GetGabarits; end; {with} end; {if}
/// присваиваем заголовок новой картинке NewNumb:=GetNewNumber(NameOfF);
if NewNumb=l
then NewForm.Caption:=NewName
else NewForm.Caption:=NewName+'['+inttostr(NewNumb)+']';
/// настройка координат следующей диаграммы inc(CurCol);
if CurCol>NewPatt.seNOfCol.Value then begin CurCol:=l;
inc(CurRow); end; {if}
end; {for NumbDiag}
// уничтожаем список названий банковских файлов ListOfBF.Free;
end;
procedure TMainForm.moFileCloseClick(Sender: TObject); begin
MainForm.Close;
end;
procedure TMainForm.moSavePattClick(Sender: TObject); begin
// сохраняем все неминимизированные диаграммы SavePattern(false);
end;
procedure TMainForm.moSaveDiagClick(Sender: TObject); begin
// сохраняем только активную диаграмму SavePattem(true);
end;
procedure TMainForm.moLoadPattClick(Sender: TObject); var
-327-
Приложение 1
DiagCounter: byte; NumbSave: byte; FilePatt,FileLoad: TFileStream; LoadForm: TForm; NameOfFL, NameOfFP: string; Size: longint;
SaveStruct: TSaveStruct;
Ang3D0Id: TAngel3D; PStrData: PChar; qweStr: string; NewNumb: byte; begin
PStrData:=SaveStruct.StrData;
//определяем имя считываемого фа11ла и открываем его OpenDialogM.InitiaIDtr:=RootDir;
if OpenDialogM.Execute then NameOfFL:='qwe' else exit; SetCurrentDir(RootDir);
FileLoad:=TFileStream.Create(NameOfFL,fmOpenRead);
//считываем количество сохраненных диаграмм FileLoad.ReadBuffer(NumbSave,sizeof(byte));
//считываем по очереди сохраненные диаграммы
for DiagCounter:=l to NumbSave do begin
///получаем имя файла-ресурса для новой диаграммы и открываем его inc(NumberOfPattem); NameOfFP:='patt4-inttostr(NumberOfPattem)+'.tmp'; FilePatt:=TFileStream.Create(NameOfFP,ftnOpenWrite or fmCreate);
///считываем данные для новой диаграммы FileLoad.ReadBuffer(Size,sizeof(longint)); FilePatt.CopyFrom(FileLoad,Size); FileLoad.ReadBuffer(SaveStruct,sizeof(TSaveStruct)); FileLoad.ReadBuffer(SaveStruct.StrData,20);
///закрываем файл-ресурс
FilePatt.Free;
/// создаем новую диаграмму
if SaveStract.IsForce=true then begin LoadFomi:=TForce.Create(Application); (LoadForm as TForce).SourceFile:=NameOfFP; end
-328 -
Приложение 1
else begin LoadForm:=Tl2nos.Create(Application); (LoadForm as TIznos).SourceFile:=NameOfFP; end;
//// определяем данные из Save-структуры if LoadForm is TForce then
with (LoadForm as TForce),SaveStruct do begin Taktnost:=Tkt;
NBeg:=BegZ;
NEnd:=EndZ;
NStep:=StepZ; NOfZ-Z; DCyl:=D;
sbVar.Font.Name:=Times New Roman'; sbVar.Font.Size:=8;
sbVar.Panels[0].Text:='D='+inttostr(round(DCyl*1000))+'MM'; Precis:=Prcs;
ColorStyle:=CS;
RotAng:=RA;
Ang3D01d:=Ang3D;
Width:=W;
Height:=H;
Left:=L;
Top:=T;
WindowState:=WS; end {with}
else
with (LoadForm as TIznos),SaveStruct do begin Taktnost:=Tkt;
CurNOb:=CurOb;
NObTrack.Max:=EndZ;
NObTrack.Min:=BegZ;
NObTrack.Frequency:=StepZ;
NObTrack.LineSize:=StepZ;
NObTrack.PageSize:=StepZ;
NObTrack.Position:=CurOb;
NOfZ:=Z;
DCyl:=D;
sbVar.Font.Name:='Times New Roman'; sbVar.Font.Size:=8;
-329-
Приложение 1
sbVar.Panels[0].Text:-D='+mttostr(round(DCyl*1000))+'MM'; chPolar:=chP;
chIznos:=chI;
chFit:=chF;
Precis:=Prcs;
Width:=W;
Height:=H;
Left:=L;
Top:=T;
WindowState:=WS; end; {with}
//// расшифровываем строковые данные qweStr:=StrPas(PStrData);
if LoadForm is TForce then
with (LoadForm as TForce) do begin NameOfForce:=copy(qweStr, 1 ,pos(V,qweStr)-1); EdinOfForce:=copy(qweStr,pos(','!qweStr)+1,
length(qweStr)-pos(',',qweStr));
end {with} else
with (LoadForm as TIznos) do begin NameOfForce:=copy(qweStr,I,pos(V,qweStr)-l); end; {with}
////присваиваем заголовок новой диаграмме if LoadForm is TForce then
with (LoadForm as TForce) do begin NewNumb:=GetNewNumber(NameOfForce); ifNewNumb=l
then Сар11оп:='Сила 4-NameOfForce+''
else Caption—'Сила '+NameOfForce+' '+'['+inttostr(NewNumb)+']'; end {with}
else
with (loadForm as TIznos) do begin NewNumb:=GetNewNumber(NameOfForce); ifNewNumb=l
then Caption—'Износ '+NameOfForce+''
else Caption:='H3Hoc '+NameOfForce+' '+'['+inttostr(NewNumb)+']'; end;
////формируем массивы данных диаграммы
-330 -
Приложение 1
if LoadForm is TForce then
with (LoadFonn as TForce) do begin GetArray3D;
CalculGabarit;
with Ang3D01d do begin RotateBase(y,OYAng,false); RotateBase('x',OXAng,false); RotateBase('z',OZAng,false); end; {with} CreateArrayScreen; CalculArray2D; CreateArrayPlane; OutSpace.RePaint;
end {with} else
with (LoadForm as TIznos) do begin GetArrayBase;
GetGabarits;
OutSpace.Repaint;
end;
end; {for DiagCounter:=l to NumbSave} // закрываем считываемый файл FileLoad.Free;
end;
procedure TMainForm.SavePattera(OneActive: boolean); var
DiagCounter: byte; CurDiag: TForm; NumbOfCur: byte;
FilePatt,FileSave: TFileStream; Size: longint;
NameOfFS: string; SaveStruct: TSaveStruct; Ang3D01d: TAngeBD; PStrData,qwePStr: PChar;
NumbSave: byte; // количество сохраняемых диаграмм begin {procedure SavePattem}
// если активной диаграммы нет, то выход