[mapguide-users] Get Identity Properties

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Thu Apr 2 03:41:51 EDT 2009


In case you are wondering what all those numbers are, they are defined in
OSGeo.MapGuide.MgPropertyType.?

The MaestroAPI has a function for mapping between .Net and MG types
http://svn.osgeo.org/mapguide/trunk/Tools/Maestro/MaestroAPI/Utility.cs
(Linenumbers are missing?, but its on line 389)

Regards, Kenneth Skovhede, GEOGRAF A/S



Jamo skrev:
> Incase anyone is interested I figured it out... I no longer have to hard code what the identity property is .
>
> the following will read the feature reader and return the identity property allowing me now to create more dynamic commands :)
>
> I haven't filled in all the select cases as I'm not sure whats what there.
>
>       while (newFeatReader.ReadNext())
>       {
>         MgPropertyCollection idProps = new MgPropertyCollection();
>         MgResourceIdentifier myRes = new MgResourceIdentifier(currentLayer.GetFeatureSourceId());
>
>         foreach (MgPropertyDefinition IdPropDef in newFeatReader.GetClassDefinition().GetIdentityProperties())
>           {
>             switch (newFeatReader.GetPropertyType(IdPropDef.Name))
>             {
>               case 1:
>              //   Response.Write("1");
>                 break;
>               case 2:
>              //   Response.Write("2");
>                 break;
>               case 3:
>              //   Response.Write("3");
>                 break;
>               case 4:
>               //  Response.Write("4");
>                 break;
>               case 5:
>              //   Response.Write("5");
>                 break;
>               case 6:
>               //  Response.Write("6");
>                 break;
>               case 7:
>                 idProps.Add(new MgInt32Property(IdPropDef.Name, newFeatReader.GetInt32(IdPropDef.Name)));
>                // Response.Write("7");
>                 break;
>               case 8:
>               //  Response.Write("8");
>                 break;
>               case 9:
>               //  Response.Write("9");
>                 break;
>               default:
>               //  Response.Write("no valid type");
>                 break;
>             }
>           }
>         MgSelection sel = new MgSelection();
>         sel.AddFeatureIds(currentLayer, currentClassName, idProps);
>         String selText = EscapeForHtml(sel.ToXml());
>
> //do additional stuff with feature here....
> }
>
>
>   


More information about the mapguide-users mailing list