[mapguide-users] Load Layer Definition XML

wordsy mwordell at gmail.com
Thu Jan 22 14:41:30 EST 2009


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.
-- 
View this message in context: http://n2.nabble.com/Load-Layer-Definition-XML-tp2199703p2199703.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list