|
阅读:918回复:0
VC开发AO-画线出现问题,请高手指点!
<P>void CMy1105Dlg::OnOnMouseDownMapcontrol1(long button, long shift, long x, long y, double mapX, double mapY)
{</P> <P>ILayerPtr ilayer;</P> <P> for(b=0;b<=a-1;b++) { m_ipMapControl->get_Layer(b,;ilayer); IFeatureLayerPtr ifeatlayer(ilayer); IFeatureClassPtr ifeatclass; ifeatlayer->get_FeatureClass(;ifeatclass); CComBSTR storename; ifeatlayer->get_Name(;storename); if(storename="ushigh") { IPointPtr ippoint(CLSID_Point); if(ippoint==NULL)return; ippoint->PutCoords(mapX,mapY); IPointPtr ippoint1(CLSID_Point); if(ippoint1==NULL)return; ippoint1->PutCoords(mapX,mapY);</P> <P> IPolylinePtr ipline(CLSID_Polyline); if(ipline==NULL)return; ipline->get_FromPoint(;ippoint); ipline->get_ToPoint(;ippoint1); IGeometryPtr ipgeometry(ipline); if(ipgeometry==NULL)return; IFeaturePtr ifeat; ifeatclass->CreateFeature(;ifeat); ifeat->putref_Shape(ipgeometry); ifeat->Store(); long featcount1; long fieldid; IQueryFilterPtr iquery; ifeatclass->FeatureCount(iquery,;featcount1); IRowPtr irow; ITablePtr itable; CComBSTR fieldname="TYPE"; CComVariant varFn1("www");/ ifeat->get_Table(;itable); if(itable==NULL)return; itable->GetRow(featcount1-1,;irow); itable->FindField(fieldname,;fieldid); irow->put_Value(fieldid,varFn1); irow->Store(); m_ipMapControl->DrawShape(ipgeometry,NULL); m_ipMapControl->Refresh(esriViewGeography); } } } </P> <P>}</P> <P>此代码不存在错误,能给属性表添加属性,但是却不能显示所画的线,为什么?</P> [此贴子已经被作者于2004-7-31 8:59:30编辑过]
|
|