发布网友 发布时间:2022-04-21 00:05
共1个回答
热心网友 时间:2023-07-22 10:32
MapX 图元分三种类型: 线 ( Line ) , 即 miFeatureTypeLine; 区 域 ( Region ) , 即miFeatureTypeRegion; 点符号 ( Symbol) ,即 miFeatureTypeSymbol。
加入一个时钟控件,并在时钟控件中实现以下代码:
procere TMapFrm. tmFlashSelectTimer( Sender: TObject) ;
var
ft: CMapXFindFeature;
lyr: CMapXLayer;
bExist: Boolean;
i: Integer;
str: String;
ds: CMapXDataset;
begin
bExist: = False;
for i: = 1 to mapCity. Layers. Count do
begin
if mapCity. Layers. Item[i]. Name = m_strSelLyr then
begin
bExist: = True;
break;
end;
end;
if not bExist then
begin
tmFlashSelect. Enabled: = False;
MsgFrm: = TMsgFrm. Create( Self) ;
MsgFrm. m_strMsg: = Format( '图层[% s]信息不存在! ',[m_strSelLyr]) ;
MsgFrm. ShowModal;
MsgFrm. Free;
Exit;
end;
lyr: = mapCity. Layers. _Item( m_strSelLyr) ;
ds: = mapCity. Datasets. Add( miDataSetLayer,lyr,EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam) ;
lyr. Find. FindDataset: = ds;
lyr. Find. FindField: = ds. Fields. Item[1];
str: = Format( '% d',[m_nSelID]) ;
ft: = lyr. Find. Search( str,EmptyParam) ;
if ft. FindRC mod 10 < > 1 then
begin
tmFlashSelect. Enabled: = False;
MsgFrm: = TMsgFrm. Create( Self) ;
MsgFrm. m_strMsg: = Format( '单位点[% s]信息不存在! ',[m_strCorpName]) ;
MsgFrm. ShowModal;
MsgFrm. Free;
Exit;
end;
case ft. type_ of
miFeatureTypeLine:
begin
if ft. Style. LineColor = miColorWhite then
ft. Style. LineColor: = miColorRed
else
ft. Style. LineColor: = miColorWhite;
end;
miFeatureTypeRegion:
begin
if ft. Style. RegionColor = miColorGreen then
ft. Style. RegionColor: = miColorRed
else
ft. Style. RegionColor: = miColorGreen;
end;
miFeatureTypeSymbol:
begin
if not m_bFlashSel then
lyr. Selection. Replace( ft)
else
lyr. Selection. ClearSelection;
m_bFlashSel: = not m_bFlashSel;
end;
end;
ft. Update( EmptyParam,EmptyParam) ;
if not m_bCenter then
begin
m_bCenter: = True;
mapCity. CenterX: = ft. CenterX;
mapCity. CenterY: = ft. CenterY;
mapCity. Refresh;
end;
end;