Browse Source

Starts implementing a fpvectorial viewer

git-svn-id: trunk@16763 -
sekelsenmat 14 years ago
parent
commit
65e29e3984

+ 6 - 0
.gitattributes

@@ -2504,6 +2504,12 @@ packages/fpvectorial/examples/fpvc_mainform.pas svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.ico -text
 packages/fpvectorial/examples/fpvectorialconverter.ico -text
 packages/fpvectorial/examples/fpvectorialconverter.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.lpr svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.lpr svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/cube.dxf svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/diamond.dxf svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/fpvv_mainform.lfm svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/fpvv_mainform.pas svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/fpvviewer.lpi svneol=native#text/plain
+packages/fpvectorial/examples/fpvviewer/fpvviewer.lpr svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.pas svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.pas svneol=native#text/plain
 packages/fpvectorial/fpmake.pp svneol=native#text/plain
 packages/fpvectorial/fpmake.pp svneol=native#text/plain

+ 414 - 0
packages/fpvectorial/examples/fpvviewer/cube.dxf

@@ -0,0 +1,414 @@
+  0
+SECTION
+  2
+HEADER
+999
+cube.dxf created by IVREAD.
+999
+Original data in cube.iv
+  0
+ENDSEC
+  0
+SECTION
+  2
+TABLES
+  0
+ENDSEC
+  0
+SECTION
+  2
+BLOCKS
+  0
+ENDSEC
+  0
+SECTION
+  2
+ENTITIES
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+  0.0000E+00
+ 11
+  0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+ -0.5000    
+ 30
+   1.000    
+ 11
+ -0.5000    
+ 21
+ -0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+   1.000    
+ 11
+  0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+ -0.5000    
+ 20
+  0.5000    
+ 30
+  0.0000E+00
+ 11
+ -0.5000    
+ 21
+  0.5000    
+ 31
+   1.000    
+  0
+ENDSEC
+  0
+EOF

+ 200 - 0
packages/fpvectorial/examples/fpvviewer/diamond.dxf

@@ -0,0 +1,200 @@
+  0
+SECTION
+  2
+ENTITIES
+  0
+LINE
+  8
+  0
+ 10
+   45.00    
+ 20
+   45.00    
+ 30
+  0.0000E+00
+ 11
+   45.00    
+ 21
+  -45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+   45.00    
+ 20
+  -45.00    
+ 30
+  0.0000E+00
+ 11
+  0.0000E+00
+ 21
+  0.0000E+00
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.0000E+00
+ 20
+  0.0000E+00
+ 30
+  0.0000E+00
+ 11
+  -45.00    
+ 21
+   45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  -45.00    
+ 20
+   45.00    
+ 30
+  0.0000E+00
+ 11
+   45.00    
+ 21
+   45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+   45.00    
+ 20
+   45.00    
+ 30
+  0.0000E+00
+ 11
+  0.0000E+00
+ 21
+  0.0000E+00
+ 31
+  -78.00    
+  0
+LINE
+  8
+  0
+ 10
+  0.0000E+00
+ 20
+  0.0000E+00
+ 30
+  -78.00    
+ 11
+  0.0000E+00
+ 21
+  0.0000E+00
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  0.0000E+00
+ 20
+  0.0000E+00
+ 30
+  0.0000E+00
+ 11
+  -45.00    
+ 21
+  -45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  -45.00    
+ 20
+  -45.00    
+ 30
+  0.0000E+00
+ 11
+   45.00    
+ 21
+   45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+   45.00    
+ 20
+  -45.00    
+ 30
+  0.0000E+00
+ 11
+  -45.00    
+ 21
+  -45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  -45.00    
+ 20
+  -45.00    
+ 30
+  0.0000E+00
+ 11
+  -45.00    
+ 21
+   45.00    
+ 31
+  0.0000E+00
+  0
+LINE
+  8
+  0
+ 10
+  -45.00    
+ 20
+   45.00    
+ 30
+  0.0000E+00
+ 11
+  0.0000E+00
+ 21
+  0.0000E+00
+ 31
+  -78.00    
+  0
+LINE
+  8
+  0
+ 10
+  0.0000E+00
+ 20
+  0.0000E+00
+ 30
+  -78.00    
+ 11
+   45.00    
+ 21
+  -45.00    
+ 31
+  0.0000E+00
+  0
+ENDSEC
+  0
+EOF

+ 34 - 0
packages/fpvectorial/examples/fpvviewer/fpvv_mainform.lfm

@@ -0,0 +1,34 @@
+object frmFPVViewer: TfrmFPVViewer
+  Left = 349
+  Height = 240
+  Top = 171
+  Width = 240
+  Caption = 'frmFPVViewer'
+  ClientHeight = 240
+  ClientWidth = 240
+  OnCreate = FormCreate
+  OnDestroy = FormDestroy
+  LCLVersion = '0.9.31'
+  object btnView: TButton
+    Left = 8
+    Height = 25
+    Top = 40
+    Width = 224
+    Caption = 'View'
+    OnClick = btnViewClick
+    TabOrder = 0
+  end
+  object editFileName: TFileNameEdit
+    Left = 8
+    Height = 25
+    Top = 8
+    Width = 200
+    DialogOptions = []
+    FilterIndex = 0
+    HideDirectories = False
+    ButtonWidth = 23
+    NumGlyphs = 0
+    MaxLength = 0
+    TabOrder = 1
+  end
+end

