mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 07:02:44 +02:00
fpvectorial: Starts the las reader
git-svn-id: trunk@33950 -
This commit is contained in:
parent
7457855429
commit
080f2b0ab4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -976,6 +976,7 @@ components/fpvectorial/fpvectorialpkg.lpk svneol=native#text/plain
|
||||
components/fpvectorial/fpvectorialpkg.pas svneol=native#text/plain
|
||||
components/fpvectorial/fpvtocanvas.pas svneol=native#text/plain
|
||||
components/fpvectorial/fpvutils.pas svneol=native#text/plain
|
||||
components/fpvectorial/lasvectorialreader.pas svneol=native#text/plain
|
||||
components/fpvectorial/pdfvectorialreader.pas svneol=native#text/plain
|
||||
components/fpvectorial/pdfvrlexico.pas svneol=native#text/plain
|
||||
components/fpvectorial/pdfvrsemantico.pas svneol=native#text/plain
|
||||
|
@ -35,6 +35,8 @@ type
|
||||
vfPDF, vfSVG, vfCorelDrawCDR, vfWindowsMetafileWMF,
|
||||
{ CAD formats }
|
||||
vfDXF,
|
||||
{ Geospatial formats }
|
||||
vfLAS,
|
||||
{ Printing formats }
|
||||
vfPostScript, vfEncapsulatedPostScript,
|
||||
{ GCode formats }
|
||||
@ -50,6 +52,7 @@ const
|
||||
STR_WINMETAFILE_EXTENSION = '.wmf';
|
||||
STR_AUTOCAD_EXCHANGE_EXTENSION = '.dxf';
|
||||
STR_ENCAPSULATEDPOSTSCRIPT_EXTENSION = '.eps';
|
||||
STR_LAS_EXTENSION = '.las';
|
||||
|
||||
type
|
||||
{ Pen, Brush and Font }
|
||||
@ -1299,6 +1302,7 @@ begin
|
||||
else if AnsiCompareText(lExt, STR_WINMETAFILE_EXTENSION) = 0 then Result := vfWindowsMetafileWMF
|
||||
else if AnsiCompareText(lExt, STR_AUTOCAD_EXCHANGE_EXTENSION) = 0 then Result := vfDXF
|
||||
else if AnsiCompareText(lExt, STR_ENCAPSULATEDPOSTSCRIPT_EXTENSION) = 0 then Result := vfEncapsulatedPostScript
|
||||
else if AnsiCompareText(lExt, STR_LAS_EXTENSION) = 0 then Result := vfLAS
|
||||
else
|
||||
raise Exception.Create('TvVectorialDocument.GetFormatFromExtension: The extension (' + lExt + ') doesn''t match any supported formats.');
|
||||
end;
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Name Value="fpvectorialpkg"/>
|
||||
<AddToProjectUsesSection Value="True"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
@ -12,7 +12,7 @@
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Files Count="12">
|
||||
<Files Count="13">
|
||||
<Item1>
|
||||
<Filename Value="svgvectorialwriter.pas"/>
|
||||
<UnitName Value="svgvectorialwriter"/>
|
||||
@ -61,6 +61,10 @@
|
||||
<Filename Value="fpvutils.pas"/>
|
||||
<UnitName Value="fpvutils"/>
|
||||
</Item12>
|
||||
<Item13>
|
||||
<Filename Value="lasvectorialreader.pas"/>
|
||||
<UnitName Value="lasvectorialreader"/>
|
||||
</Item13>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
@ -69,7 +73,7 @@
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
<MinVersion Major="1" Release="1" Valid="True"/>
|
||||
<MinVersion Major="1" Valid="True" Release="1"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
|
@ -10,7 +10,7 @@ uses
|
||||
svgvectorialwriter, fpvtocanvas, fpvectorial, fpvectbuildunit,
|
||||
dxfvectorialreader, cdrvectorialreader, avisozlib, avisocncgcodewriter,
|
||||
avisocncgcodereader, svgvectorialreader, epsvectorialreader, fpvutils,
|
||||
LazarusPackageIntf;
|
||||
lasvectorialreader, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
134
components/fpvectorial/lasvectorialreader.pas
Normal file
134
components/fpvectorial/lasvectorialreader.pas
Normal file
@ -0,0 +1,134 @@
|
||||
{
|
||||
lasvectorialreader.pas
|
||||
|
||||
Reads geospatial data encoded in the ASPRS LASer (LAS) file format version 1.3
|
||||
|
||||
LAS file format specification obtained from:
|
||||
|
||||
http://www.asprs.org/a/society/committees/standards/lidar_exchange_format.html
|
||||
LAS 1.3 r11
|
||||
|
||||
All data is in little-endian format.
|
||||
|
||||
AUTHORS: Felipe Monteiro de Carvalho
|
||||
|
||||
License: The same modified LGPL as the Free Pascal RTL
|
||||
See the file COPYING.modifiedLGPL for more details
|
||||
}
|
||||
unit lasvectorialreader;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}
|
||||
{$endif}
|
||||
|
||||
{$define FPVECTORIALDEBUG_LAS}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
//avisozlib,
|
||||
fpvectorial;
|
||||
|
||||
type
|
||||
// LAS data types
|
||||
laschar = Char; // or ShortInt
|
||||
lasuchar = Byte;
|
||||
lasshort = Smallint;
|
||||
lasushort = Word;
|
||||
laslong = Integer;
|
||||
lasulong = Cardinal;
|
||||
laslonglong = Int64;
|
||||
lasulonglong = QWord;
|
||||
lasdouble = double;
|
||||
|
||||
// PUBLIC HEADER BLOCK
|
||||
TLASPublicHeaderBlock = packed record
|
||||
FileSignatureLASF: array[0..3] of laschar;
|
||||
FileSourceID: lasushort;
|
||||
GlobalEncoding: lasushort;
|
||||
ProjectIDGUIDdata1: lasulong; // Optional
|
||||
ProjectIDGUIDdata2: lasushort; // Optional
|
||||
ProjectIDGUIDdata3: lasushort; // Optional
|
||||
ProjectIDGUIDdata4: array[0..7] of lasuchar;// Optional
|
||||
VersionMajor: lasuchar;
|
||||
VersionMinor: lasuchar;
|
||||
SystemIdentifier: array[0..31] of laschar;
|
||||
GeneratingSoftware: array[0..31] of laschar;
|
||||
FileCreationDayofYear: lasushort;
|
||||
FileCreationYear: lasushort;
|
||||
{Number of Variable Length Records
|
||||
Point Data Format ID (0-99 for spec)
|
||||
Point Data Record Length
|
||||
Number of point records
|
||||
Number of points by return
|
||||
X scale factor
|
||||
Y scale factor
|
||||
Z scale factor
|
||||
X offset
|
||||
Y offset
|
||||
Z offset
|
||||
Max X
|
||||
Min X
|
||||
Max Y
|
||||
Min Y
|
||||
Max Z
|
||||
Min Z
|
||||
Start of Waveform Data Packet Record
|
||||
Any field in the Public Header Block that is not required and is not used must be zero filled.}
|
||||
end;
|
||||
|
||||
{ TvLASVectorialReader }
|
||||
|
||||
TvLASVectorialReader = class(TvCustomVectorialReader)
|
||||
private
|
||||
{$ifdef FPVECTORIALDEBUG_LAS}
|
||||
procedure DebugOutPublicHeaderBlock();
|
||||
{$endif}
|
||||
public
|
||||
PublicHeaderBlock: TLASPublicHeaderBlock;
|
||||
{ General reading methods }
|
||||
procedure ReadFromStream(AStream: TStream; AData: TvVectorialDocument); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef FPVECTORIALDEBUG_LAS}
|
||||
procedure TvLASVectorialReader.DebugOutPublicHeaderBlock;
|
||||
begin
|
||||
WriteLn(Format('FileSignatureLASF = %s = %x %x %x %x',
|
||||
[PublicHeaderBlock.FileSignatureLASF,
|
||||
PublicHeaderBlock.FileSignatureLASF[0],
|
||||
PublicHeaderBlock.FileSignatureLASF[1],
|
||||
PublicHeaderBlock.FileSignatureLASF[2],
|
||||
PublicHeaderBlock.FileSignatureLASF[3]]));
|
||||
WriteLn(Format('FileSourceID = %x', [PublicHeaderBlock.FileSourceID]));
|
||||
WriteLn(Format('GlobalEncoding = %x', [PublicHeaderBlock.GlobalEncoding]));
|
||||
WriteLn(Format('ProjectIDGUIDdata1 = %x', [PublicHeaderBlock.ProjectIDGUIDdata1]));
|
||||
WriteLn(Format('ProjectIDGUIDdata2 = %x', [PublicHeaderBlock.ProjectIDGUIDdata2]));
|
||||
WriteLn(Format('ProjectIDGUIDdata3 = %x', [PublicHeaderBlock.ProjectIDGUIDdata3]));
|
||||
// WriteLn(Format('ProjectIDGUIDdata2 = %x', [ProjectIDGUIDdata2]));
|
||||
WriteLn(Format('VersionMajor = %x', [PublicHeaderBlock.VersionMajor]));
|
||||
WriteLn(Format('VersionMinor = %x', [PublicHeaderBlock.VersionMinor]));
|
||||
WriteLn(Format('SystemIdentifier = %s', [PublicHeaderBlock.SystemIdentifier]));
|
||||
WriteLn(Format('GeneratingSoftware = %s', [PublicHeaderBlock.GeneratingSoftware]));
|
||||
WriteLn(Format('FileCreationDayofYear = %x', [PublicHeaderBlock.FileCreationDayofYear]));
|
||||
WriteLn(Format('FileCreationYear = %x', [PublicHeaderBlock.FileCreationYear]));
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
procedure TvLASVectorialReader.ReadFromStream(AStream: TStream;
|
||||
AData: TvVectorialDocument);
|
||||
begin
|
||||
AStream.Read(PublicHeaderBlock, SizeOf(TLASPublicHeaderBlock));
|
||||
{$ifdef FPVECTORIALDEBUG_LAS}
|
||||
DebugOutPublicHeaderBlock();
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
RegisterVectorialReader(TvLASVectorialReader, vfLAS);
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user