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

📄 ezibgis.pas

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

Destructor TEzIBLayerInfo.Destroy;
Begin
  FClientData.Free;
  Inherited Destroy;
End;

Function TEzIBLayerInfo.GetVisible: Boolean;
Begin
  with FClientData do
  begin
    If Not visible_init Then
    Begin
      visible := TEzIBLayer( FLayer ).FIBField.AsBoolean['VISIBLE'];
      visible_init := true;
    End;
    result := visible;
  end;
End;

Procedure TEzIBLayerInfo.SetVisible( Value: Boolean );
Begin
  if GetVisible=Value then Exit;
  TEzIBLayer( FLayer ).FIBField.AsBoolean['VISIBLE'] := value;
  FClientData.visible := value;
  FClientData.visible_init:= true;
  with FLayer.Layers.GIS do
    If Assigned( OnVisibleLayerChange ) Then
      OnVisibleLayerChange( FLayer, FLayer.Name );
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetSelectable: Boolean;
Begin
  with FClientData do
  begin
    If Not selectable_init Then
    Begin
      selectable := TEzIBLayer( FLayer ).FIBField.AsBoolean['SELECTABLE'];
      selectable_init := true;
    End;
    result := selectable;
  end;
End;

Procedure TEzIBLayerInfo.SetSelectable( Value: Boolean );
Begin
  if GetSelectable=Value then exit;
  TEzIBLayer( FLayer ).FIBField.AsBoolean['SELECTABLE'] := value;
  FClientData.selectable := value;
  FClientData.selectable_init:= true;
  with FLayer.Layers.GIS do
    If Assigned( OnSelectableLayerChange ) Then
      OnSelectableLayerChange( FLayer, FLayer.Name );
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetIsCosmethic: Boolean;
Begin
  Result:= False;
End;

Procedure TEzIBLayerInfo.SetIsCosmethic( value: Boolean );
Begin
  // nothing to do here
End;

Function TEzIBLayerInfo.GetExtension: TEzRect;
Begin
  With result, TEzIBLayer( FLayer ).FIBField Do
  Begin
    X1 := AsFloat['EXTENSION_x1'];
    Y1 := AsFloat['EXTENSION_y1'];
    X2 := AsFloat['EXTENSION_x2'];
    Y2 := AsFloat['EXTENSION_y2'];
  End;
End;

Procedure TEzIBLayerInfo.SetExtension( Const Value: TEzRect );
Begin
  With Value, TEzIBLayer( FLayer ).FIBField Do
  Begin
    AsFloat['EXTENSION_x1'] := x1;
    AsFloat['EXTENSION_y1'] := y1;
    AsFloat['EXTENSION_x2'] := x2;
    AsFloat['EXTENSION_y2'] := y2;
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetIDCounter: integer;
Begin
  result := 0;
End;

Procedure TEzIBLayerInfo.SetIDCounter( Value: integer );
Begin
  // nothing to do here
End;

Function TEzIBLayerInfo.GetIsAnimationLayer: Boolean;
Begin
  Result:= False;
End;

Procedure TEzIBLayerInfo.SetIsAnimationLayer( Value: Boolean );
Begin
  // nothing to do here
End;

Function TEzIBLayerInfo.GetIsIndexed: Boolean;
Begin
  Result:= true;
End;

Procedure TEzIBLayerInfo.SetIsIndexed( Value: Boolean );
Begin
  // nothing to do here
End;

Function TEzIBLayerInfo.GetCoordsUnits: TEzCoordsUnits;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    If Not coordsunits_init Then
    Begin
      coordsunits := TEzCoordsUnits( FIBField.AsInteger['COORDSUNITS'] );
      coordsunits_init := true;
    End;
    result := coordsunits;
  End;
End;

