<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yes, I run it with MGE 2009.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
clarkie342 skrev:
<blockquote cite="mid:1236017720401-2410796.post@n2.nabble.com"
 type="cite">
  <pre wrap="">Hi,

Does MaestroAPI work with Mapguide Enterprise?
Thanks.


wordsy wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Thanks for the quick response.  It was exactly what I needed.

Cheers!


Kenneth Skovhede, GEOGRAF A/S wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">If you want to modify the layer xml, you just read the xml like this:

MgByteReader rd = resourceSrvc.GetResource(new 
MgResourceIdentifier("Library://layer.LayerDefinition"));

If you want to work seriously with layerdefinitions (and the MapGuide 
xml), I have created the MaestroAPI,
which lets you manipulate classes instead of xml:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI</a>

Using the MaestroAPI, you can just do:
LayerDefinition ldef = 
con.GetLayerDefinition("Library://layer.LayerDefinition");
VectorLayerDefinition vldef = ldef.Item as VectorLayerDefinition;
foreach(VectorScaleRangeType vsr in vldef.ScaleRanges)
    foreach(object o in vsr.Item)
       if (o is PointTypeStyleType)
          ; //Layer has points
       else if (o is LineTypeStyleType)
          ; //Layer has lines
       else if (o is AreaTypeStyleType)
          ; //Layer has polygons


Also, changing a style is easy, eg:
PointTypeStyleType point = vldef.ScaleRanges[0].Item[0] as 
PointTypeStyleType;
p.PointRule[0].Label.BackgroundColor = System.Drawing.Color.Red;

Then save:
con.SaveResource(ldef);

All is fully intellisense supported in VS.


Regards, Kenneth Skovhede, GEOGRAF A/S



wordsy skrev:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Hey Everyone;

Fairly new to MGOS.

Here is what I am trying to do.  

I have a map with many Layers.  One of my requirements is to allow users
to
be able to change the layer styles via a web wizard.  The user will be
able
to adjust certain styles for line/point/polygon (surface).  Ie font,
symbol,
line thickness, color etc.

Already my site allows a user to select the layer they want to change,
then
change the styles for a point only.  The changing doesn't seem to be a
problem right now.

The problem I have:

Once a user selects the layer they want to load.  How would I get the
layer
and use XML document or XPATH or something to allow the users edit XML
nodes.

Here is my code that checks to see what layer type I have when the user
selects the layer.  I have 3 different user controls (one for line, one
for
poly, one for line).  What I really want, is to load the layer and
populate
the appropriate controls inside the user control.

 MgSiteConnection conn = InitializeGisWebTier();
            string resource = "Library://MUNICIPALITIES/" + Municipality
+
"/2_DATA/" + LayerName + ".FeatureSource";

            MgResourceService svc =
(MgResourceService)conn.CreateService(MgServiceType.ResourceService );

            // Populate some values that we will need.
            MgResourceIdentifier resourceId = new
MgResourceIdentifier(resource);              
            MgFeatureReader featureReader =
LayerDefinitionFactory.MakeAFeatureReader(conn, resourceId);                        
            
            // Find out what type of Geometric property the
FeatureSource we
uploaded has.
            string geometricPropertyType =
LayerDefinitionFactory.GetFeatureSourceGeometricPropertyType(featureReader);

            switch (geometricPropertyType)
            {
                case "SURFACE":
                    // We load the Polygon usercontrol
                    this.phStylizeLayerControl.Controls.Add(new
PolygonStyleBuilder());
                    break;
                case "POINT":
                    // we load the point usercontrol
                    //this.phStylizeLayerControl.Controls.Add(new
PointStyleBuilder());
                    PointStyleBuilder control =
(PointStyleBuilder)LoadControl("~/Pages/Controls/PointStyleBuilder.ascx");
                    this.phStylizeLayerControl.Controls.Add(control);
                    txtSymbol.Enabled = true;
                    txtSymbolSize.Enabled = true;
                    break;
                case "CURVE":
                    // we load the line user control
                    this.phStylizeLayerControl.Controls.Add(new
LineStyleBuilder());
                    break;
            }

Thanks for any help in advance.
  
        </pre>
      </blockquote>
      <pre wrap="">_______________________________________________
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>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>