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 ()));;
}
}