Procedure TEzIBLayerInfo.SetCoordsUnits( Value: TEzCoordsUnits );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FClientData.coordsunits := value;
    FClientData.coordsunits_init := true;
    FIBField.AsInteger['COORDSUNITS'] := Ord( Value );
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetCoordSystem: TEzCoordSystem;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    If Not coordsystem_init Then
    Begin
      coordsystem := TEzCoordSystem( FIBField.AsInteger['COORDSYSTEM'] );
      coordsystem_init := true;
    End;
    result := coordsystem;
  End;
End;

Procedure TEzIBLayerInfo.SetCoordSystem( Value: TEzCoordSystem );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FClientData.coordsystem := value;
    FClientData.coordsystem_init := true;
    FIBField.AsInteger['COORDSYSTEM'] := Ord( Value );
    If Value = csLatLon Then
    Begin
      CoordMultiplier := DEG_MULTIPLIER;
      FIBField.AsInteger['COORDSUNITS'] := Ord( cuDeg );
    End
    Else
      CoordMultiplier := 1;
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetUseAttachedDB: Boolean;
Begin
  result := True;
End;

Procedure TEzIBLayerInfo.SetUseAttachedDB( Value: Boolean );
Begin
  // nothing to do here
End;

Function TEzIBLayerInfo.GetOverlappedTextAction: TEzOverlappedTextAction;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    If Not overlappedtextaction_init Then
    Begin
      overlappedtextaction := TEzOverlappedtextaction( FIBField.AsInteger['OVERLAPPED_TEXT_ACTION'] );
      overlappedtextaction_init := true;
    End;
    result := overlappedtextaction;
  End;
End;

Procedure TEzIBLayerInfo.SetOverlappedTextAction( Value: TEzOverlappedTextAction );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FClientData.overlappedtextaction := value;
    FClientData.overlappedtextaction_init := True;
    FIBField.AsInteger['OVERLAPPED_TEXT_ACTION'] := Ord( value );
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetOverlappedTextColor: TColor;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    If Not overlappedtextcolor_init Then
    Begin
      overlappedtextcolor := TColor( FIBField.AsInteger['OVERLAPPED_TEXT_COLOR'] );
      overlappedtextcolor_init := true;
    End;
    result := overlappedtextcolor;
  End;
End;

Procedure TEzIBLayerInfo.SetOverlappedTextColor( Value: TColor );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FClientData.overlappedtextcolor := value;
    FClientData.overlappedtextcolor_init := true;
    FIBField.AsInteger['OVERLAPPED_TEXT_COLOR'] := value;
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetTextFixedSize: Byte;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    If Not textfixedsize_init Then
    Begin
      textfixedsize := FIBField.AsInteger['TEXT_FIXED_SIZE'];
      textfixedsize_init := true;
    End;
    result := textfixedsize;
  End;
End;

Procedure TEzIBLayerInfo.SetTextFixedSize( Value: Byte );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FClientData.textfixedsize := value;
    FClientData.textfixedsize_init := true;
    FIBField.AsInteger['TEXT_FIXED_SIZE'] := value;
  End;
  SetModifiedStatus( FLayer );
End;

Function TEzIBLayerInfo.GetTextHasShadow: Boolean;
Begin
  With TEzIBLayer( FLayer ), FClientData Do
  Begin
    TextHasShadow := FIBField.AsBoolean['TEXT_HAS_SHADOW'];
    TextHasShadow_init := True;
    result := TextHasShadow;
  End;
End;

Procedure TEzIBLayerInfo.SetTextHasShadow( value: Boolean );
Begin
  With TEzIBLayer( FLayer ) Do
  Begin
    FIBField.AsBoolean['TEXT_HAS_SHADOW'] := value;
    FClientData.TextHasShadow := value;
    FClientData.TextHasShadow_init := true;
  End;
  SetModifiedStatus( FLayer );
End;

{$IFDEF BCB}
function TEzIBLayerInfo.GetClientData: TEzIBLayerClientData;
begin
  Result := FClientData;
end;
{$ENDIF}


{-------------------------------------------------------------------------------}
{                  TEzIBLayer - class implementation                                }
{-------------------------------------------------------------------------------}

