C # + AE's summary of property Query

Source: Internet
Author: User

I have just implemented some functions related to property query. Here I will summarize them.

If there are errors and inspecies, we also hope that experts in GIS and AE development will give some advice.

 

// ****** The second part has a dot error. Now ***********//

 

①: How to obtain Feature Based on featurelayer:

CodeAs follows:

Ilayer player;
Player = frm1.axmapcontrol1. Map. get_layer (layerboxedit. selectedindex) as ilayer; // both frm1 and layerboxedit. selectedindex are variables.
Ifeaturelayer pfeaturelayer;
Pfeaturelayer = player as ifeaturelayer;
If (pfeaturelayer = NULL)
{
Return;
}



Ifeaturecursor pfeaturecursor;
Pfeaturecursor = pfeaturelayer. Search (null, false );
Ifeature pfeature;
Pfeature = pfeaturecursor. nextfeature ();

②: Method for obtaining Feature Based on featureclass:

Ifeaturelayer pfeaturelayer;
Pfeaturelayer = frm1.axmapcontrol1. Map. get_layer (0) as ifeaturelayer;
Ifeatureclass pfeatureclass;
Pfeatureclass = pfeaturelayer. featureclass;
Iqueryfilter pqueryfilter;
Pqueryfilter = new queryfilterclass ();
// Pqueryfilter. whereclause = "";

Ifeature pfeature;

For (Int J = 0; j <pfeatureclass. featurecount (pqueryfilter); j ++)

{

Pfeature = pfeatureclass. getfeature (j );
}

③: Click a subnode in treelist to obtain the feature:

If (E. node. haschildren)
{
Return;
}

If (! (E. node. haschildren) // ************ // this bug exists. If the number of nodes exceeds two levels, an error occurs.
{

For (INT I = 0; I <this. axmapcontrol1.layercount; I ++)
{

// If the parent node name and layer name are the same, obtain the index
If (E. node. parentnode. getvalue (0). tostring () = This. axmapcontrol1.get _ layer (I). Name)
{
Layerindex = I;
Ifeature pfeature;

Pfeature = (this. axmapcontrol1.get _ layer (layerindex) as ifeaturelayer). featureclass. getfeature (Int. parse (this. treelist1.focusednode. getvalue (0). tostring ()));;

}

}

 

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.