阅读:1521回复:1
怎样查找地图中的图元?
请教高手,在c#中怎样通过MapX实现查找地图中的图元???
|
|
1楼#
发布于:2006-06-22 16:52
vc+Mapx
<P>CStringArray * CAppClientView::FindMap(CString m_LayerName, CString m_FindText, bool bFindFlag)<BR>{<BR> CMapXLayer Layer;<BR> CMapXFeature Feature;<BR> <BR> CStringArray *m_pFindArray;<BR> m_pFindArray = new CStringArray;<BR> // 判断是否存在tempLayer图层<BR> CString temp;<BR> CMapXLayers layers=m_ctrlMapX.GetLayers();<BR> int i,j,k,iCount,iAllCount;<BR> CString m_LayerNameTemp;<BR> iAllCount=0;<BR> k = 0;<BR> for(i=0;i<layers.GetCount();i++)<BR> {<BR> Layer=layers.Item(i+1);<BR> m_LayerNameTemp= Layer.GetName();<BR> if (m_LayerNameTemp=="tempAnimate")<BR> continue;<BR> else<BR> {<BR> if(m_LayerName=="全部")<BR> {<BR> m_pFindArray->Add("图层"+m_LayerNameTemp);<BR> m_Layers[k] = m_LayerNameTemp;</P>
<P> }<BR> else<BR> {<BR> m_pFindArray->Add("图层"+m_LayerName);<BR> m_Layers[k] = m_LayerName;<BR> m_LayerNameTemp = m_LayerName;<BR> }<BR> Layer=m_ctrlMapX.GetLayers().Item(m_LayerNameTemp);<BR> <BR> if (bFindFlag==false)<BR> Aftrs[k] = Layer.Search(" name like \"%"+m_FindText+"%\"");<BR> else<BR> Aftrs[k] = Layer.Search(" name =\""+m_FindText+"\"");<BR> //ftrs.Item(i)<BR> iCount = Aftrs[k].GetCount(); <BR> for(j=0;j<iCount;j++)<BR> {<BR> Feature =Aftrs[k].Item(j+1); //Layer.AllFeatures().Item(i+1);<BR> temp = Feature.GetKeyValue();<BR> m_pFindArray->Add(temp);<BR> iAllCount++;<BR> }<BR> k++;<BR> if(i==layers.GetCount()-1)<BR> if(iAllCount==0)<BR> MessageBox("没有符合条件的记录","提示",MB_OK);<BR> if(m_LayerName!="全部")<BR> break;<BR> }<BR>}<BR> return m_pFindArray;<BR>}</P> |
|