Turn from original source AE to create topology
/// <summary>///Create a topology/// </summary>/// <param name= "Featureworkspace" >feature set work space</param>/// <param name= "Featuredatasetname" ></param>/// <param name= "Featureclassname" ></param>/// <returns></returns> PublicItopology create_topology (Ifeatureworkspace featureworkspace,stringFeaturedatasetname,stringFeatureclassname,stringtopologyname) { Try { //1.---Open the feature dataset where the park is located and create a topologyIfeaturedataset Featuredataset =Featureworkspace.openfeaturedataset (featuredatasetname); if(Featuredataset! =NULL) {Itopologycontainer Topologycontainer=(Itopologycontainer) Featuredataset; Itopology topology= Topologycontainer.createtopology ("topo", Topologycontainer.defaultclustertolerance,-1,"");//error in this place .//2.---Add a feature set to the topologyIfeatureclasscontainer Featureclasscontainer =(Ifeatureclasscontainer) Featuredataset; Ifeatureclass Featureclass=Featureclasscontainer.get_classbyname (featureclassname); Topology. AddClass (Featureclass,5,1,1,false);//Parameters:addclass (IClass, double weight, int xyrank, int zrank, Boolean eventnotificationonvalidate). //3.---Back to topology returntopology; } } Catch(Exception ex) {//System.Diagnostics.Debug.WriteLine (ex. ToString ()); MessageBox.Show (ex. ToString ()); } return NULL;} Private voidCreatetopbutton_click (Objectsender, EventArgs e) { //Open the target databaseIworkspace fworkspace = Open_pgdb_workspace ("E:\\topo.mdb"); Ifeatureworkspace FW= Fworkspace asIfeatureworkspace; //Start editingIworkspaceedit Workspaceedit =(Iworkspaceedit) fworkspace; Workspaceedit.startediting (true); Workspaceedit.starteditoperation (); //calling methods to create a topologyItopology topology = Create_topology (FW,"Hn_ds","HN","Polygon_topo"); //Stop Editingworkspaceedit.stopeditoperation (); Workspaceedit.stopediting (true); if(Topology! =NULL) {MessageBox.Show ("Create the topology successfully! "); }}
Startup edits are added later, and if you do not start editing, you are prompted not to perform the operation.
AE Create topology