예제 #1
0
        private void btnMultiPlot_Click(object sender, EventArgs e)
        {
            MgdMap map = (MgdMap)_viewer.GetMap();
            MgMapViewerProvider  provider   = _viewer.GetProvider();
            MgdMappingService    mappingSvc = (MgdMappingService)provider.CreateService(MgServiceType.MappingService);
            MgResourceIdentifier layoutId   = new MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");

            using (SaveFileDialog save = new SaveFileDialog())
            {
                save.Filter = "DWF Files (*.dwf)|*.dwf";
                if (save.ShowDialog() == DialogResult.OK)
                {
                    MgdDwfVersion dwfVer = new MgdDwfVersion("6.01", "1.2");

                    MgdLayout            layout   = new MgdLayout(layoutId, "City of Sheboygan", MgdPageUnitsType.Inches);
                    MgdPlotSpecification plotSpec = new MgdPlotSpecification(8.5f, 11.0f, MgdPageUnitsType.Inches, 0.5f, 0.5f, 0.5f, 0.5f);

                    MgdMapPlotCollection plotCollection = new MgdMapPlotCollection();

                    MgdMapPlot plot1 = new MgdMapPlot(map, plotSpec, layout);
                    plot1.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale() * 2);
                    plotCollection.Add(plot1);

                    // Create a second map for the second sheet in the DWF. This second sheet uses the print layout
                    // to display a page title and legend.

                    MgdMap     map2  = new MgdMap(map.GetMapDefinition(), "Sheet 2");
                    MgdMapPlot plot2 = new MgdMapPlot(map2, plotSpec, layout);
                    plot2.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale());
                    plotCollection.Add(plot2);

                    MgByteReader result = mappingSvc.GenerateMultiPlot(plotCollection, dwfVer);
                    MgByteSink   sink   = new MgByteSink(result);
                    sink.ToFile(save.FileName);

                    MessageBox.Show("Saved to " + save.FileName);
                }
            }
        }
예제 #2
0
        private void btnMultiPlot_Click(object sender, EventArgs e)
        {
            MgdMap map = (MgdMap)_viewer.GetMap();
            MgMapViewerProvider provider = _viewer.GetProvider();
            MgdMappingService mappingSvc = (MgdMappingService)provider.CreateService(MgServiceType.MappingService);
            MgResourceIdentifier layoutId = new MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");
            using (SaveFileDialog save = new SaveFileDialog())
            {
                save.Filter = "DWF Files (*.dwf)|*.dwf";
                if (save.ShowDialog() == DialogResult.OK)
                {
                    MgdDwfVersion dwfVer = new MgdDwfVersion("6.01", "1.2");

                    MgdLayout layout = new MgdLayout(layoutId, "City of Sheboygan", MgdPageUnitsType.Inches);
                    MgdPlotSpecification plotSpec = new MgdPlotSpecification(8.5f, 11.0f, MgdPageUnitsType.Inches, 0.5f, 0.5f, 0.5f, 0.5f);

                    MgdMapPlotCollection plotCollection = new MgdMapPlotCollection();

                    MgdMapPlot plot1 = new MgdMapPlot(map, plotSpec, layout);
                    plot1.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale() * 2);
                    plotCollection.Add(plot1);

                    // Create a second map for the second sheet in the DWF. This second sheet uses the print layout
                    // to display a page title and legend.

                    MgdMap map2 = new MgdMap(map.GetMapDefinition(), "Sheet 2");
                    MgdMapPlot plot2 = new MgdMapPlot(map2, plotSpec, layout);
                    plot2.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale());
                    plotCollection.Add(plot2);

                    MgByteReader result = mappingSvc.GenerateMultiPlot(plotCollection, dwfVer);
                    MgByteSink sink = new MgByteSink(result);
                    sink.ToFile(save.FileName);

                    MessageBox.Show("Saved to " + save.FileName);
                }
            }
        }