Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Export map to PDF - graphics not appearing

$
0
0
I'm having an issue with our ArcObjects code for exporting a map to PDF. There is a section of code that adds graphics on to the map (polygons, lines, text etc). This seems to work fine for the first map generated after the map service is started, but on subsequent prints the markup does not get displayed on the map. This code worked previously but no we've converted it to run as an SOE on ArcGIS Server.

The code in question:

Code:

           
            // IMap map, IGraphicElements graphicElements

            GraphicUtil.GetGraphicsContainer(map).DeleteAllElements(); // clear any previous markup

            _logger.Debug("Add graphic elements to container");
            IGraphicsContainer graphicsContainer = GetGraphicsContainer(map);
            graphicsContainer.Reset();
            for (int i = 0; i < graphicElements.Count; i++)
            {
                IElement element = graphicElements.get_Element(i) as IElement;
                _logger.Debug("Adding geometry type: " + element.Geometry.GeometryType.ToString());
                graphicsContainer.AddElement(element, 0);
            }

            ((IActiveView)map).PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

        ...

        public static IGraphicsContainer GetGraphicsContainer(IMap map)
        {
            return (IGraphicsContainer)map;
        }

If I take out the DeleteAllElements the markup stays on the map between requests but any new markup doesn't get added.
If I restart the map service, then it will add the markup on the next request, then not add anything after that.

In the ArcGIS Server logs I can see the following items which indicates nothing is being drawn, even though the graphic elements have been correctly added to the graphics container in the code (as far as I can tell)

Code:

INFO3        End of the graphics drawing.
INFO3        Graphic count: 0.
INFO3        Beginning of the graphics drawing.

Any ideas?

thanks,
Rowan

Viewing all articles
Browse latest Browse all 1374

Trending Articles