⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ezbase.pas

📁 很管用的GIS控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  Bitmap.SaveToFile( FileName );
End;

Procedure TEzGraphicLink.putWMF( Bitmap: TBitmap; Const FileName: String );
Var
  Metafile: TMetafile;
Begin
  Metafile := TMetafile.Create;
  Try
    BitmapToWMF( Bitmap, Metafile );
    Metafile.Enhanced := false;
    Metafile.SaveToFile( FileName );
  Finally
    Metafile.free;
  End;
End;

Procedure TEzGraphicLink.putEMF( Bitmap: TBitmap; Const FileName: String );
Var
  Metafile: TMetafile;
Begin
  Metafile := TMetafile.Create;
  Try
    BitmapToWMF( Bitmap, Metafile );
    Metafile.Enhanced := True;
    Metafile.SaveToFile( FileName );
  Finally
    Metafile.free;
  End;
End;

Procedure TEzGraphicLink.ReadGeneric( Const FileName: String );
Var
  Ext: String;
  Handled: Boolean;
{$IFDEF USE_GRAPHICEX}
  GraphicClass: TGraphicExGraphicClass;
{$ENDIF}
Begin
  { release memory occupied by previous bitmap}
  FBitmap.Free;
  { and create again for avoid memory leaks }
  FBitmap := TBitmap.Create;
  Ext := AnsiLowerCase(ExtractFileExt( FileName ));
  Handled := False;
{$IFDEF JPEG_SUPPORT}
  If AnsiCompareText( Ext, '.jpg' ) = 0 Then
  Begin
    readJPG( FileName );
    Handled := True;
  End
  Else
{$ENDIF}
    If AnsiCompareText( Ext, '.bmp' ) = 0 Then
    Begin
      readBMP( FileName );
      Handled := True;
    End
{$IFDEF GIF_SUPPORT}
    Else If AnsiCompareText( Ext, '.gif' ) = 0 Then
    Begin
      readGIF( FileName );
      Handled := True;
    End
{$ENDIF}
    Else If AnsiCompareText( Ext, '.wmf' ) = 0 Then
    Begin
      readWMF( FileName );
      Handled := True;
    End
    Else If AnsiCompareText( Ext, '.emf' ) = 0 Then
    Begin
      readEMF( FileName );
      Handled := True;
    End
    Else If AnsiCompareText( Ext, '.ico' ) = 0 Then
    Begin
      readICO( FileName );
      Handled := True;
    End
      // graphicex is at last
{$IFDEF USE_GRAPHICEX}
    Else
    Begin
      GraphicClass := FileFormatList.GraphicFromContent( FileName );
      If GraphicClass <> Nil Then
      Begin
        Try
          FBitmap := GraphicClass.Create;
          FBitmap.LoadFromFile( FileName );
          Handled := True;
        Except
          Handled := False;
        End;
      End;
    End;
{$ENDIF}
  ;
  If Not Handled Then
    EzGISError( SWrongImageFormat );
End;

{ ----- TEzPreferences ----- }

{-------------------------------------------------------------------------------}
{                  Implements Tools                                             }
{-------------------------------------------------------------------------------}

{ TEzPointTool }

Procedure TEzPointTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FPoint, sizeof( FPoint ) );
End;

Procedure TEzPointTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FPoint, sizeof( FPoint ) );
End;

Function TEzPointTool.GetX: double;
Begin
  result := FPoint.X;
End;

Procedure TEzPointTool.SetX( Const value: double );
Begin
  FPoint.X := value;
End;

Function TEzPointTool.GetY: double;
Begin
  result := FPoint.Y;
End;

Procedure TEzPointTool.SetY( Const value: double );
Begin
  FPoint.Y := value;
End;

Procedure TEzPointTool.Assign( Source: TPersistent );
Var
  Src: TEzPointTool Absolute Source;
Begin
  If Source Is TEzPointTool Then
    FPoint := Src.FPoint
  Else
    Inherited;
End;

{ TEzSymbolTool }

Procedure TEzSymbolTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FSymbolStyle, sizeof( FSymbolStyle ) );
End;

Procedure TEzSymbolTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FSymbolStyle, sizeof( FSymbolStyle ) );
End;

Function TEzSymbolTool.GetIndex: Integer;
Begin
  result := FSymbolStyle.Index;
End;

Procedure TEzSymbolTool.SetIndex( Value: Integer );
Begin
  FSymbolStyle.Index := Value;
End;

Function TEzSymbolTool.GetRotangle: Double;
Begin
  result := FSymbolStyle.Rotangle;
End;

Procedure TEzSymbolTool.SetRotangle( Const Value: Double );
Begin
  FSymbolStyle.Rotangle := Value;
