AE + C # merge implementation
Ilayer player;
Ifeaturelayer pfeaturelayer;
Ifeatureclass pfeatureclass;
Iworkspacename pnewwsname;
Ibasicgeoprocessor pbasicgeop;
Ifeatureclassname pfeatureclassname;
Idatasetname pdatasetname;
Ifeatureclass poutputfeatclass;
Ifeaturelayer poutputfeatlayer;
Iarray parray;
Itable ptable;
// Merge the set of Layers
Parray = new arrayclass ();
For (INT I = 0; I <this. axmapcontrol1.layercount; I ++)
{
Player = This. mapc_main.get_layer (I );
Parray. Add (player );
}
// Define the fields table of the output layer
Player = This. mapc_main.get_layer (0 );
Ptable = (itable) player;
Pfeaturelayer = (ifeaturelayer) player;
Pfeatureclass = pfeaturelayer. featureclass;
// Determine whether there are more than two layers
If (this .. axmapcontrol1.layercount <2 ){
MessageBox. Show ("Table Qi failed ");
Return;
}
// Output file type
Pfeatureclassname = new featureclassnameclass ();
Pfeatureclassname. featuretype = esrifeaturetype. esriftsimple;
Pfeatureclassname. shapefieldname = "shape ";
Pfeatureclassname. shapetype = pfeatureclass. shapetype;
// Output the shapefile name and position
Pnewwsname = new workspacenameclass ();
Pnewwsname. workspacefactoryprogid = "esrisponcesfile. shapefileworkspacefactory ";
Pnewwsname. pathname = "E: \ cshape ";
Pdatasetname = (idatasetname) pfeatureclassname;
Pdatasetname. Name = "union_result_1 ";
Pdatasetname. workspacename = pnewwsname;
// Merge Layers
Pbasicgeop = new basicgeoprocessorclass ();
Poutputfeatclass = pbasicgeop. Merge (parray, ptable, pfeatureclassname );
// Add the output layer to the map
Poutputfeatlayer = new featurelayerclass ();
Poutputfeatlayer. featureclass = poutputfeatclass;
Poutputfeatlayer. Name = poutputfeatclass. aliasname;
This .. axmapcontrol1.addlayer (poutputfeatlayer as ilayer, 0 );
From: http://bbs.esrichina-bj.cn/ESRI/viewthread.php? Tid = 27749 & extra = Page % 3d3
TheWorkspacefactoryprogidIdentifies the progid of the workspacefactory object that is used to open that participant workspace.
Here is a list of some of the possible workspacefactoryprogids:
- Esridatasourcesgdb. accessworkspacefactory
- Esristmcesfile. arcinfoworkspacefactory
- Esristmcesfile. cadworkspacefactory
- Esridatasourcesgdb. filegdbworkspacefactory
- Esridatasourcesoledb. oledbworkspacefactory
- Esristmcesfile. pccoverageworkspacefactory
- Esridatasourcesraster. rasterworkspacefactory
- Esridatasourcesgdb. sdeworkspacefactory
- Esridatasourcesfile. shapefileworkspacefactory
- Esridatasourcesoledb. textfileworkspacefactory
- Esristmcesfile. tinworkspacefactory
- Esristmcesfile. vpfworkspacefactory