TatukGIS menu

Knowledge Base





KB10530 - Determine if layer is vector without using the InheritsFrom() function.

You can try to test inheritance using a procedure like the following:

function IsInherited(const _object: TObject; const _name: WideString):
Boolen;
var
 obj: TObject;
 ref: TClass;
 txt: string;
begin
 Result := False;

 if not Assigned(_object) then
  exit;

 ref := obj.ClassType;
 while (ref <> nil) and (not Result) do
 begin
   Result := ref.ClassNameIs(txt);
   ref := ref.ClassParent;
 end;
end;


And test inheritance from TGIS_LayerVector using

IsInerited( my_object, "TGIS_LayerVector" )
 
Created: December 10, 2004, Modified: September 10, 2015