Draw lines of code is as follows:
procedure TfrmMain. MGeoLog_DrawGeoLineClick (Sender: TObject);
Var
ObjLayer: solayer;
Procedure freeSMObj;
The begin
If objLayer<> Nil then objLayer:=nil;
end;
The begin
SuperMap1. Action:=scaNull;
ObjLayer:=SuperMap1. The Layers. The Item [cbblayer. Text];
If objLayer=nil then
The begin
ShowMessage (' choose layer error! ');
FreeSMObj;
exit;
end;
SuperMap1. The Layers. SetEditableLayer (objlayer. Name);
If (SuperMap1. The Layers. GetEditableLayer. Dataset. Type_=scdLine)
Or (SuperMap1. The Layers. GetEditableLayer. Dataset. Type_=scdCAD) then
The begin
SuperMap1. Action:=scaEditCreatePolyLine;
BclickGeoLine:=True;
End
The else
The begin
ShowMessage (' current layer cannot draw line);
FreeSMObj;
exit;
end;
SuperMap1. Refresh;
end;
AfterGeometryAdded events is as follows:
procedure TfrmMain. SuperMap1AfterGeometryAdded (ASender: TObject; NGeometryID: Long);
Var
Objdtv: soDatasetVector;
Objrst: soRecordSet;
ObjLayer: soLayer;
The begin
ObjLayer:=SuperMap1. The Layers. The Item [cbbLayer. Text];
If objLayer=nil then exit;
Objdtv:=objLayer. The Dataset as soDatasetVector;
If objdtv=nil then exit;
Objrst:=objdtv. Query (' ', True, nil, ");
If objrst=nil then exit;
ShowMessage (" OK ");
Objdtv:=nil;
Objrst:=nil;
ObjLayer:=nil;
end;
As long as the pop-up dialog with respect to OK, seek help from god: wow!
CodePudding user response:
And how can SuperMap_GeometryAdded statement to use?