Starts implementing text support
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1473 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
21518cb872
commit
0c5b5b1913
@ -95,11 +95,14 @@ implementation
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
const
|
const
|
||||||
DXF_AUTOCAD_2000_R10 = 'AC1006';
|
// Items in the HEADER section
|
||||||
DXF_AUTOCAD_2000_R11 = 'AC1009';
|
|
||||||
DXF_AUTOCAD_2000_R11_and_R12 = 'AC1009';
|
// $ACADVER
|
||||||
// DXF_AUTOCAD_2000_R11 = 'AC1009';
|
DXF_AUTOCAD_R10 = 'AC1006'; // 1988
|
||||||
// = R10, AC1009 = R11 and R12, AC1012 = R13, AC1014 = R14
|
DXF_AUTOCAD_R11_and_R12 = 'AC1009'; // 1990
|
||||||
|
DXF_AUTOCAD_R13 = 'AC1012'; // 1994
|
||||||
|
DXF_AUTOCAD_R14 = 'AC1009'; // 1997 http://www.autodesk.com/techpubs/autocad/acadr14/dxf/index.htm
|
||||||
|
DXF_AUTOCAD_2000 = 'AC1500'; // 1999 http://www.autodesk.com/techpubs/autocad/acad2000/dxf/
|
||||||
|
|
||||||
// Group Codes for ENTITIES
|
// Group Codes for ENTITIES
|
||||||
DXF_ENTITIES_TYPE = 0;
|
DXF_ENTITIES_TYPE = 0;
|
||||||
@ -585,8 +588,11 @@ procedure TvDXFVectorialReader.ReadENTITIES_TEXT(ATokens: TDXFTokens;
|
|||||||
var
|
var
|
||||||
CurToken: TDXFToken;
|
CurToken: TDXFToken;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
PosX, PosY, PosZ: Double;
|
PosX: Double = 0.0;
|
||||||
Str: string;
|
PosY: Double = 0.0;
|
||||||
|
PosZ: Double = 0.0;
|
||||||
|
FontSize: Double = 10.0;
|
||||||
|
Str: string = '';
|
||||||
begin
|
begin
|
||||||
for i := 0 to ATokens.Count - 1 do
|
for i := 0 to ATokens.Count - 1 do
|
||||||
begin
|
begin
|
||||||
@ -594,7 +600,7 @@ begin
|
|||||||
CurToken := TDXFToken(ATokens.Items[i]);
|
CurToken := TDXFToken(ATokens.Items[i]);
|
||||||
|
|
||||||
// Avoid an exception by previously checking if the conversion can be made
|
// Avoid an exception by previously checking if the conversion can be made
|
||||||
if CurToken.GroupCode in [10, 20, 30] then
|
if CurToken.GroupCode in [10, 20, 30, 40] then
|
||||||
begin
|
begin
|
||||||
CurToken.FloatValue := StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
|
CurToken.FloatValue := StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
|
||||||
end;
|
end;
|
||||||
@ -604,11 +610,12 @@ begin
|
|||||||
10: PosX := CurToken.FloatValue;
|
10: PosX := CurToken.FloatValue;
|
||||||
20: PosY := CurToken.FloatValue;
|
20: PosY := CurToken.FloatValue;
|
||||||
30: PosZ := CurToken.FloatValue;
|
30: PosZ := CurToken.FloatValue;
|
||||||
|
40: FontSize := CurToken.FloatValue;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//
|
//
|
||||||
// AData.AddEllipse(CenterX, CenterY, CenterZ, MajorHalfAxis, MinorHalfAxis, Angle);
|
AData.AddText(PosX, PosY, PosZ, '', Round(FontSize), Str);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TvDXFVectorialReader.GetCoordinateValue(AStr: shortstring): Double;
|
function TvDXFVectorialReader.GetCoordinateValue(AStr: shortstring): Double;
|
||||||
|
@ -107,6 +107,8 @@ var
|
|||||||
CurX, CurY: Integer; // Not modified by ADestX, etc
|
CurX, CurY: Integer; // Not modified by ADestX, etc
|
||||||
CurveLength: Integer;
|
CurveLength: Integer;
|
||||||
t: Double;
|
t: Double;
|
||||||
|
// For text
|
||||||
|
CurText: TvText;
|
||||||
// For entities
|
// For entities
|
||||||
CurEntity: TvEntity;
|
CurEntity: TvEntity;
|
||||||
CurCircle: TvCircle;
|
CurCircle: TvCircle;
|
||||||
@ -122,6 +124,7 @@ begin
|
|||||||
|
|
||||||
ADest.MoveTo(ADestX, ADestY);
|
ADest.MoveTo(ADestX, ADestY);
|
||||||
|
|
||||||
|
// Draws all paths
|
||||||
for i := 0 to ASource.PathCount - 1 do
|
for i := 0 to ASource.PathCount - 1 do
|
||||||
begin
|
begin
|
||||||
//WriteLn('i = ', i);
|
//WriteLn('i = ', i);
|
||||||
@ -172,6 +175,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Draws all entities
|
||||||
for i := 0 to ASource.GetEntityCount - 1 do
|
for i := 0 to ASource.GetEntityCount - 1 do
|
||||||
begin
|
begin
|
||||||
CurEntity := ASource.GetEntity(i);
|
CurEntity := ASource.GetEntity(i);
|
||||||
@ -207,6 +211,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Draws all text
|
||||||
|
for i := 0 to ASource.GetTextCount - 1 do
|
||||||
|
begin
|
||||||
|
CurText := ASource.GetText(i);
|
||||||
|
ADest.Font.Height := Round(AmulY * CurText.FontSize);
|
||||||
|
ADest.Pen.Style := psSolid;
|
||||||
|
ADest.Pen.Color := clBlack;
|
||||||
|
ADest.TextOut(Round(CurText.X), Round(CurText.Y), CurText.Value);
|
||||||
|
end;
|
||||||
|
|
||||||
{$ifdef FPVECTORIALDEBUG}
|
{$ifdef FPVECTORIALDEBUG}
|
||||||
WriteLn(':<DrawFPVectorialToCanvas');
|
WriteLn(':<DrawFPVectorialToCanvas');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
@ -61,6 +61,8 @@ object frmFPVViewer: TfrmFPVViewer
|
|||||||
Height = 23
|
Height = 23
|
||||||
Top = 99
|
Top = 99
|
||||||
Width = 46
|
Width = 46
|
||||||
|
MaxValue = 1000
|
||||||
|
MinValue = -1000
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
object spinStartY: TSpinEdit
|
object spinStartY: TSpinEdit
|
||||||
@ -68,6 +70,8 @@ object frmFPVViewer: TfrmFPVViewer
|
|||||||
Height = 23
|
Height = 23
|
||||||
Top = 99
|
Top = 99
|
||||||
Width = 50
|
Width = 50
|
||||||
|
MaxValue = 1000
|
||||||
|
MinValue = -1000
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
@ -120,8 +124,8 @@ object frmFPVViewer: TfrmFPVViewer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Page2: TPage
|
object Page2: TPage
|
||||||
ClientWidth = 1344
|
ClientWidth = 2688
|
||||||
ClientHeight = 1252
|
ClientHeight = 2504
|
||||||
object DXFTreeView: TTreeView
|
object DXFTreeView: TTreeView
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 313
|
Height = 313
|
||||||
|
Loading…
Reference in New Issue
Block a user