[lddp-cvs-commits] SF.net SVN: lddp:[372] trunk
Brought to you by:
billthefish,
c_schmitz
From: <bil...@us...> - 2009-06-10 07:44:58
|
Revision: 372 http://lddp.svn.sourceforge.net/lddp/?rev=372&view=rev Author: billthefish Date: 2009-06-10 07:43:44 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Simplified TDATError Modified Paths: -------------- trunk/Current Build/LDDesignPad.exe trunk/DAT Tools/DATCheck.pas trunk/lddp/errorbar.pas trunk/lddp/main.pas Modified: trunk/Current Build/LDDesignPad.exe =================================================================== (Binary files differ) Modified: trunk/DAT Tools/DATCheck.pas =================================================================== --- trunk/DAT Tools/DATCheck.pas 2009-06-05 17:14:38 UTC (rev 371) +++ trunk/DAT Tools/DATCheck.pas 2009-06-10 07:43:44 UTC (rev 372) @@ -31,24 +31,21 @@ Contnrs; type - TDATErrorType = (deRowAllZeros, deYColumnAllZeros, deSigularMatrix, - deCollinearVertices, deIdenticalVertices, deConcaveQuad, - deBowtieQuad, deNonCoplanerVertices, deIdenticalLine, - deColor24Illegal, deNil); + TDATErrorType = (deRow1AllZeros, deRow2AllZeros, deRow3AllZeros, + deYColumnAllZeros, deSigularMatrix, + deCollinearVertices123, deCollinearVertices124, + deCollinearVertices134, deCollinearVertices234, + deCollinearVerticesAll, deIdenticalVertices, + deConcaveQuadSplit13, deConcaveQuadSplit24, + deBowtieQuad1423, deBowtieQuad1243, deNonCoplanerVerticesDet, + deNonCoplanerVerticesDist, deNonCoplanerVerticesNormAngle, + deIdenticalLine, deColor24Illegal, deNil); TDATCoplanerType = (ctDet, ctDist, ctNormalAngle); - TDATCollinearType = (clPoints123, clPoints124, clPoints134, clPoints234, clPointsAll); TDATError = class(TObject) ErrorType: TDATErrorType; - Row: Byte; - CollinearValue: Extended; - CollinearType: TDATCollinearType; - IsBowtieType1423: Boolean; - CoplanerValue: Extended; - CoplanerType: TDATCoplanerType; - SplitOn24: Boolean; - Line: Integer; + ErrorValue: Extended; procedure Assign(AError: TDATError); end; @@ -85,14 +82,7 @@ procedure TDATError.Assign(AError: TDATError); begin ErrorType := AError.ErrorType; - Row := AError.Row; - CollinearValue := AError.CollinearValue; - CollinearType := AError.CollinearType; - IsBowtieType1423 := AError.IsBowtieType1423; - CoplanerValue := AError.CoplanerValue; - CoplanerType := AError.CoplanerType; - SplitOn24 := AError.SplitOn24; - Line := AError.Line; + ErrorValue := AError.ErrorValue; end; function SubPartIsXZPrimitive(const Subp: string): Boolean; @@ -231,8 +221,11 @@ if det <> 0 then begin error := TDATError.Create; - error.ErrorType := deRowAllZeros; - error.Row := i; + case i of + 1: error.ErrorType := deRow1AllZeros; + 2: error.ErrorType := deRow1AllZeros; + 3: error.ErrorType := deRow1AllZeros; + end; Result.Add(error); Break; end; @@ -316,9 +309,8 @@ if dp < CollinearPointsThreshold then begin error := TDATError.Create; - error.ErrorType := deCollinearVertices; - error.CollinearValue := dp; - error.CollinearType := clPointsAll; + error.ErrorType := deCollinearVerticesAll; + error.ErrorValue := dp; Result.Add(error); end; end; @@ -353,9 +345,8 @@ if cp < CollinearPointsThreshold then begin error := TDATError.Create;; - error.ErrorType := deCollinearVertices; - error.CollinearValue := cp; - error.CollinearType := clPoints123; + error.ErrorType := deCollinearVertices123; + error.ErrorValue := cp; Result.Add(error); Exit; end; @@ -364,9 +355,8 @@ if cp < CollinearPointsThreshold then begin error := TDATError.Create;; - error.ErrorType := deCollinearVertices; - error.CollinearValue := cp; - error.CollinearType := clPoints124; + error.ErrorType := deCollinearVertices124; + error.ErrorValue := cp; Result.Add(error); Exit; end; @@ -375,9 +365,8 @@ if cp < CollinearPointsThreshold then begin error := TDATError.Create;; - error.ErrorType := deCollinearVertices; - error.CollinearValue := cp; - error.CollinearType := clPoints134; + error.ErrorType := deCollinearVertices134; + error.ErrorValue := cp; Result.Add(error); Exit; end; @@ -386,9 +375,8 @@ if cp < CollinearPointsThreshold then begin error := TDATError.Create;; - error.ErrorType := deCollinearVertices; - error.CollinearValue := cp; - error.CollinearType := clPoints234; + error.ErrorType := deCollinearVertices234; + error.ErrorValue := cp; Result.Add(error); Exit; end; @@ -409,8 +397,7 @@ if (B and (not C)) or (C and (not B)) then begin error := TDATError.Create;; - error.ErrorType := deConcaveQuad; - error.SplitOn24 := False; + error.ErrorType := deConcaveQuadSplit13; Result.Add(error); end; end @@ -419,30 +406,26 @@ if C then begin error := TDATError.Create;; - error.ErrorType := deConcaveQuad; - error.SplitOn24 := True; + error.ErrorType := deConcaveQuadSplit24; Result.Add(error); end else begin error := TDATError.Create;; - error.ErrorType := deBowtieQuad; - error.IsBowtieType1423 := True; + error.ErrorType := deBowtieQuad1423; Result.Add(error); end else if C then begin error := TDATError.Create;; - error.ErrorType := deBowtieQuad; - error.IsBowtieType1423 := False; + error.ErrorType := deBowtieQuad1243; Result.Add(error); end else begin error := TDATError.Create;; - error.ErrorType := deConcaveQuad; - error.SplitOn24 := True; + error.ErrorType := deConcaveQuadSplit24; Result.Add(error); end; @@ -452,9 +435,8 @@ if det > DetThreshold then begin error := TDATError.Create;; - error.ErrorType := deNonCoplanerVertices; - error.CoplanerType := ctDet; - error.CoplanerValue := det; + error.ErrorType := deNonCoplanerVerticesDet; + error.ErrorValue := det; Result.Add(error); end; end; @@ -465,9 +447,8 @@ if maxdist > DistThreshold then begin error := TDATError.Create;; - error.ErrorType := deNonCoplanerVertices; - error.CoplanerType := ctDist; - error.CoplanerValue := maxdist; + error.ErrorType := deNonCoplanerVerticesDist; + error.ErrorValue := maxdist; Result.Add(error); end; end; @@ -478,9 +459,8 @@ if maxangle > PlaneNormalAngleLimit then begin error := TDATError.Create;; - error.ErrorType := deNonCoplanerVertices; - error.CoplanerType := ctNormalAngle; - error.CoplanerValue := maxangle; + error.ErrorType := deNonCoplanerVerticesNormAngle; + error.ErrorValue := maxangle; Result.Add(error); end; end; @@ -527,49 +507,37 @@ function GetErrorString(error: TDATError): string; begin case error.ErrorType of - deRowAllZeros: - case error.Row of - 1: Result := strRow1AllZeros; - 2: Result := strRow2AllZeros; - 3: Result := strRow3AllZeros; - else Result := ''; - end; + deRow1AllZeros: Result := strRow1AllZeros; + deRow2AllZeros: Result := strRow1AllZeros; + deRow3AllZeros: Result := strRow1AllZeros; deYColumnAllZeros: Result := strYColumnAllZeros; deSigularMatrix: Result := strSingularMatrix; deIdenticalVertices: Result := strIdenticalVertices; - deCollinearVertices: - begin - case error.CollinearType of - clPoints123: Result := 'Points 1, 2, and 3 have '; - clPoints124: Result := 'Points 1, 2, and 4 have '; - clPoints134: Result := 'Points 1, 3, and 4 have '; - clPoints234: Result := 'Points 2, 3, and 4 have '; - clPointsAll: Result := ''; - end; - Result := Result + strCollinearVertices + ' (' + - FloatToStr(error.CollinearValue) + ')' - end; - deConcaveQuad: - if error.SplitOn24 then - Result := strConcaveSplit24 - else - Result := strConcaveSplit13; - deBowtieQuad: - if error.IsBowtieType1423 then - Result := strBowtie1423 - else - Result := strBowtie1243; - deNonCoplanerVertices: - case error.CoplanerType of - ctDet: Result := strNonCoplanerVertices + - ' (det = ' + FloatToStr(error.CoplanerValue) + ')'; - ctDist: Result := strNonCoplanerVertices + - ' (dist = ' + FloatToStr(error.CoplanerValue) + ')'; - ctNormalAngle: Result := strNonCoplanerVertices + - ' (angle = ' + FloatToStr(error.CoplanerValue) + ')'; - else Result := ''; - end; - deIdenticalLine: Result := strIdenticalLine + ' ' + IntToStr(error.Line); + deCollinearVertices123: Result := 'Points 1, 2, and 3 have ' + + strCollinearVertices + ' (' + + FloatToStr(error.ErrorValue) + ')'; + deCollinearVertices124: Result := 'Points 1, 2, and 4 have ' + + strCollinearVertices + ' (' + + FloatToStr(error.ErrorValue) + ')'; + deCollinearVertices134: Result := 'Points 1, 3, and 4 have ' + + strCollinearVertices + ' (' + + FloatToStr(error.ErrorValue) + ')'; + deCollinearVertices234: Result := 'Points 2, 3, and 4 have ' + + strCollinearVertices + ' (' + + FloatToStr(error.ErrorValue) + ')'; + deCollinearVerticesAll: Result := strCollinearVertices + ' (' + + FloatToStr(error.ErrorValue) + ')'; + deConcaveQuadSplit24: Result := strConcaveSplit24; + deConcaveQuadSplit13: Result := strConcaveSplit13; + deBowtieQuad1423: Result := strBowtie1423; + deBowtieQuad1243: Result := strBowtie1243; + deNonCoplanerVerticesDet: Result := strNonCoplanerVertices + + ' (det = ' + FloatToStr(error.ErrorValue) + ')'; + deNonCoplanerVerticesDist: Result := strNonCoplanerVertices + + ' (dist = ' + FloatToStr(error.ErrorValue) + ')'; + deNonCoplanerVerticesNormAngle: Result := strNonCoplanerVertices + + ' (angle = ' + FloatToStr(error.ErrorValue) + ')'; + deIdenticalLine: Result := strIdenticalLine + ' ' + IntToStr(Trunc(error.ErrorValue)); deColor24Illegal: Result := strColor24Illegal; else Result := ''; end; Modified: trunk/lddp/errorbar.pas =================================================================== --- trunk/lddp/errorbar.pas 2009-06-05 17:14:38 UTC (rev 371) +++ trunk/lddp/errorbar.pas 2009-06-10 07:43:44 UTC (rev 372) @@ -136,8 +136,14 @@ error := TDATError(Item.Data); UnFixableError := (error.ErrorType = deIdenticalVertices) or (error.ErrorType = deSigularMatrix) or - (error.ErrorType = deCollinearVertices) or - (error.ErrorType = deNonCoplanerVertices) or + (error.ErrorType = deCollinearVertices123) or + (error.ErrorType = deCollinearVertices124) or + (error.ErrorType = deCollinearVertices134) or + (error.ErrorType = deCollinearVertices234) or + (error.ErrorType = deCollinearVerticesAll) or + (error.ErrorType = deNonCoplanerVerticesDet) or + (error.ErrorType = deNonCoplanerVerticesDist) or + (error.ErrorType = deNonCoplanerVerticesNormAngle) or (error.ErrorType = deColor24Illegal); acECFixError.Enabled := not UnFixableError; acECFixAllErrorsTyped.Enabled := not UnFixableError; @@ -252,7 +258,7 @@ begin error := TDATError.Create; error.ErrorType := deIdenticalLine; - error.Line := iline + 1; + error.ErrorValue := iline + 1; AddError(IntToStr(i + 1), error) end else @@ -354,27 +360,28 @@ // Fix the error with ErrorListView.Items[ErrorListView.ItemIndex] do case PError.ErrorType of - deRowAllZeros, deYColumnAllZeros: + deRow1AllZeros, deRow2AllZeros, deRow3AllZeros, deYColumnAllZeros: begin DATElem := TDATSubPart.Create; (DATElem as TDATSubPart).DATString := frMain.editor.Lines[frMain.editor.CaretY - 1]; - if PError.ErrorType = deRowAllZeros then - FixRowAllZeros(DATElem as TDATSubPart, PError.Row) + if PError.ErrorType = deYColumnAllZeros then + FixYColumnAllZeros(DATElem as TDATSubPart) else - FixYColumnAllZeros(DATElem as TDATSubPart); + FixRowAllZeros(DATElem as TDATSubPart, Trunc(PError.ErrorValue)); + frMain.editor.lines[frMain.editor.CaretY - 1] := (DATElem as TDATSubPart).DATString; DATElem.Free; errorfixed := True; end; - deConcaveQuad: + deConcaveQuadSplit24, deConcaveQuadSplit13: begin DATElem := TDATQuad.Create; with DATElem as TDATQuad do begin DATString := frMain.editor.lines[frMain.editor.CaretY - 1]; - if PError.SplitOn24 then + if PError.ErrorType = deConcaveQuadSplit24 then SplitConcaveQuad24((DATElem as TDATQuad), tri1, tri2) else SplitConcaveQuad13((DATElem as TDATQuad), tri1, tri2); @@ -389,16 +396,16 @@ IntToStr(StrToInt(ErrorListView.Items[i].SubItems[0]) + 1); errorfixed := True; end; - deBowtieQuad: + deBowtieQuad1423, deBowtieQuad1243: begin DATElem := TDATQuad.Create; with DATElem as TDATQuad do begin DATString := frMain.editor.lines[frMain.editor.CaretY - 1]; - if PError.IsBowtieType1423 then + if PError.ErrorType = deBowtieQuad1423 then FixBowtieQuad1423(DATElem as TDATQuad) else - FixBowtieQuad1423(DATElem as TDATQuad); + FixBowtieQuad1243(DATElem as TDATQuad); frMain.editor.lines[frMain.editor.CaretY-1] := DATString; Free; end; @@ -406,7 +413,7 @@ end; deIdenticalLine: begin - frMain.editor.lines[frMain.editor.CaretY-1]:=''; + frMain.editor.lines[frMain.editor.CaretY-1] := ''; errorfixed := True; end; else errorfixed := false; Modified: trunk/lddp/main.pas =================================================================== --- trunk/lddp/main.pas 2009-06-05 17:14:38 UTC (rev 371) +++ trunk/lddp/main.pas 2009-06-10 07:43:44 UTC (rev 372) @@ -783,22 +783,27 @@ if errorlist.Count > 0 then begin for j := 0 to errorlist.Count - 1 do - if (errorlist[j] as TDATError).ErrorType = deBowtieQuad then - if (errorlist[j] as TDATError).IsBowtieType1423 then - FixBowtieQuad1423(quad) - else - FixBowtieQuad1243(quad); + if (errorlist[j] as TDATError).ErrorType = deBowtieQuad1423 then + FixBowtieQuad1423(quad) + else if (errorlist[j] as TDATError).ErrorType = deBowtieQuad1243 then + FixBowtieQuad1243(quad); errorlist := L3CheckLine(quad.DATString); for j := 0 to errorlist.Count - 1 do - if ((errorlist[j] as TDATError).ErrorType = deCollinearVertices) or - ((errorlist[j] as TDATError).ErrorType = deNonCoplanerVertices) or - ((errorlist[j] as TDATError).ErrorType = deConcaveQuad) then + if ((errorlist[j] as TDATError).ErrorType = deCollinearVertices123) or + ((errorlist[j] as TDATError).ErrorType = deCollinearVertices124) or + ((errorlist[j] as TDATError).ErrorType = deCollinearVertices134) or + ((errorlist[j] as TDATError).ErrorType = deCollinearVertices234) or + ((errorlist[j] as TDATError).ErrorType = deNonCoplanerVerticesDet) or + ((errorlist[j] as TDATError).ErrorType = deNonCoplanerVerticesDist) or + ((errorlist[j] as TDATError).ErrorType = deNonCoplanerVerticesNormAngle) or + ((errorlist[j] as TDATError).ErrorType = deConcaveQuadSplit24) or + ((errorlist[j] as TDATError).ErrorType = deConcaveQuadSplit13) then case MessageDlg(_('Combining these triangles:') + #13#10 + line1.DATString + ' (Line: ' + IntToStr(editor.LineFromPosition(editor.SelStart) + i) + ')' + #13#10 + line2.DATString + ' (Line: ' + IntToStr(editor.LineFromPosition(editor.SelStart) + i + 1) + ')' + #13#10 + - _('will result in a concave quad or a quad with' + #13#10 + - 'collinear or not coplaner vertices' + #13#10 + - 'Combine anyway?'), mtWarning, [mbYes, mbNo, mbAbort], 0, mbNo) of + _('gives the following error:') + #13#10 + + GetErrorString(errorlist[j] as TDATError) + #13#10 + #13#10 + + _('Combine anyway?'), mtWarning, [mbYes, mbNo, mbAbort], 0, mbNo) of mrNo: begin DoNotCombine := True; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |