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

📄 ezbase.pas

📁 很管用的GIS控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  FFontStyle.Angle := Value;
End;

Function TEzFontTool.GetHeight: Double;
Begin
  Result := FFontStyle.Height;
End;

Procedure TEzFontTool.SetHeight( Const Value: Double );
Begin
  FFontStyle.Height := Value;
End;

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

Function TEzFontTool.GetStyle: TFontStyles;
Begin
  result := FFontStyle.Style;
End;

Procedure TEzFontTool.SetStyle( Const Value: TFontStyles );
Begin
  FFontStyle.Style := Value;
End;

{ TEzPolyClipTool }

Constructor TEzPolyClipTool.Create;
Begin
  Inherited Create;
  FOperation := pcUnion;
  FPreserveOriginals := True;
End;

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

Procedure TEzPolyClipTool.LoadFromStream( Stream: TStream );
Begin
  Stream.Read( FOperation, sizeof( FOperation ) );
  Stream.Read( FPreserveOriginals, sizeof( Boolean ) );
End;

Procedure TEzPolyClipTool.SaveToStream( Stream: TStream );
Begin
  Stream.Write( FOperation, sizeof( FOperation ) );
  Stream.Write( FPreserveOriginals, sizeof( Boolean ) );
End;

Procedure TEzPolyClipTool.SetOperation( value: TEzPolyClipOp );
Begin
  FOperation := value;
End;

Procedure TEzPolyClipTool.SetPreserveOriginals( value: Boolean );
Begin
  FPreserveOriginals := value;
End;

{ TEzPreferences }

Constructor TEzPreferences.Create;
Begin
  Inherited Create;
  { objects that are properties }
  FDefPenStyle := TEzPenTool.Create;
  FDefBrushStyle := TEzBrushTool.Create;
  FDefSymbolStyle := TEzSymbolTool.Create;
  FDefFontStyle := TEzFontTool.Create;
  FDefTTFontStyle := TEzFontTool.Create;
  FSelectionPen := TEzPenTool.Create;
  FSelectionBrush := TEzBrushTool.Create;
  FBandsBitmapChunkSize := 65535;
  //FCommonSubDir:= AddSlash(ExtractFilePath(Application.ExeName));
  FPreloadedBlocks := TStringList.Create;
  FPreloadedImages := TStringList.Create;
  FPreloadedbandedImages := TStringList.Create;
  FUsePreloadedImages := true;
  FHintColor := clInfoBk;
  FHintFont := DefaultFont;

  FGRotatePoint:= INVALID_POINT;

  SetToDefault;
End;

Destructor TEzPreferences.Destroy;
Begin
  FDefPenStyle.Free;
  FDefBrushStyle.Free;
  FDefSymbolStyle.Free;
  FDefFontStyle.Free;
  FDefTTFontStyle.Free;
  FSelectionPen.Free;
  FSelectionBrush.Free;
  ClearPreloadedImages;
  FPreloadedImages.Free;
  ClearPreloadedBandedImages;
  FPreloadedBandedImages.Free;
  ClearPreloadedBlocks;
  FPreloadedBlocks.Free;
  FHintFont.Free;
  Inherited Destroy;
End;

Procedure TEzPreferences.Assign( Source: TEzPreferences );
Var
  FileName: String;
Begin
  FileName := GetTemporaryFileName( 'PRF' );
  Source.SaveToFile( FileName );
  Self.LoadFromFile( FileName );
  SysUtils.DeleteFile( FileName );
End;

Procedure TEzPreferences.ApplyChanges;
Begin
  If Assigned( FOnChange ) Then
    FOnChange( Self );
End;

Procedure TEzPreferences.LoadFromFile( Const FileName: String );
Var
  Inifile: TInifile;
  //TempDecimalSeparator, SaveDecimalSeparator: Char;
  //WasChanged: Boolean;
