C
china_liuyu
Unregistered / Unconfirmed
GUEST, unregistred user!
在控件中定义了这样一个函数
procedure TResMap.AddRegionToMap(TypeId: integer;
const ObjectId: WideString);
var
objdv:sodatasetvector;
objrc:sorecordset;
//objgeoline:sogeoline;
objgeometry:sogeometry;
strlayername:string;
iObjectId,iLayerId:integer;
begin
objdv:=sodatasetvector(m_workspace.Datasources[1].Datasets['MAPSYS_LAYER']);
objrc:=objdv.Query('TYPEID='+inttostr(TypeId),false,nil,'');
//10/29修改
iLayerId:=objrc.GetFieldValue('SMID');
objdv:=sodatasetvector(m_workspace.Datasources[1].Datasets[TypeIdToTableName(typeid)]);
objrc:=objdv.Query('smid<0',true,nil,'');
//为空的记录集
if supermap.TrackingLayer.EventCount =0 then
exit;
objgeometry:=supermap.TrackingLayer.event(1).Geometry;
iobjectid:=objrc.AddNew(objgeometry);
objrc.SetFieldValue('MAPID',strMapFlag);
objrc.SetFieldValue('LAYERID',iLayerId);
objrc.SetFieldValue('OBJECTID',ObjectId);
objrc.Update;
//10/29修改
supermap.TrackingLayer.ClearEvents;
supermap.selection.Dataset:=objdv;
supermap.selection.Add(iobjectid);
btn_Pointselect.Down:=false;
supermap.Refresh;
baddregion:=false;
end;
在调用时是这样的:
int iObjectType;
AnsiString strObjectID;
iObjectType = 200;
strObjectID = "Test";
ResMap->AddPointToMap(iObjectType, WideString(strObjectID));
问题是:在C++Builder 6中调试时,在调用函数前iObjectType是200,在调用函数后iObjectType是11629250;在Delphi 6中调试,TypeId一开始就是11629250。
procedure TResMap.AddRegionToMap(TypeId: integer;
const ObjectId: WideString);
var
objdv:sodatasetvector;
objrc:sorecordset;
//objgeoline:sogeoline;
objgeometry:sogeometry;
strlayername:string;
iObjectId,iLayerId:integer;
begin
objdv:=sodatasetvector(m_workspace.Datasources[1].Datasets['MAPSYS_LAYER']);
objrc:=objdv.Query('TYPEID='+inttostr(TypeId),false,nil,'');
//10/29修改
iLayerId:=objrc.GetFieldValue('SMID');
objdv:=sodatasetvector(m_workspace.Datasources[1].Datasets[TypeIdToTableName(typeid)]);
objrc:=objdv.Query('smid<0',true,nil,'');
//为空的记录集
if supermap.TrackingLayer.EventCount =0 then
exit;
objgeometry:=supermap.TrackingLayer.event(1).Geometry;
iobjectid:=objrc.AddNew(objgeometry);
objrc.SetFieldValue('MAPID',strMapFlag);
objrc.SetFieldValue('LAYERID',iLayerId);
objrc.SetFieldValue('OBJECTID',ObjectId);
objrc.Update;
//10/29修改
supermap.TrackingLayer.ClearEvents;
supermap.selection.Dataset:=objdv;
supermap.selection.Add(iobjectid);
btn_Pointselect.Down:=false;
supermap.Refresh;
baddregion:=false;
end;
在调用时是这样的:
int iObjectType;
AnsiString strObjectID;
iObjectType = 200;
strObjectID = "Test";
ResMap->AddPointToMap(iObjectType, WideString(strObjectID));
问题是:在C++Builder 6中调试时,在调用函数前iObjectType是200,在调用函数后iObjectType是11629250;在Delphi 6中调试,TypeId一开始就是11629250。