[mapguide-users] Maestro API: RuntimeMapLayer.Selectable can't be changed

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Sun Oct 26 12:08:32 EDT 2008


In order for a layer to be selectable in MapGuide, it must have a 
primary key.
Maestro is not good at handling composite primary keys. btw.

To speed up the runtime map/layer creation, the MaestroAPI defers the 
primary key lookup
until you actually set the layer to be selectable and visible.

So, when you set the property as below, the MaestroAPI tries to 
determine the primary key of the featuresource.
Since you get an "Invalid respository" message, either your "ri" 
variable is invalid, or the featuresource it refers to is invalid.

And by "invalid" I mean that it does not start with "Library://" or 
"Session:<xxxxxx>//".

Regards, Kenneth Skovhede, GEOGRAF A/S



carls skrev:
> I want to add a runtimemaplayer to a runtime map, and write follow code.
>
>             ResourceIdentifier ri =
> CloneLayerDefinitionForSession(LayerPath, AsLayerName, SessionID);
>
>             RuntimeMapLayer rtl = new RuntimeMapLayer(ParentMap);
>
>             rtl.ResourceId = ri.ToString();
>             rtl.Visible = true;
>             rtl.LegendLabel = AsLayerName;
>             rtl.NeedRefresh = true;
>             rtl.Selectable = true;
>             if (ParentMap != null)
>                 AddRuntimeMapLayerToRuntimeMap(ParentMap, rtl);  
>             return rtl;
>
> The runtimemaplayer refers to a sql 2008 data source.
>
> The bold line of above code can't be executed, the full message is :
>
>    
> [WebException: ...: (559) MgInvalidRepositoryTypeException。]
>    System.Net.WebClient.OpenRead(Uri address) +366
>    System.Net.WebClient.OpenRead(String address) +29
>    OSGeo.MapGuide.MaestroAPI.HttpServerConnection.OpenRead(String req) in
> E:\Temp\Maestro\MaestroAPI\HttpServerConnection.cs:1078
>
> [Exception: ...: (559) MgInvalidRepositoryTypeException。: 
> Invalid repository type.
> Exception occurred in method MgResourceIdentifier.ParseIdentifier at line
> 420 in file
> d:\buildforgeprojects\mapguide_open_source_v2.0\build_23.8\mgdev\common\platformbase\Services/ResourceIdentifier.cpp
>
> ]
>    OSGeo.MapGuide.MaestroAPI.HttpServerConnection.OpenRead(String req) in
> E:\Temp\Maestro\MaestroAPI\HttpServerConnection.cs:1086
>    OSGeo.MapGuide.MaestroAPI.HttpServerConnection.GetResourceXmlData(String
> resourceID) in E:\Temp\Maestro\MaestroAPI\HttpServerConnection.cs:299
>    OSGeo.MapGuide.MaestroAPI.ServerConnectionBase.GetResource(String
> resourceID) in E:\Temp\Maestro\MaestroAPI\ServerConnectionBase.cs:380
>    OSGeo.MapGuide.MaestroAPI.ServerConnectionBase.GetFeatureSource(String
> resourceID) in E:\Temp\Maestro\MaestroAPI\ServerConnectionBase.cs:357
>   
> OSGeo.MapGuide.MaestroAPI.RuntimeClasses.RuntimeMapLayer.FindResourceIDs(ServerConnectionI
> con) in E:\Temp\Maestro\MaestroAPI\RuntimeClasses\RuntimeMap.cs:726
>   
> OSGeo.MapGuide.MaestroAPI.RuntimeClasses.RuntimeMapLayer.FindResourceIDs()
> in E:\Temp\Maestro\MaestroAPI\RuntimeClasses\RuntimeMap.cs:752
>   
> OSGeo.MapGuide.MaestroAPI.RuntimeClasses.RuntimeMapLayer.set_Selectable(Boolean
> value) in E:\Temp\Maestro\MaestroAPI\RuntimeClasses\RuntimeMap.cs:1039
>    ...
>
>
> Thanks for help!
>
> -----
> Regards, Carl SHE
>   


More information about the mapguide-users mailing list