Begin
  Inifile := TInifile.Create( FileName );
  Try
    With Inifile Do
    Begin
      {s:= ReadString( 'General', 'DecimalSeparator', '.' );
      if Length(s) > 0 then TempDecimalSeparator:= s[1] else TempDecimalSeparator:= '.';
      WasChanged:=false;
      SaveDecimalSeparator:= DecimalSeparator;
      if TempDecimalSeparator <> DecimalSeparator then
      begin
        DecimalSeparator:= TempDecimalSeparator;
        WasChanged:=true;
      end; }

      FDefPenStyle.Style := ReadIntFromIni( Inifile, 'DefPen', 'Style', 1 );
      FDefPenStyle.Color := ReadIntFromIni( Inifile, 'DefPen', 'Color', clBlack );
      FDefPenStyle.Scale := ReadFloatFromIni( Inifile, 'DefPen', 'Scale', 0.0 );
      FDefPenStyle.Width := ReadFloatFromIni( Inifile, 'DefPen', 'Width', 0.0 );

      FDefBrushStyle.Pattern := ReadIntFromIni( Inifile, 'DefBrush', 'Pattern', 0 );
      FDefBrushStyle.Color := ReadIntFromIni( Inifile, 'DefBrush', 'Color', clBlack );
      FDefBrushStyle.Scale := ReadFloatFromIni( Inifile, 'DefBrush', 'Scale', 0 );
      FDefBrushStyle.Angle := ReadFloatFromIni( Inifile, 'DefBrush', 'Angle', 0 );
      FDefBrushStyle.ForeColor := ReadIntFromIni( Inifile, 'DefBrush', 'ForeColor', clblack );
      FDefBrushStyle.BackColor := ReadIntFromIni( Inifile, 'DefBrush', 'BackColor', clblack );

      FDefSymbolStyle.Index := ReadIntFromIni( Inifile, 'DefSymbol', 'Index', 0 );
      FDefSymbolStyle.Rotangle := ReadFloatFromIni( Inifile, 'DefSymbol', 'Rotangle', 0.0 );
      FDefSymbolStyle.Height := ReadFloatFromIni( Inifile, 'DefSymbol', 'Height', -10.0 );

      FDefFontStyle.Name := ReadString( 'DefFont', 'Name', 'Txt' );
      FDefFontStyle.Angle := ReadFloatFromIni( Inifile, 'DefFont', 'Angle', 0.0 );
      FDefFontStyle.Height := ReadFloatFromIni( Inifile, 'DefFont', 'Height', 12.0 );
      FDefFontStyle.Color := ReadIntFromIni( Inifile, 'DefFont', 'Color', clBlack );
      //FDefFontStyle.Style:= ReadIntFromIni( Inifile, DefFont', 'Style', 0.0);

      FDefTTFontStyle.Name := ReadString( 'DefTTFont', 'Name', EzSystem.DefaultFontName );
      FDefTTFontStyle.Angle := ReadFloatFromIni( Inifile, 'DefTTFont', 'Angle', 0.0 );
      FDefTTFontStyle.Height := ReadFloatFromIni( Inifile, 'DefTTFont', 'Height', 12.0 );
      FDefTTFontStyle.Color := ReadIntFromIni( Inifile, 'DefTTFont', 'Color', clBlack );
      FDefTTFontStyle.Style := [];
      If ReadBool( 'DefTTFont', 'Bold', false ) Then
        FDefTTFontStyle.Style := FDefTTFontStyle.Style + [fsbold];
      If ReadBool( 'DefTTFont', 'Italic', false ) Then
        FDefTTFontStyle.Style := FDefTTFontStyle.Style + [fsitalic];
      If ReadBool( 'DefTTFont', 'Underline', false ) Then
        FDefTTFontStyle.Style := FDefTTFontStyle.Style + [fsunderline];
      If ReadBool( 'DefTTFont', 'StrikeOut', false ) Then
        FDefTTFontStyle.Style := FDefTTFontStyle.Style + [fsstrikeout];

      FSelectionPen.Style := ReadIntFromIni( Inifile, 'SelPen', 'Style', 1 );
      FSelectionPen.Color := ReadIntFromIni( Inifile, 'SelPen', 'Color', clRed );
      FSelectionPen.Scale := ReadFloatFromIni( Inifile, 'SelPen', 'Scale', 0.0 );
      FSelectionPen.Width := ReadFloatFromIni( Inifile, 'SelPen', 'Width', 0.0 );

      FSelectionBrush.Pattern := ReadIntFromIni( Inifile, 'SelBrush', 'Pattern', 1 );
      FSelectionBrush.Color := ReadIntFromIni( Inifile, 'SelBrush', 'Color', clYellow );
      FSelectionBrush.Scale := ReadFloatFromIni( Inifile, 'SelBrush', 'Scale', 0 );
      FSelectionBrush.Angle := ReadFloatFromIni( Inifile, 'SelBrush', 'Angle', 0 );
      FSelectionBrush.ForeColor := ReadIntFromIni( Inifile, 'SelBrush', 'ForeColor', clblack );
      FSelectionBrush.BackColor := ReadIntFromIni( Inifile, 'SelBrush', 'BackColor', clblack );

      FBandsBitmapChunkSize := ReadIntFromIni( Inifile, 'General', 'BandsBitmapChunkSize', 65535 );
      FShowText := ReadBool( 'General', 'ShowText', true );
      FControlPointsWidth := ReadIntFromIni( Inifile, 'General', 'ControlPointsWidth', 10 );
      FApertureWidth := ReadIntFromIni( Inifile, 'General', 'ApertureWidth', 8 );
      FMinDrawLimit := ReadIntFromIni( Inifile, 'General', 'MinDrawLimit', 5 );
      FAerialMinDrawLimit := ReadIntFromIni( Inifile, 'General', 'AerialMinDrawLimit', 5 );
      FSelectPickingInside := ReadBool( 'General', 'SelectPickingInside', true );
      FCommonSubDir := ReadString( 'General', 'CommonSubDir', '' );
      FSplineSegs := ReadIntFromIni( Inifile, 'General', 'SplineSegs', 100 );
      FEllipseSegs := ReadIntFromIni( Inifile, 'General', 'EllipseSegs', 50 );
      FArcSegs := ReadIntFromIni( Inifile, 'General', 'ArcSegs', 20 );
      FPointEntitySize := ReadIntFromIni( Inifile, 'General', 'PointEntitySize', 2 );
      FDirectionArrowSize := ReadFloatFromIni( Inifile, 'General', 'DirectionArrowSize', 6.0 );

      {if WasChanged then
      begin
        DecimalSeparator:= SaveDecimalSeparator;
      end; }
    End;
  Finally
    Inifile.free;
  End;
  ApplyChanges;
