Пример #1
0
        public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
        {
            var resourceId = rtmap.ResourceID;
            MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
            MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
            MgGeometryFactory gf = new MgGeometryFactory();

            string mapname = new ResourceIdentifier(resourceId).Path;

            //TODO: The render is missing the clip param for the extent override method

            GetByteReaderMethod fetch = () =>
            {
                MgMap map = new MgMap();
                map.Open(res, mapname);
                MgSelection sel = new MgSelection(map);
                //The color accepted by MgColor has alpha as the last value, but the returned has alpha first
                MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
                MgEnvelope env = new MgEnvelope(gf.CreateCoordinateXY(x1, y1), gf.CreateCoordinateXY(x2, y2));

                return rnd.RenderMap(map, sel, env, width, height, color, format);
            };
            LogMethodCall("MgRenderingService::RenderMap", true, "MgMap", "MgSelection", "MgEnvelope", width.ToString(), height.ToString(), "MgColor", format);
            return new MgReadOnlyStream(fetch);
        }
Пример #2
0
        public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
        {
            var resourceId = rtmap.ResourceID;
            MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
            MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
            MgGeometryFactory gf = new MgGeometryFactory();

            string mapname = new ResourceIdentifier(resourceId).Path;

            GetByteReaderMethod fetch = () =>
            {
                MgMap map = new MgMap();
                map.Open(res, mapname);
                MgSelection sel = new MgSelection(map);
                //The color accepted by MgColor has alpha as the last value, but the returned has alpha first
                MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
                MgCoordinate coord = gf.CreateCoordinateXY(x, y);
                return rnd.RenderMap(map, sel, coord, scale, width, height, color, format, true);
            };
            LogMethodCall("MgRenderingService::RenderMap", true, "MgMap", "MgSelection", "MgPoint("+ x + "," + y + ")", scale.ToString(), width.ToString(), height.ToString(), "MgColor", format, true.ToString());
            return new MgReadOnlyStream(fetch);
        }