Constructor TEzIBLayer.Create( Layers: TEzBaseLayers; Const AFileName: String );
Begin
  Inherited Create( Layers, AFileName );
  FDBTable:= TEzIBTable.Create( Layers.Gis, '', true, true);
  TEzIBTable(FDBTable).FLayer:= Self;

  FLayerInfo := TEzIBLayerInfo.Create( Self );
  { in this case, FileName = Name because it is a table on the Interbase Server database }
  Self.FileName := AFileName;
  Self.Name := AFileName;

  CoordMultiplier := 1;
  FUpdateRtree := true;
End;

Destructor TEzIBLayer.Destroy;
Begin
  Close;
  If FIBHeader <> Nil Then FreeAndNil( FIBHeader );
  If FIBEntities <> Nil Then FreeAndNil( FIBEntities );
  If FIBField <> Nil Then FreeAndNil( FIBField );
  FreeAndNil( FDBTable );
  Inherited Destroy;
End;

Procedure TEzIBLayer.InitializeOnCreate( Const FileName: String;
                                          AttachedDB, IsAnimation: Boolean;
                                          CoordSystem: TEzCoordSystem;
                                          CoordsUnits: TEzCoordsUnits;
                                          FieldList: TStrings );
Begin
  Modified := True;
End;

Function TEzIBLayer.IsClientServer: Boolean;
Begin
  result := True;
End;

Procedure TEzIBLayer.StartBatchInsert;
Begin
  if FBatchUpdate = true then exit;
  FBatchUpdate:= true;
  //IBStartTrans( FIBEntities );
End;

Procedure TEzIBLayer.CancelBatchInsert;
Begin
  if FBatchUpdate = false then exit;
  FBatchUpdate := false;
  //IBRollbackTrans( FIBEntities );
End;

Procedure TEzIBLayer.FinishBatchInsert;
Begin
  if FBatchUpdate = false then exit;
  FBatchUpdate := false;
  //IBCommitTrans( FIBEntities );
  RebuildTree;
  UpdateMapExtension(QuickUpdateExtension);
End;

Function TEzIBLayer.DataSet: TIBSQL;
Begin
  Result:= FIBEntities;
End;

Function TEzIBLayer.DefineScope( Const Scope: String ): Boolean;
Begin
  { It is assumed that the expression is passed onto directly to SQL server WHERE clause}
  With FIBEntities Do
  Begin
    Close;
    if TEzIBGis(Layers.Gis).FQueryBasicFields then
      SQL.Text := 'SELECT uid,deleted,shapetype,xmin,ymin,xmax,ymax,geometry FROM ENT_%s WHERE ' + Scope
    else
      SQL.Text := 'SELECT * FROM ENT_%s WHERE ' + Scope;
    IBStartTrans( FIBEntities );
    ExecQuery;
  End;
  result := True;
End;

function TEzIBLayer.GetBookmark: Pointer;
begin
  // nothing to do here
end;

procedure TEzIBLayer.GotoBookmark(Bookmark: Pointer);
begin
  // nothing to do here
end;

procedure TEzIBLayer.FreeBookmark(Bookmark: Pointer);
begin
  // nothing to do here
end;

Function TEzIBLayer.DefinePolygonScope( Polygon: TEzEntity; Const Scope: String;
  Operator: TEzGraphicOperator ): Boolean;
Var
  searchType: TSearchType;
Begin
  Case Operator Of
    goWithin, goContains, goIntersects:
      searchType := stOverlap;
    goEntirelyWithin, goContainsEntire:
      searchType := stEnclosure;
  Else
    searchType := stOverlap;
  End;
  SetGraphicFilter( searchType, Polygon.FBox );
  result := true;
End;

Procedure TEzIBLayer.Zap;
Begin
  // nothing to do here
End;

Procedure TEzIBLayer.GetFieldList( Strings: TStrings );
var
  I: Integer;
Begin
  for I:= 1 to DBTable.FieldCount do
    Strings.Add( Format('%s;%s;%d;%d', [DBTable.Field(I), DBTabl

⌨️ 快捷键说明

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