End;

Procedure TEzPreferences.SaveToFile( Const FileName: String );
Var
  Inifile: TInifile;
Begin
  Inifile := TInifile.Create( FileName );
  Try
    With Inifile Do
    Begin
      //WriteString( 'General', 'DecimalSeparator', DecimalSeparator );

      WriteInteger( 'DefPen', 'Style', FDefPenStyle.Style );
      WriteInteger( 'DefPen', 'Color', FDefPenStyle.Color );
      WriteFloatToIni( Inifile, 'DefPen', 'Scale', FDefPenStyle.Scale );
      WriteFloatToIni( Inifile, 'DefPen', 'Width', FDefPenStyle.Width );

      WriteInteger( 'DefBrush', 'Pattern', FDefBrushStyle.Pattern );
      WriteInteger( 'DefBrush', 'Color', FDefBrushStyle.Color );
      WriteFloatToIni( Inifile, 'DefBrush', 'Scale', FDefBrushStyle.Scale );
      WriteFloatToIni( Inifile, 'DefBrush', 'Angle', FDefBrushStyle.Angle );
      WriteInteger( 'DefBrush', 'ForeColor', FDefBrushStyle.ForeColor );
      WriteInteger( 'DefBrush', 'BackColor', FDefBrushStyle.BackColor );

      WriteInteger( 'DefSymbol', 'Index', FDefSymbolStyle.Index );
      WriteFloatToIni( Inifile, 'DefSymbol', 'Rotangle', FDefSymbolStyle.Rotangle );
      WriteFloatToIni( Inifile, 'DefSymbol', 'Height', FDefSymbolStyle.Height );

      WriteString( 'DefFont', 'Name', FDefFontStyle.Name );
      WriteFloatToIni( Inifile, 'DefFont', 'Angle', FDefFontStyle.Angle );
      WriteFloatToIni( Inifile, 'DefFont', 'Height', FDefFontStyle.Height );
      WriteInteger( 'DefFont', 'Color', FDefFontStyle.Color );

      WriteString( 'DefTTFont', 'Name', FDefTTFontStyle.Name );
      WriteFloatToIni( Inifile, 'DefTTFont', 'Angle', FDefTTFontStyle.Angle );
      WriteFloatToIni( Inifile, 'DefTTFont', 'Height', FDefTTFontStyle.Height );
      WriteInteger( 'DefTTFont', 'Color', FDefTTFontStyle.Color );
      WriteBool( 'DefTTFont', 'Bold', fsbold In FDefTTFontStyle.Style );
      WriteBool( 'DefTTFont', 'Italic', fsitalic In FDefTTFontStyle.Style );
      WriteBool( 'DefTTFont', 'Underline', fsunderline In FDefTTFontStyle.Style );
      WriteBool( 'DefTTFont', 'StrikeOut', fsstrikeout In FDefTTFontStyle.Style );

      WriteInteger( 'SelPen', 'Style', FSelectionPen.Style );
      WriteInteger( 'SelPen', 'Color', FSelectionPen.Color );
      WriteFloatToIni( Inifile, 'SelPen', 'Scale', FSelectionPen.Scale );
      WriteFloatToIni( Inifile, 'SelPen', 'Width', FSelectionPen.Width );

      WriteInteger( 'SelBrush', 'Pattern', FSelectionBrush.Pattern );
      WriteInteger( 'SelBrush', 'Color', FSelectionBrush.Color );
      WriteFloatToIni( Inifile, 'SelBrush', 'Scale', FSelectionBrush.Scale );
      WriteFloatToIni( Inifile, 'SelBrush', 'Angle', FSelectionBrush.Angle );
      WriteInteger( 'SelBrush', 'ForeColor', FSelectionBrush.ForeColor );
      WriteInteger( 'SelBrush', 'BackColor', FSelectionBrush.BackColor );

      WriteInteger( 'General', 'BandsBitmapChunkSize', FBandsBitmapChunkSize );
      WriteBool( 'General', 'ShowText', FShowText );
      WriteInteger( 'General', 'ControlPointsWidth', FControlPointsWidth );
      WriteInteger( 'General', 'ApertureWidth', FApertureWidth );
      WriteInteger( 'General', 'MinDrawLimit', FMinDrawLimit );
      WriteInteger( 'General', 'AerialMinDrawLimit', FAerialMinDrawLimit );
      WriteBool( 'General', 'SelectPickingInside', FSelectPickingInside );
      WriteString( 'General', 'CommonSubDir', FCommonSubDir );
      WriteInteger( 'General', 'SplineSegs', FSplineSegs );
      WriteInteger( 'General', 'EllipseSegs', FEllipseSegs );
      WriteInteger( 'General', 'ArcSegs', FArcSegs );
      WriteInteger( 'General', 'PointEntitySize', FPointEntitySize );
      WriteFloatToIni( IniFile, 'General', 'DirectionArrowSize', FDirectionArrowSize );
    End;
  Finally
    Inifile.free;
  End;
