This document is archived and information here might be outdated. Recommended version. |
The Globe server identify result collection.
GlobeServerIdentifyResults co class allows users to get access to GlobeServerIdentifyResult elements, through its get Element method, or to do an Insert, Remove (and RemoveAll) or Count via IGlobeServerIdentifyResults interface respectively.
Interfaces | Description |
---|---|
IGlobeServerIdentifyResults | Provides access to the Globe server identify result collection. |
IPersist (esriSystem) | |
IPersistStream (esriSystem) | |
IXMLSerialize (esriSystem) | Provides access to members that XML serialize and deserialize an object to/from XML. |
IXMLVersionSupport (esriSystem) | Provides access to members that help in serializing an object to different namespaces (versions). |
//Do Identify....
private void Identify(IAGSServerConnection pAGSServerConnection) {
//use the connecton object passed to get to the GlobeServerLayer objects...
IAGSEnumServerObjectName pEnumSOName;
pEnumSOName = pAGSServerConnection.ServerObjectNames;
IAGSServerObjectName pSOName;
pSOName = pEnumSOName.Next();
//
while (pSOName !=null)
{
System.Diagnostics.Debug.WriteLine(pSOName.Name,pSOName.Type);
if(pSOName.Type=="GlobeServer") break; //break on the first found available globeSevrer object...
pSOName = pEnumSOName.Next();
}
//create a globeserver, globeserverlayer objects ...
IGlobeServerLayer pglobeSevrerLayer=new GlobeServerLayerClass();
//get the severobject from the GlobeSeverLayer...
int layerid=0;
pglobeSevrerLayer.ServerConnect(pSOName,pSOName.Name,layerid);
IGlobeServer pglobeServer=new GlobeServerClass();
pglobeServer= pglobeSevrerLayer.GlobeServer;
//identify
//pglobeServer=pglobeServerLayer.GlobeServer;
IGlobeLayerInfos ipLayerInfos;
int parentID=0; //will force return for all layers...
ipLayerInfos= pglobeServer.get_LayerInfos(parentID);
IGlobeLayerInfo pglobeLayerinfo=new GlobeLayerInfoClass();
int nLayers;
nLayers=ipLayerInfos.Count;
bool visible;
int layerID=0;
for (int i=0; i<nLayers;++i)
{
pglobeLayerinfo=ipLayerInfos.get_Element(i);
visible=pglobeLayerinfo.Visible;
layerID=pglobeLayerinfo.ID;
if (visible==true)
break; //exit when the frist visibile layer is found...
}
//do identify...
IGeometry pSearchShape= new EnvelopeClass();
//need to set pSearchShape to a valid geometry object for identifying features
//rasters work ok even if a null geometry object is passed...
IEnvelope penvelop=pglobeLayerinfo.Extent.Envelope; //simply takes the layer extent as the envelope....
pSearchShape = pglobeLayerinfo.Extent.Envelope;
IGlobeServerIdentifyResults pglobeServIdResults= new GlobeServerIdentifyResultsClass();
pglobeServIdResults = (IGlobeServerIdentifyResults) pglobeServer.Identify(layerID,-1,pSearchShape);
IGlobeServerIdentifyResult pglobeServIdRes= new GlobeServerIdentifyResultClass();
int ServerRes=0;
pglobeServIdRes = pglobeServIdResults.get_Element(ServerRes);
//output the identify resutls....
System.Diagnostics.Debug.WriteLine(pglobeServIdRes.Name);
System.Diagnostics.Debug.WriteLine(pglobeServIdRes.ObjectID);