+ 53 - 0
packages/fpvectorial/examples/fpvviewer/fpvv_mainform.pas

@@ -0,0 +1,53 @@
+unit fpvv_mainform;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  fpvectorial, svgvectorialwriter, Classes, SysUtils, FileUtil, Forms, Controls,
+  Graphics, Dialogs, StdCtrls, EditBtn;
+
+type
+
+  { TfrmFPVViewer }
+
+  TfrmFPVViewer = class(TForm)
+    btnView: TButton;
+    editFileName: TFileNameEdit;
+    procedure btnViewClick(Sender: TObject);
+    procedure FormCreate(Sender: TObject);
+    procedure FormDestroy(Sender: TObject);
+  private
+    { private declarations }
+  public
+    { public declarations }
+    Vec: TvVectorialDocument;
+  end;
+
+var
+  frmFPVViewer: TfrmFPVViewer;
+
+implementation
+
+{$R *.lfm}
+
+{ TfrmFPVViewer }
+
+procedure TfrmFPVViewer.btnViewClick(Sender: TObject);
+begin
+  Vec.ReadFromFile(editFileName.FileName);
+end;
+
+procedure TfrmFPVViewer.FormCreate(Sender: TObject);
+begin
+  Vec := TvVectorialDocument.Create;
+end;
+
+procedure TfrmFPVViewer.FormDestroy(Sender: TObject);
+begin
+  Vec.Free;
+end;
+
+end.
+

+ 169 - 0
packages/fpvectorial/examples/fpvviewer/fpvviewer.lpi

@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="9"/>
+    <General>
+      <MainUnit Value="0"/>
+      <ResourceType Value="res"/>
+      <UseXPManifest Value="True"/>
+      <Icon Value="0"/>
+      <ActiveWindowIndexAtStart Value="0"/>
+    </General>
+    <i18n>
+      <EnableI18N LFM="False"/>
+    </i18n>
+    <VersionInfo>
+      <StringTable ProductVersion=""/>
+    </VersionInfo>
+    <BuildModes Count="1" Active="Default">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <RequiredPackages Count="1">
+      <Item1>
+        <PackageName Value="LCL"/>
+      </Item1>
+    </RequiredPackages>
+    <Units Count="2">
+      <Unit0>
+        <Filename Value="fpvviewer.lpr"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="fpvviewer"/>
+        <EditorIndex Value="1"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="1" Y="1"/>
+        <UsageCount Value="20"/>
+        <Loaded Value="True"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="fpvv_mainform.pas"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="frmFPVViewer"/>
+        <ResourceBaseClass Value="Form"/>
+        <UnitName Value="fpvv_mainform"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="0"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="13"/>
+        <CursorPos X="42" Y="39"/>
+        <UsageCount Value="20"/>
+        <Loaded Value="True"/>
+        <LoadedDesigner Value="True"/>
+      </Unit1>
+    </Units>
+    <JumpHistory Count="17" HistoryIndex="16">
+      <Position1>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="11" Column="11" TopLine="1"/>
+      </Position1>
+      <Position2>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="14" Column="11" TopLine="1"/>
+      </Position2>
+      <Position3>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="171" Column="1" TopLine="135"/>
+      </Position3>
+      <Position4>
+        <Filename Value="fpvviewer.lpr"/>
+        <Caret Line="16" Column="9" TopLine="1"/>
+      </Position4>
+      <Position5>
+        <Filename Value="fpvviewer.lpr"/>
+        <Caret Line="8" Column="1" TopLine="1"/>
+      </Position5>
+      <Position6>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="36" Column="1" TopLine="25"/>
+      </Position6>
+      <Position7>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="41" Column="1" TopLine="12"/>
+      </Position7>
+      <Position8>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="8" Column="34" TopLine="1"/>
+      </Position8>
+      <Position9>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="134" Column="17" TopLine="61"/>
+      </Position9>
+      <Position10>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="8" Column="34" TopLine="1"/>
+      </Position10>
+      <Position11>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="163" Column="1" TopLine="126"/>
+      </Position11>
+      <Position12>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="8" Column="34" TopLine="1"/>
+      </Position12>
+      <Position13>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="161" Column="1" TopLine="1"/>
+      </Position13>
+      <Position14>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="8" Column="34" TopLine="1"/>
+      </Position14>
+      <Position15>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="12" Column="14" TopLine="37"/>
+      </Position15>
+      <Position16>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="47" Column="1" TopLine="26"/>
+      </Position16>
+      <Position17>
+        <Filename Value="fpvv_mainform.pas"/>
+        <Caret Line="38" Column="20" TopLine="13"/>
+      </Position17>
+    </JumpHistory>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="9"/>
+    <Target>
+      <Filename Value="fpvviewer"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+    <Linking>
+      <Options>
+        <Win32>
+          <GraphicApplication Value="True"/>
+        </Win32>
+      </Options>
+    </Linking>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 23 - 0
packages/fpvectorial/examples/fpvviewer/fpvviewer.lpr

@@ -0,0 +1,23 @@
+{
+FPVectorial example application for viewing vectorial images
+
+Author: Felipe Monteiro de Carvalho
+
+License: Public Domain
+}
+program fpvviewer;
+
+{$mode objfpc}{$H+}
+
+uses
+  Interfaces, // this includes the LCL widgetset
+  Forms, fpvv_mainform;
+
+//{$R *.res}
+
+begin
+  Application.Initialize;
+  Application.CreateForm(TfrmFPVViewer, frmFPVViewer);
+  Application.Run;
+end.
+