阅读:2729回复:7
在MapX中实现图元闪烁源码[转载]!
在这里,我们也应谢谢作者[由alice原创]
MapX图元分三种类型: 1、线(Line),即miFeatureTypeLine 2、区域(Region),即miFeatureTypeRegion 3、点符号(Symbol),即miFeatureTypeSymbol 加入一个时钟控件,并在时钟控件中实现以下代码: procedure 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.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; 这里是把选中的图元实现闪烁,并把图元居中 实现图元闪烁的另一个方法: 假设图元原大小是20,改变后大小是15 if ft.Style.SymbolBitmapSize=20 then ft.Style.SymbolBitmapSize:=15 else ft.Style.SymbolBitmapSize:=20; ft.Update(EmptyParam, EmptyParam); ft是symbol类型的 |
|
1楼#
发布于:2003-12-05 15:39
好东西!
|
|
|
3楼#
发布于:2003-12-09 17:00
有些东西是给大家提供的一种方法或思路!
具体的实现,还得自己动手啊! |
|
4楼#
发布于:2003-12-10 14:23
这篇文章传的是多,他的意图是好的,可是不实用,太理想化了,我在参考他的时候就遇到了太多的不合理,搞得我一再修改。不知道有没有人有同感!
|
|
5楼#
发布于:2003-12-29 16:52
ft是symbol类型的,如何设置ft为symbol类型,请讲一下,谢谢!
|
|
6楼#
发布于:2004-01-02 13:32
看看下面的相关帮助,论坛内也有,也可以找找!
Style.SupportsBitmapSymbols property Style.SymbolBitmapColor property Style.SymbolBitmapName property Style.SymbolBitmapOverrideColor property Style.SymbolBitmapSize property Style.SymbolBitmapTransparent property Style.SymbolCharacter property Style.SymbolFont property Style.SymbolFontBackColor property Style.SymbolFontColor property Style.SymbolFontHalo property Style.SymbolFontOpaque property Style.SymbolFontRotation property Style.SymbolFontShadow property Style.SymbolType property Style.SymbolVectorColor property Style.SymbolVectorSize property |
|
7楼#
发布于:2004-12-29 16:56
有没有vb的啊 |
|