Select to view content in your preferred language

Print task and Graphics layer issue (PLS READ THIS POST)

3303
2
10-09-2013 02:25 AM
by Anonymous User
Not applicable
Original User: gporta

Hi to all,
i have the following situation: i would like to save with printing tool the image of map ( image inside pdf ) with on the map a feature layer and e graphic layer.

the feature layer is defined in this way:

            <esri:FeatureLayer ID="Province" Url="http://myserver/arcgis/rest/services/MyLayer/MapServer/0
                               Renderer="{StaticResource MySymbolRenderer}" Where="OBJECTID=1">
            </esri:FeatureLayer>

and

<esri:SimpleRenderer x:Key="MySymbolRenderer">
                <esri:SimpleRenderer.Symbol>
                    <esri:SimpleFillSymbol Fill="Beige" BorderBrush="Red" BorderThickness="1"/>
                </esri:SimpleRenderer.Symbol>
            </esri:SimpleRenderer>

And that all ok , now in the behind code i would like to add a graphic layer in this way:
Transfer the just only one selected object from feature layer to graphic layer


    private void button1_Click(object sender, RoutedEventArgs e)
        {
            GraphicsLayer gl = new GraphicsLayer();
            gl.ID = "MyGraphicsLayer";

            FeatureLayer f = MyMap.Layers["Province"] as FeatureLayer;
           
            gl.Renderer = f.Renderer;

            for (int k=0; k<f.Graphics.Count;k++)
            {
                Graphic g = new Graphic();
                g.Geometry = f.Graphics.Geometry;

                gl.Graphics.Add(g);
            }

            MyMap.Layers.Add(gl);
        }

All works good , but if after this , use the print tool ( export image on pdf ) i have inside the legend instead of the name of Graphic layer (MyGraphicsLayer) on the map i have a long number....... see attached files.
It's a bug certainly .... is there a qorkaround or patch to solve this ? Im using silverlight api 3.1 and ags 10.2.

if i set

g.Symbol = LayoutRoot.Resources["PolygonSymbol"] as SimpleFillSymbol;

with

<esri:SimpleFillSymbol x:Key="PolygonSymbol" Fill="Yellow" BorderBrush="Yellow" BorderThickness="0"/>

i have an overryde inside the legend ... see capture2.png on attach

if i don't se any symbol i have black layer on map and black layer on pdf legend but the correct name of layer ... see capture3.png on attach

Thanks for reading and maybe answering

GP
0 Kudos
2 Replies
brettangel
Frequent Contributor
Try this:

GraphicsLayer gl = new GraphicsLayer();
            gl.ID = "MyGraphicsLayer";
            gl.SetValue(MapApplication.LayerNameProperty, "MyGraphicsLayer");
            gl.GetValue(MapApplication.LayerNameProperty);
0 Kudos
brettangel
Frequent Contributor
Try this:

            GraphicsLayer gl = new GraphicsLayer();
            gl.ID = "MyGraphicsLayer";
            gl.SetValue(MapApplication.LayerNameProperty, "MyGraphicsLayer");
0 Kudos