<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You are correct about the new MgMap(...) call. My mistake.<br>
So it becomes:<br>
<tt>MgMap map = new MgMap(siteConnection);<br>
map.Open(mapname);<br>
map.GetLayers().GetItem(0).SetLegend("Changed");<br>
map.Save(resourceSrvc, mapname);<br>
</tt><br>
Yes, I meant the Refresh() call.<br>
<br>
If nothing happens, either you are not calling the correct frame, or
the map has not been saved.<br>
Try to use FireFox and the FireBug plugin to see where the calls go.<br>
<pre class="moz-signature" cols="72">Regard, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Antonis Mihalas skrev:
<blockquote cite="mid:94963.22792.qm@web26705.mail.ukl.yahoo.com"
type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;"
valign="top">As far as I know, this is not possible, because <br>
<pre>MgMap map = new MgMap(resourceSrvc); it takes as argument a siteConnection...
When you say refresh the client you mean just to write one line *.js?
without importing anything?
I'm asking, cause parent.parent.Refresh();
or
parent.mapFrame.Refresh();
doesn't do anything...
</pre>
<br>
--- Στις <b>Δευτ., 20/10/08, ο/η Kenneth Skovhede, GEOGRAF A/S <i><a class="moz-txt-link-rfc2396E" href="mailto:ks@geograf.dk"><ks@geograf.dk></a></i></b>
έγραψε:<br>
<blockquote
style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">Από:
Kenneth Skovhede, GEOGRAF A/S <a class="moz-txt-link-rfc2396E" href="mailto:ks@geograf.dk"><ks@geograf.dk></a><br>
Θέμα: Re: [mapguide-users] Nothing is working or what I'm doing wrong?<br>
Προς: "MapGuide Users Mail List" <a class="moz-txt-link-rfc2396E" href="mailto:mapguide-users@lists.osgeo.org"><mapguide-users@lists.osgeo.org></a><br>
Ημερομηνία: Δευτέρα, 20 Οκτώβριος 2008, 16:53<br>
<br>
<pre>The viewer overwrites the runtime map on startup, so if you run this
before starting the viewer, your changes will be lost.
You should not create a new runtime map, but open the one the viewer
creates for you, modify it, save it, and refresh the client.
I belive the correct sequence would be:
MgMap map = new MgMap(resourceSrvc);
map.Open(mapName):
The viewer takes a string like:
"Library://Folder/MapName.MapDefinition"
and uses the map name:
"Folder/MapName"
You must use the same name in your code, or you won't get to the runtime
map.
If you want the layer to show when the map loads, have a look at this:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/AddInitialLayer">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/AddInitialLayer</a>
You can perform the same actions without the MaestroAPI if you like, but
you have to deal with the xml in raw form.
Regards, Kenneth Skovhede, GEOGRAF
A/S
Galois skrev:
> Whatever I try to do it's just not working.
>
> Add a new layer?
> The layer is added but never shown
>
> Add a point? Nothing
>
> Add a new group?
> The Group is added but never shown
>
> So, I simple tried to change the LegendLabel of an existing layer.
> Nothing happened again...
>
> If anyone can tell me what I am doing wrong I would appreciate it.
>
> Code follows:
>
>
> using System;
> using System.Data;
> using System.Configuration;
> using System.Web;
> using System.Web.Security;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.WebControls.WebParts;
> using System.Web.UI.HtmlControls;
> using OSGeo.MapGuide;
> using System.Xml;
> using System.IO;
> using System.Text;
>
> public partial
class _Default : System.Web.UI.Page
> {
> public string sessionId;
> public string webLayout;
> public MgLayer tmpLayer;
> protected System.Web.UI.HtmlControls.HtmlGenericControl Frame1;
>
> protected void Page_Load(object sender, EventArgs e)
> {
> string physicalPath = @"C:\Program
>
Files\MapGuideOpenSource\WebServerExtensions\www\webconfig.ini";
>
> try
> {
> MapGuideApi.MgInitializeWebTier(physicalPath);
>
>
> passAndSession();
>
>
> //Associate a session ID with the MgSiteConnection Object
> MgUserInformation userInfo_new = new
> MgUserInformation(sessionId);
>
> MgSiteConnection siteConnection = new MgSiteConnection();
>
>
siteConnection.Open(userInfo_new);
>
>
>
> // Get an instance of the required service(s)
> MgResourceService resourceSrvc =
>
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
> MgFeatureService featureSrvc =
>
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
>
>
>
> MgMap map = new MgMap(siteConnection);
>
>
> webLayout =
>
"Library://GoSpatial/Web+Layouts/Autostrada+Brescia+Padova+Map.WebLayout";
>
> MgResourceIdentifier resId = new
> MgResourceIdentifier("Library://GoSpatial/Maps/Italy
Map.MapDefinition");
>
> String mapName = resId.GetName();
>
> MgResourceIdentifier mapStateId = new
> MgResourceIdentifier("Session:" + sessionId + "//"
+
mapName + "." +
> MgResourceType.Map);
>
>
>
> createSaveOpen(map, resourceSrvc, resId, mapName, mapStateId);
>
>
> MgLayerBase firstLayer = map.GetLayers().GetItem(0);
> firstLayer.SetLegendLabel("CHANGE");
>
>
> map.Save(resourceSrvc, mapStateId);
> }
> catch (Exception ex)
> {
> throw (ex);
> }
> }
>
>
> Thx in advanced!
>
> PS I have never but never in my life try to do something and in 2 weeks
not
> shown even a small improvement...
>
_______________________________________________
mapguide-users mailing
list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
</td>
</tr>
</tbody>
</table>
<br>
__________________________________________________<br>
Χρησιμοποιείτε Yahoo!;<br>
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την
καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων <br>
<a class="moz-txt-link-freetext" href="http://mail.yahoo.gr">http://mail.yahoo.gr</a>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
</body>
</html>