C # arcengine Implement click Feature Highlighting and pop its properties

Source: Internet
Author: User

This article simulates the identify (recognition) function in ArcMap by clicking on the feature to highlight it and pop up its property sheet! This article only made a click query!

The environment used in this article is vs2010,aecengine based on the C # language, and the interface is made with Dev, which is slightly better than the Windows-brought form, with the following effects:

Main implementation code (under Axmapcontrol1_onmousedown):

1                         itopologicaloperator Ptopo;2 igeometry pgeometry;3 IFeature pfeature;4 Ifeaturelayer Pfeaturelayer;5 ifeaturecursor pcursor;6 Ispatialfilter PFilter;7 DataTable DataTable;8                         9                          for(inti =0; i < AxMapControl1.Map.LayerCount; i++)Ten                         { One                              APPoint =NewPointclass (); - ppoint.putcoords (E.MAPX, e.mapy); -Ptopo = PPoint asItopologicaloperator; -                             DoubleM_radius =1; -Pgeometry = Ptopo.buffer (M_radius); +                             if(Pgeometry = =NULL) -                                 Continue; +AxMapControl1.Map.SelectByShape (Pgeometry,NULL, True);//The third parameter is whether to select only one AAxmapcontrol1.refresh (Esriviewdrawphase.esriviewgeoselection,NULL,NULL);//highlight highlighting for selected features atPFilter =NewSpatialfilterclass (); -Pfilter.spatialrel =esrispatialrelenum.esrispatialrelintersects; -Pfilter.geometry =Pgeometry; -Pfeaturelayer = AxMapControl1.Map.get_Layer (i) asIfeaturelayer; -Pcursor = Pfeaturelayer.search (PFilter,false); inPfeature =pcursor.nextfeature (); -                             stringFieldName; to                             if(Pfeature! =NULL) -                             { the                                 if(application.openforms["Otherqueryform"] ==NULL) *                                 { $Otherqueryform =Newotherqueryform ();Panax Notoginseng Otherqueryform. Show (); -                                 } the                                 Else +                                 { Aapplication.openforms["Otherqueryform"]. Show (); the }//here the main control subform does not pop up repeatedly -DataTable =NewDataTable (); $                                  for(intK =0; K <2; k++) $                                 { -                                     if(k = =0) -                                     { theDATATABLE.COLUMNS.ADD ("Properties"); -                                     }Wuyi                                     if(k = =1) the                                     { -DATATABLE.COLUMNS.ADD ("value"); Wu                                     } -                                 } About DataRow DataRow; $                                  for(intj =0; J < PFeature.Fields.FieldCount; J + +) -                                 { -DataRow =Datatable.newrow (); -                                      for(intm =0; M <2; m++) A                                     { +                                         if(M = =0) the                                         { -FieldName =PFeature.Fields.get_Field (j). Name; $DATAROW[M] =FieldName; the                                         } the                                         if(M = =1) the                                         { the                                             if(PFeature.Fields.get_Field (j). Name = ="Shape") -                                             { in                                                 if(PFeature.Shape.GeometryType = =ESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) the                                                 { theDATAROW[M] ="Point"; About                                                 } the                                                 if(PFeature.Shape.GeometryType = =ESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) the                                                 { theDATAROW[M] ="Line"; +                                                 } -                                                 if(PFeature.Shape.GeometryType = =ESRI. ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) the                                                 {BayiDATAROW[M] ="face"; the                                                 } the                                             } -                                             Else -                                             { theDATAROW[M] =Pfeature.get_value (j). ToString (); the                                             } the                                         } the                                     } - DataTable.Rows.Add (DataRow); the                                 } theOtherqueryform.dataGridView1.DataSource =dataTable; theOtherqueryform.layername_dev. Text =Pfeaturelayer.name;94 Otherqueryform.dataGridView1.Refresh (); thePfeature =NULL; the                                  Break; the                             } About}

C # arcengine Implement click Feature Highlighting and pop its properties

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.