[fdo-users] SDF using FeatureClassCollection

raghulan neo.exterminator at gmail.com
Fri Oct 12 00:21:38 PDT 2012


Thnx for the hint...How to declare a FeatureClassCollection?

here is the complete code snippet..
============================================================= 
//create the feature class definitions store all feature class in a
collection 
            FeatureClassCollection fcoll = null; 

            
            //create all feature class 
            FeatureClass class_points = new FeatureClass("Points", "Point
information"); 
            FeatureClass class_alignment = new FeatureClass("Alignments",
"Alignment information"); 
            FeatureClass class_parcels = new FeatureClass("Parcels",
"Parcels information"); 
            FeatureClass class_pipes = new FeatureClass("Pipes", "Pipes
information"); 
            FeatureClass class_structures = new FeatureClass("Structures",
"Structures information"); 

//add all the feature classes to the collection <<< this is where my
application crashing.. 
                fcoll.Add(class_points); 
                fcoll.Add(class_alignment); 
                fcoll.Add(class_parcels); 
                fcoll.Add(class_pipes); 
                fcoll.Add(class_structures); 

//create property definition for each feature class - here for each class i
am adding property definition from a seperate class called metadata...
            for(int i = 0; i <15; i++)
            {
                if (i < 2)
                {
                   
class_points.Properties.Add(Metadata.get_point_property(i));
                }
                if (i < 12)
                {
                   
class_pipes.Properties.Add(Metadata.get_pipe_property(i));
                }
                
            }

//create the schema and add the class definition - getting names from UI for
schema name and desc
            FeatureSchema schema1 = new
FeatureSchema(tbox_q_schema_name.Text, tbox_q_schema_desc.Text);
            foreach (FeatureClass fc in fcoll)
            {
                schema1.Classes.Add(fc);
            }

//first get an instance of the connection manager
            IConnectionManager connman =
FeatureAccessManager.GetConnectionManager();
            using (IConnection con = connman.CreateConnection("OSGeo.SDF"))
            {
                IConnectionPropertyDictionary props =
con.ConnectionInfo.ConnectionProperties;
                props.SetProperty("File", file1);//file name from UI
                props.SetProperty("ReadOnly", false.ToString());

                //create datastore - sdf file
                ICreateDataStore create_sdf =
con.CreateCommand(CommandType.CommandType_CreateDataStore) as
ICreateDataStore;
                create_sdf.DataStoreProperties.SetProperty("File", file1);
                create_sdf.Execute();
            }
============================================ 



-----
-Raghulan Gowthaman
Senior civil BIM Consultant
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/SDF-using-FeatureClassCollection-tp5008197p5008215.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list