End;

Procedure TEzPreferences.SetToDefault;
Begin
  With FDefPenStyle.FPenStyle Do
  Begin
    Style := 1;
  End;

  With FDefSymbolStyle.FSymbolStyle Do
  Begin
    Index := 0;
    height := -10;
  End;

  With FDefFontStyle.FFontStyle Do
  Begin
    Name := 'txt';
    Height := 12.0;
  End;

  With FDefFontStyle.FFontStyle Do
  Begin
    Name := EzSystem.DefaultFontName;
    Height := 12.0;
  End;

  FShowText := true;

  With FSelectionPen.FPenStyle Do
  Begin
    Style := 1;
    Color := clRed;
    Scale := 0;
  End;

  With FSelectionBrush.FBrushStyle Do
  Begin
    Pattern := 1;
    Color := clYellow;
  End;

  FControlPointsWidth := 10;
  FApertureWidth := 8;
  FMinDrawLimit := 5;
  FAerialMinDrawLimit := 5;
  FSplineSegs := 100;
  FEllipseSegs := 50;
  FArcSegs := 20;

  FSelectPickingInside := True;
End;

Procedure TEzPreferences.SetDefBrushStyle( value: TEzBrushTool );
Begin
  FDefBrushStyle.Assign( value );
End;

Procedure TEzPreferences.SetDefFontStyle( value: TEzFontTool );
Begin
  FDefFontStyle.Assign( value );
End;

Procedure TEzPreferences.SetDefTTFontStyle( value: TEzFontTool );
Begin
  FDefTTFontStyle.Assign( value );
End;

Procedure TEzPreferences.SetDefPenStyle( value: TEzPenTool );
Begin
  FDefPenStyle.Assign( value );
End;

Procedure TEzPreferences.SetDefSymbolStyle( value: TEzSymbolTool );
Begin
  FDefSymbolStyle.Assign( value );
End;

Procedure TEzP

⌨️ 快捷键说明

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