[mapguide-users] Trying to add another class definition to a SDF

Rodolfo Moreno rmoreno at voxiva.com
Thu May 21 10:53:23 EDT 2009


Jackie and how can I use the FDO API into Magguide applications? do you get
some code sample about it?
Regards,


Jackie Ng wrote:
> 
> MapGuide does not expose FDO's IApplySchema command. You will have to use
> the FDO API directly if you want to modify existing schemas.
> 
> - Jackie
> 
> 
> Jamo wrote:
>> 
>> I've been trying this code to add another class definition to a SDF, it
>> only adds a new classDefinition when the users SDF already exists.... is
>> this possible, everything seems to run through fine .... but no new
>> class..
>> 
>>       if (ResourceService.ResourceExists(dataSourceId) == false)
>>       {
>> 
>>         //create Feature Source
>>         MgClassDefinition myClassDef = new MgClassDefinition();
>>         myClassDef.SetName(layerName);
>>         myClassDef.SetDescription(layerDesc);
>> 
>>         //TODO : make SHPGEOM a Variable...
>>         myClassDef.SetDefaultGeometryPropertyName("GEOM");
>> 
>>         //Set KEY Property
>>         MgDataPropertyDefinition prop = new
>> MgDataPropertyDefinition("FeatId");
>>         prop.SetDataType(MgPropertyType.Int32);
>>         prop.SetAutoGeneration(true);
>>         prop.SetReadOnly(true);
>>         myClassDef.GetIdentityProperties().Add(prop);
>>         myClassDef.GetProperties().Add(prop);
>> 
>>         //Set geometry property
>>         MgGeometricPropertyDefinition geomProp = new
>> MgGeometricPropertyDefinition("GEOM");
>>         geomProp.SetGeometryTypes(MgFeatureGeometricType.Curve);
>>         myClassDef.GetProperties().Add(geomProp);
>> 
>>         //Create the schema
>>         MgFeatureSchema schema = new MgFeatureSchema("Default", "Default
>> Feature Schema");
>>         schema.GetClasses().Add(myClassDef);
>> 
>>         MgCreateSdfParams sdfParams = new MgCreateSdfParams("MGA-56
>> (GDA94 / MGA zone 56)", map.GetMapSRS(), schema);
>>         FeatureService.CreateFeatureSource(dataSourceId, sdfParams);
>> 
>>       }
>>       else
>>       {
>>         //create Feature Source
>>         MgClassDefinition myClassDef = new MgClassDefinition();
>>         myClassDef.SetName(layerName);
>>         myClassDef.SetDescription(layerDesc);
>> 
>>         //TODO : make SHPGEOM a Variable...
>>         myClassDef.SetDefaultGeometryPropertyName("GEOM");
>> 
>>         //Set KEY Property
>>         MgDataPropertyDefinition prop = new
>> MgDataPropertyDefinition("FeatId");
>>         prop.SetDataType(MgPropertyType.Int32);
>>         prop.SetAutoGeneration(true);
>>         prop.SetReadOnly(true);
>>         myClassDef.GetIdentityProperties().Add(prop);
>>         myClassDef.GetProperties().Add(prop);
>> 
>>         //Set geometry property
>>         MgGeometricPropertyDefinition geomProp = new
>> MgGeometricPropertyDefinition("GEOM");
>>         geomProp.SetGeometryTypes(MgFeatureGeometricType.Curve);
>>         myClassDef.GetProperties().Add(geomProp);
>> 
>>         FeatureService.DescribeSchema(dataSourceId,
>> "Default")[0].GetClasses().Add(myClassDef);
>>       }
>> 
>> 
> 
> 


-----
Rodolfo Moreno
CivilEng

-- 
View this message in context: http://n2.nabble.com/Trying-to-add-another-class-definition-to-a-SDF-tp2950536p2952391.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list