[mapguide-users] MgLayerBase::GetClassDefinition fails on
MGOS1.2RC2
Zac Spitzer
zac.spitzer at gmail.com
Fri Aug 24 10:31:13 EDT 2007
i have had similiar problems with GetClassDefinition with differring
results between 1.1 and 1.2rc2
i think there may be some underlying caching going on in the FDO
layer.. what type of FDO source are you working with?
On 8/24/07, Takashige Nakagawa <ta-nakagawa at apptec.co.jp> wrote:
> Hi, all.
>
> Now I'm writing some test programs on MGOS 1.2 RC2. In the codes below,
> MgLayerBase::GetClassDefinition causes an exception "Class not found."
> When I use MgFeatureService ( as I do on Ver 1.1 ) instead , everything
> works fine.
>
> Is there something I do wrong?
>
> Regards.
>
> Takashige
>
> ----Codes-------------------------------------------
> String doTest()
> {
> NameValueCollection parameters = GetRequestParameters(Request);
> String sessionId = GetParameter(parameters, "_session_id_");
> String mapName = GetParameter(parameters, "_mapname_");
> String layerName = GetParameter(parameters, "_layername_");
> MgUserInformation userInfo = new MgUserInformation(sessionId);
> MgSiteConnection siteConnection = new MgSiteConnection();
> siteConnection.Open(userInfo);
> MgMap map = new MgMap(siteConnection);
> map.Open(mapName);
> MgLayerBase layer = GetLayerByName(map, layerName);
>
> // Version1.1 ******* Works fine on ver 1.2 !
> //MgFeatureService featureService = _
> // siteConnection.CreateService(MgServiceType.FeatureService) as
> MgFeatureService;
> //MgClassDefinition classDef = GetClassDefinitionV11(featureService,
> layer);
>
> // Version1.2 ******* Fails! What's wrong?? *******************
> MgClassDefinition classDef = layer.GetClassDefinition();
>
> return layerName;
> }
>
> MgClassDefinition GetClassDefinitionV11(MgFeatureService featureService,
> MgLayerBase layer)
> {
> String featureSourceId = layer.GetFeatureSourceId();
> MgResourceIdentifier featureSourceResId = new
> MgResourceIdentifier(featureSourceId);
> String featureClassName = layer.GetFeatureClassName();
> String[] schemaClass = featureClassName.Split(new char[] { ':' });
> String schemaName = schemaClass[0];
> String className = schemaClass[1];
> return featureService.GetClassDefinition(featureSourceResId,
> schemaName, className);
> }
>
> NameValueCollection GetRequestParameters(HttpRequest request)
> {
> if ("POST" == request.HttpMethod)
> {
> return request.Form;
> }
> else
> {
> return request.QueryString;
> }
> }
>
> String GetParameter(NameValueCollection parameters, String name)
> {
> String strval = parameters[name];
> if (null == strval)
> return "";
>
> return strval.Trim();
> }
>
> MgLayerBase GetLayerByName(MgMap map, String layerName)
> {
> MgLayerCollection layers = map.GetLayers();
> MgLayerBase layer = null;
> for (int i = 0; i < layers.GetCount(); i++)
> {
> MgLayerBase nextLayer = layers.GetItem(i);
> if (nextLayer.GetName() == layerName)
> {
> layer = nextLayer;
> break;
> }
> }
> return layer;
> }
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
--
Zac Spitzer
http://zacster.blogspot.com/
+61 3 9018 5778 (voip via my pc)
+61 405 847 168 (aussie moible)
More information about the mapguide-users
mailing list