User Tools

Site Tools


api:dk11:delphi:gisviewer.tgis_viewer.get_string

TGIS_Viewer.Get method

DK11 for Delphi | GisViewer.TGIS_Viewer.Get | Constructors | Fields | Methods | Properties | Events

Retrieve the layer identified by a name. Sublayer or compund layers can be found by do notation like 'name.sublyer'

Available also on: .NET | Java | ActiveX | Python.

Syntax

Implements IGIS_Viewer.Get.

// Delphi
public
  function Get(
    const _name : String
  ) : TGIS_LayerAbstract;
// C++ Builder
public:
  TGIS_LayerAbstract* Get(
    const UnicodeString _name
  );

Parameters

Name Type Description
_name String name of layer to be found

Result

Type Description
TGIS_LayerAbstract Found layer or nil if not found.

Example

Delphi

procedure MyClass.GetLayer(_const param : Integer);
var
  ll : TGIS_LayerVector ;
begin
 
  // we get a layer by its name
  ll := TGIS_LayerVector( Gis.Get( 'states' ) );
 
  // if any found, let's change its attributes
  if ll <> nil then begin
    case _param of
      1 : ll.Params.Labels.Field := 'name' ;
      2 : ll.Params.Labels.Field := 'capital' ;
    else  ll.Params.Labels.Field := '' ;
    end ;
  end ;
  GIS.Update ;
end ;
 
function MyClass.DeleteLayer(const _name : String) : Boolean;
begin
  Result:=False;
   try
    GIS.Delete (_name);
    Result:=True;
   except
    ShowMessage ('Layer not found');
   end ;
end ;

References

2024/12/20 22:20

Page Tools