[mapguide-users] plot to dwf comes out differently than current map view

tmblackflag steve.calpoly at gmail.com
Thu Oct 27 18:56:03 EDT 2011


Has anyone experience this? I am plotting the current view to a 17x11 paper
size and the DWF always results in data at slightly more scale (meaning
extra white space around all polygons). 

I am using this code to plot.

            try
            {
                // Initialize the web-tier and connect to the Site using
                // the session identifier stored in ASPX session state.

                InitializeWebTier();

                MgUserInformation userInfo = new
MgUserInformation(mgSessionId);
                MgSiteConnection siteConnection = new MgSiteConnection();
                siteConnection.Open(userInfo);

                // Create an instance of ResourceService and use that to
open the
                // current map instance stored in session state.

                MgResourceService resourceService =
siteConnection.CreateService(MgServiceType.ResourceService) as
MgResourceService;
                MgMap map = new MgMap();
                map.Open(resourceService, mapName);

                // Now create an instance of MappingService and use it to
plot the
                // current view of the map.

                MgDwfVersion dwfVersion = new MgDwfVersion("6.01", "1.2");
                MgPlotSpecification plotSpec = new MgPlotSpecification(17,
11, MgPageUnitsType.Inches, 0f, 0f, 0f, 0f); //17x11
                plotSpec.SetMargins(0.25f, 0.25f, 0.25f, 0.25f);

                MgMappingService mappingService =
siteConnection.CreateService(MgServiceType.MappingService) as
MgMappingService;

                MgLayout layout = null;
                double scale = map.GetViewScale();

                MgByteReader byteReader = null;
                if (scale <= 0)
                {
                    byteReader = mappingService.GeneratePlot(map, plotSpec,
layout, dwfVersion);
                }
                else
                {
                    MgCoordinate mapCenter =
map.GetViewCenter().GetCoordinate();
                    byteReader = mappingService.GeneratePlot(map, mapCenter,
scale, plotSpec, layout, dwfVersion);
                }

                // Now output the resulting DWF.

                OutputReaderContent(Response, byteReader);
            }
            catch (MgException mge)
            {
                String result = mge.GetExceptionMessage() + "<br><br>" +
mge.GetDetails();

                Response.ContentType = "text/html";
                Response.Write(result);
            }
           
        } 
    }

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/plot-to-dwf-comes-out-differently-than-current-map-view-tp6938331p6938331.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list