End;

Function TEzSymbolTool.GetHeight: Double;
Begin
  result := FSymbolStyle.Height;
End;

Procedure TEzSymbolTool.SetHeight( Const Value: Double );
Begin
  FSymbolStyle.Height := Value;
End;

Procedure TEzSymbolTool.Assign( Source: TPersistent );
Var
  Src: TEzSymbolTool Absolute Source;
Begin
  If Source Is TEzSymbolTool Then
    FSymbolStyle := Src.FSymbolStyle
  Else
    Inherited;
End;

{ TEzPenTool }

Procedure TEzPenTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FPenStyle, sizeof( FPenStyle ) );
End;

Procedure TEzPenTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FPenStyle, sizeof( FPenStyle ) );
End;

Function TEzPenTool.GetStyle: Integer;
Begin
  result := FPenStyle.Style;
End;

Procedure TEzPenTool.SetStyle( Value: Integer );
Begin
  FPenStyle.Style := Value;
End;

Function TEzPenTool.GetColor: TColor;
Begin
  result := FPenStyle.Color;
End;

Procedure TEzPenTool.SetCOlor( Value: TColor );
Begin
  FPenStyle.Color := Value;
End;

Function TEzPenTool.GetScale: Double;
Begin
  result := FPenStyle.Scale;
End;

Procedure TEzPenTool.SetScale( Const Value: Double );
Begin
  FPenStyle.Scale := Value;
End;

Procedure TEzPenTool.Assign( Source: TPersistent );
Var
  Src: TEzPenTool Absolute Source;
Begin
  If Source Is TEzPenTool Then
    FPenStyle := Src.FPenStyle
  Else
    Inherited;
End;

{ TEzBrushTool }

Procedure TEzBrushTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FBrushStyle, sizeof( FBrushStyle ) );
End;

Procedure TEzBrushTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FBrushStyle, sizeof( FBrushStyle ) );
End;

Function TEzBrushTool.GetPattern: Integer;
Begin
  result := FBrushStyle.Pattern;
End;

Procedure TEzBrushTool.SetPattern( Value: Integer );
Begin
  FBrushStyle.Pattern := Value;
End;

Function TEzBrushTool.GetColor: TColor;
Begin
  result := FBrushStyle.Color;
End;

Procedure TEzBrushTool.SetColor( Value: TColor );
Begin
  FBrushStyle.Color := Value;
End;

Procedure TEzBrushTool.Assign( Source: TPersistent );
Var
  Src: TEzBrushTool Absolute Source;
Begin
  If Source Is TEzBrushTool Then
    FBrushStyle := Src.FBrushStyle
  Else
    Inherited;
End;

Function TEzBrushTool.GetAngle: Single;
Begin
  result := FBrushstyle.Angle;
End;

Procedure TEzBrushTool.SetAngle( Const Value: Single );
Begin
  FBrushstyle.Angle := Value;
End;

Function TEzBrushTool.GetScale: Double;
Begin
  result := FBrushstyle.Scale;
End;

Procedure TEzBrushTool.SetScale( Const Value: Double );
Begin
  FBrushstyle.Scale := Value;
End;

Function TEzBrushTool.GetBackColor: TColor;
Begin
  result := FBrushstyle.BackColor;
End;

Function TEzBrushTool.GetForeColor: TColor;
Begin
  result := FBrushstyle.ForeColor;
End;

Procedure TEzBrushTool.SetBackColor( Const Value: TColor );
Begin
  FBrushstyle.BackColor := Value;
End;

Procedure TEzBrushTool.SetForeColor( Const Value: TColor );
Begin
  FBrushstyle.ForeColor := Value;
End;

{ TEzFontTool }

Constructor TEzFontTool.Create;
Begin
  Inherited Create;
  FFontStyle.Name := EzSystem.DefaultFontName;
  FFontStyle.Height := 1;
End;

Procedure TEzFontTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FFontStyle, sizeof( FFontStyle ) );
End;

Procedure TEzFontTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FFontStyle, sizeof( FFontStyle ) );
End;

Function TEzFontTool.GetName: String;
Begin
  result := FFontStyle.Name;
End;

Procedure TEzFontTool.SetName( Const Value: String );
Begin
  FFontStyle.Name := Value;
End;

Function TEzFontTool.GetColor: TColor;
Begin
  result := FFontStyle.Color;
End;

Procedure TEzFontTool.SetCOlor( Value: TColor );
Begin
  FFontStyle.Color := Value;
End;

Function TEzFontTool.GetAngle: Single;
Begin
  result := FFontStyle.Angle;
End;

Procedure TEzFontTool.SetAngle( Const Value: Single );
Begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -