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

📄 ezflashfilergis.pas

📁 很管用的GIS控件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  PPointer = ^Pointer;

  TSPAApply = Function( TheIndex: Integer; TheItem: Pointer ): Integer;

  TSecDir = Array[0..4095] Of Pointer;
  PSecDir = ^TSecDir;
  TSPAQuantum = ( SPASmall, SPALarge );

  TSparsePointerArray = Class( TObject )
  Private
    secDir: PSecDir;
    slotsInDir: Word;
    indexMask, secShift: Word;
    FHighBound: Integer;
    FSectionSize: Word;
    cachedIndex: Integer;
    cachedPointer: Pointer;
    Function GetAt( Index: Integer ): Pointer;
    Function MakeAt( Index: Integer ): PPointer;
    Procedure PutAt( Index: Integer; Item: Pointer );
  Public
    Constructor Create( Quantum: TSPAQuantum );
    Destructor Destroy; Override;

    Function ForAll( ApplyFunction: Pointer {TSPAApply} ): Integer;

    Procedure ResetHighBound;

    Property HighBound: Integer Read FHighBound;
    Property SectionSize: Word Read FSectionSize;
    Property Items[Index: Integer]: Pointer Read GetAt Write PutAt; Default;
  End;

  { TSparseList class }

  TSparseList = Class( TObject )
  Private
    FList: TSparsePointerArray;
    FCount: Integer;
    FQuantum: TSPAQuantum;
    Procedure NewList( Quantum: TSPAQuantum );
  Protected
    Procedure Error; Virtual;
    Function Get( Index: Integer ): Pointer;
    Procedure Put( Index: Integer; Item: Pointer );
  Public
    Constructor Create( Quantum: TSPAQuantum );
    Destructor Destroy; Override;
    Function Add( Item: Pointer ): Integer;
    Procedure Clear;
    Procedure Delete( Index: Integer );
    Procedure Exchange( Index1, Index2: Integer );
    Function First: Pointer;
    Function ForAll( ApplyFunction: Pointer {TSPAApply} ): Integer;
    Function IndexOf( Item: Pointer ): Integer;
    Procedure Insert( Index: Integer; Item: Pointer );
    Function Last: Pointer;
    Procedure Move( CurIndex, NewIndex: Integer );
    Procedure Pack;
    Function Remove( Item: Pointer ): Integer;
    Property Count: Integer Read FCount;
    Property Items[Index: Integer]: Pointer Read Get Write Put; Default;
  End;

  { TMWSparseList class }

  TMWSparseList = Class
  Private
    FList: TSparseList;
  Protected
    Function Get( Index: Integer ): Integer;
    //Function GetDataExists( Index: Integer ): Boolean;
    Procedure Put( Index: Integer; Value: Integer );
    //Procedure PutDataExists( Index: Integer; Value: Boolean );
    Procedure Error;
  Public
    Constructor Create( Capacity: Integer );
    Destructor Destroy; Override;
    Function HasData( Index: Integer ): Boolean;
    Procedure Delete( Index: Integer );
    Procedure Exchange( Index1, Index2: Integer );
    Procedure Insert( Index: Integer; Const Value: Integer );
    Procedure Clear;

    Property LocalRecno[Index: Integer]: Integer Read Get Write Put;
    //Property DataExists[Index: Integer]: Boolean Read GetDataExists Write PutDataExists;
  End;

implementation

uses
  IniFiles, EzSystem, EzConsts, EzEntities, EzCadCtrls,
  EzBasicCtrls, EzImpl, EzExpressions
{$IFDEF COMPRESSED_ENTITY}
  , EzZLibUtil
{$ENDIF}
{$IFDEF LEVEL6}
  , Variants
{$ENDIF}
 ;

resourcestring

  SEz_GisFlashFilerVersion = 'TEzFlashFilerGis for EzGIS 1.96 Version 0.9.04 (Jan, 2003)';


{------------------------------------------------------------------------------}
{                     A bookmark for FlashFiler Layers                         }
{------------------------------------------------------------------------------}
type

  TFlashFilerBookmark = class
  private
    FRecno: Integer;
    FFiltered: Boolean;
    FFilterRecNo: Integer;
    FOl: TIntegerList;
  public
    constructor Create;
    destructor Destroy; override;
  end;

{ TFlashFilerBookmark }

constructor TFlashFilerBookmark.Create;
begin
  inherited Create;
  FOl := TIntegerList.Create;
end;

destructor TFlashFilerBookmark.Destroy;
begin
  FOl.Free;
  inherited;
end;


{------------------------------------------------------------------------------}
{                 TEzFlashFilerLayerInfo - class implementation                }
{------------------------------------------------------------------------------}

function TEzFlashFilerLayerInfo.GetVisible: Boolean;
begin
  If (TEzFlashFilerLayer(FLayer).FFlashFilerHeader = Nil) Or
    Not TEzFlashFilerLayer(FLayer).FFlashFilerHeader.Active Then
    Result:= False
  Else
    Result := TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Visible').AsBoolean;
end;

procedure TEzFlashFilerLayerInfo.SetVisible(Value: Boolean);
begin
  if (GetVisible = Value ) Or (TEzFlashFilerLayer(FLayer).FFlashFilerHeader = Nil) Or
    Not TEzFlashFilerLayer(FLayer).FFlashFilerHeader.Active Then  Exit;

  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Visible').AsBoolean := Value;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  with FLayer.Layers.Gis do
    if Assigned(OnVisibleLayerChange) then
      OnVisibleLayerChange(FLayer, FLayer.Name);
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetSelectable: Boolean;
begin
  If (TEzFlashFilerLayer(FLayer).FFlashFilerHeader = Nil) Or
    Not TEzFlashFilerLayer(FLayer).FFlashFilerHeader.Active Then
    Result:= False
  Else
    Result := TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Selectable').AsBoolean;
end;

procedure TEzFlashFilerLayerInfo.SetSelectable(Value: Boolean);
begin
  if (GetSelectable = Value ) Or (TEzFlashFilerLayer(FLayer).FFlashFilerHeader = Nil) Or
    Not TEzFlashFilerLayer(FLayer).FFlashFilerHeader.Active Then  Exit;
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Selectable').AsBoolean := Value;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  with FLayer.Layers.Gis do
    if Assigned(OnSelectableLayerChange) then
      OnSelectableLayerChange(FLayer, FLayer.Name);
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetIsCosmethic: Boolean;
begin
  Result := False;
end;

procedure TEzFlashFilerLayerInfo.SetIsCosmethic(Value: Boolean);
begin
  // Nothing to do here
end;

function TEzFlashFilerLayerInfo.GetExtension: TEzRect;
begin
  with Result, TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    X1 := FieldByName('Extension_X1').AsFloat;
    Y1 := FieldByName('Extension_Y1').AsFloat;
    X2 := FieldByName('Extension_X2').AsFloat;
    Y2 := FieldByName('Extension_Y2').AsFloat;
  end;
end;

procedure TEzFlashFilerLayerInfo.SetExtension(const Value: TEzRect);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Extension_X1').AsFloat := Value.X1;
      FieldByName('Extension_Y1').AsFloat := Value.Y1;
      FieldByName('Extension_X2').AsFloat := Value.X2;
      FieldByName('Extension_Y2').AsFloat := Value.Y2;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetIDCounter: Integer;
begin
  Result := 0;
end;

procedure TEzFlashFilerLayerInfo.SetIDCounter(Value: Integer);
begin
  // Nothing to do here
end;

function TEzFlashFilerLayerInfo.GetIsAnimationLayer: Boolean;
begin
  Result := False;
end;

procedure TEzFlashFilerLayerInfo.SetIsAnimationLayer(Value: Boolean);
begin
  // Nothing to do here
end;

function TEzFlashFilerLayerInfo.GetIsIndexed: Boolean;
begin
  Result := True;
end;

procedure TEzFlashFilerLayerInfo.SetIsIndexed(Value: Boolean);
begin
  // Nothing to do here
end;

function TEzFlashFilerLayerInfo.GetCoordsUnits: TEzCoordsUnits;
begin
  Result := TEzCoordsUnits(TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('CoordsUnits').AsInteger);
end;

procedure TEzFlashFilerLayerInfo.SetCoordsUnits(Value: TEzCoordsUnits);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('CoordsUnits').AsInteger := Ord(Value);
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetCoordSystem: TEzCoordSystem;
begin
  Result := TEzCoordSystem(TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('CoordSystem').AsInteger);
end;

procedure TEzFlashFilerLayerInfo.SetCoordSystem(Value: TEzCoordSystem);
begin
  with TEzFlashFilerLayer(FLayer) do
  begin
    try
      FFlashFilerHeader.Edit;
      FFlashFilerHeader.FieldByName('CoordSystem').AsInteger := Ord(Value);
      if Value = csLatLon then
      begin
        CoordMultiplier := DEG_MULTIPLIER;
        FFlashFilerHeader.FieldByName('CoordsUnits').AsInteger := Ord(cuDeg);
      end
      else
        CoordMultiplier := 1;
      FFlashFilerHeader.Post;
    except
      if FFlashFilerHeader.State = dsEdit then
        FFlashFilerHeader.Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetUseAttachedDB: Boolean;
begin
  Result := True;
end;

procedure TEzFlashFilerLayerInfo.SetUseAttachedDB(Value: Boolean);
begin
  // Nothing to do here
end;

function TEzFlashFilerLayerInfo.GetOverlappedTextAction: TEzOverlappedTextAction;
begin
  Result := TEzOverlappedTextAction(TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Overlapped_Text_Action').AsInteger);
end;

procedure TEzFlashFilerLayerInfo.SetOverlappedTextAction(Value: TEzOverlappedTextAction);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Overlapped_Text_Action').AsInteger := Ord(Value);
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetOverlappedTextColor: TColor;
begin
  Result := TColor(TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Overlapped_Text_Color').AsInteger);
end;

procedure TEzFlashFilerLayerInfo.SetOverlappedTextColor(Value: TColor);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Overlapped_Text_Color').AsInteger := Value;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetTextFixedSize: Byte;
begin
      Result := TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Text_Fixed_Size').AsInteger;
end;

procedure TEzFlashFilerLayerInfo.SetTextFixedSize(Value: Byte);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Text_Fixed_Size').AsInteger := Value;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

function TEzFlashFilerLayerInfo.GetTextHasShadow: Boolean;
begin
  Result := TEzFlashFilerLayer(FLayer).FFlashFilerHeader.FieldByName('Text_Has_Shadow').AsBoolean;
end;

procedure TEzFlashFilerLayerInfo.SetTextHasShadow(Value: Boolean);
begin
  with TEzFlashFilerLayer(FLayer).FFlashFilerHeader do
  begin
    try
      Edit;
      FieldByName('Text_Has_Shadow').AsBoolean := Value;
      Post;
    except
      if State = dsEdit then
        Cancel;
      raise;
    end;
  end;
  SetModifiedStatus(FLayer);
end;

{------------------------------------------------------------------------------}

⌨️ 快捷键说明

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