[mapguide-users] Re: Upgrading MaestroAPI

Gunter Becker gunter.becker at csogis.de
Thu Nov 24 05:41:23 EST 2011


Hi Jackie,

I agree with Hans. I myself had just not enough time in the past to migrate
the API.

One thing I haven't found out is how to change the LayerDefinition of a
RuntimeMapLayer so that it points to an new LayerDefinition (for example
when trying to change the theme of the layer):

In the old MaestroAPI Idid the following:

    // Create a new ResourcIdentifier for the new LayerDefinition and assign
it to the RuntimeMapLayer
    runMapLayer.ResourceId = new ResourceIdentifier(layerName,
ResourceTypes.LayerDefinition,Connection.SessionID);

    // Saving the LayerDefinition and RuntimeMap
    Connection.SaveResourceAs(newLayerDefinition, runMapLayer.ResourceId);
    Connection.SaveRuntimeMap(runtimeMap.ResourceID, runtimeMap);

After changing the code it looks like this:

    // Create a new ResourcIdentifier for the new LayerDefinition and assign
it to the RuntimeMapLayer
    runMapLayer.LayerDefinitionID = new ResourceIdentifier(layerName,
ResourceTypes.LayerDefinition,Connection.SessionID);

    // Saving the LayerDefinition and RuntimeMap
    Connection.ResourceService.SaveResourceAs(newLayerDefinition,
runMapLayer.LayerDefinitionID);
    runtimeMap.Save();

An error ocurrs in the first line when trying to assign the new
ResourceIdentifier to the RuntimeMapLayer.
The property LayerDefinitionID is read only and cannot be assigned to. 

So, what is the reason for that? How do I change the style of a layer at
runtime?

Thanks, Gunter



--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Upgrading-MaestroAPI-tp7019938p7027676.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list