示例#1
0
        private void DrawRulerBar(ICanvas canvas, IDrawArgs drawArgs)
        {
            if (canvas == null)
            {
                return;
            }
            IPrimaryDrawObject primaryObj = canvas.PrimaryDrawObject;

            if (primaryObj == null)
            {
                return;
            }
            CoordEnvelope evp = primaryObj.OriginalEnvelope.Clone();
            double        x1 = evp.MinX, y1 = evp.MaxY, x2 = evp.MaxX, y2 = evp.MaxY;

            canvas.CoordTransform.QuickTransform.Transform(ref x1, ref y1);
            canvas.CoordTransform.QuickTransform.Transform(ref x2, ref y2);
            //
            Graphics g = drawArgs.Graphics as Graphics;

            using (Pen p = new Pen(Brushes.Red, 10))
            {
                //g.DrawLine(p, (int)x1, (int)y1, (int)x2, (int)y2);
                g.DrawLine(p, (int)x1, 0, (int)x2, 0);
            }
        }
示例#2
0
        private static Envelope PrjToGeoEnv(IPrimaryDrawObject priObj, CoordEnvelope coordEnvelope)
        {
            double geoMinX, geoMinY, geoMaxX, geoMaxY;

            priObj.Prj2Geo(coordEnvelope.MinX, coordEnvelope.MaxY, out geoMinX, out geoMaxY);
            priObj.Prj2Geo(coordEnvelope.MaxX, coordEnvelope.MinY, out geoMaxX, out geoMinY);
            return(new Envelope(Math.Min(geoMinX, geoMaxX), Math.Min(geoMinY, geoMaxY),
                                Math.Max(geoMinX, geoMaxX), Math.Max(geoMinY, geoMaxY)));
        }
示例#3
0
        public void Render(object sender, IDrawArgs drawArgs)
        {
            ICanvas canvas = sender as ICanvas;

            if (canvas.PrimaryDrawObject == null || canvas.IsReverseDirection)
            {
                return;
            }
            Graphics           g          = drawArgs.Graphics as Graphics;
            IPrimaryDrawObject primaryObj = canvas.PrimaryDrawObject;
            int rasterWidth  = primaryObj.Size.Width;
            int rasterHeight = primaryObj.Size.Height;

            DrawBarsAndRulers(rasterWidth, rasterHeight, g, canvas);
        }
示例#4
0
        private void GetSpatialRefEnvelope(out ContourLine.ContourEnvelope envelope, out string spatialRef)
        {
            envelope   = null;
            spatialRef = null;
            if (_canvas == null || _canvas.PrimaryDrawObject == null)
            {
                return;
            }
            IPrimaryDrawObject primaryObj = _canvas.PrimaryDrawObject;

            envelope = new ContourLine.ContourEnvelope(
                (float)primaryObj.OriginalEnvelope.MinX,
                (float)primaryObj.OriginalEnvelope.MaxX,
                (float)primaryObj.OriginalEnvelope.MinY,
                (float)primaryObj.OriginalEnvelope.MaxY);
            spatialRef = primaryObj.SpatialRef;
        }
示例#5
0
        public static Bitmap GetBitmapUseOriResolution(this ICanvas canvas)
        {
            IVectorHostLayer hostLayer = canvas.LayerContainer.VectorHost;

            if (hostLayer == null)
            {
                return(null);
            }
            IMapRuntime runtime = hostLayer.MapRuntime as IMapRuntime;

            if (runtime == null)
            {
                return(null);
            }
            IPrimaryDrawObject priObj = canvas.PrimaryDrawObject;
            Color oBackcolor          = runtime.Map.MapArguments.BackColor;

            try
            {
                Image bitmap = new Bitmap(priObj.Size.Width, priObj.Size.Height, PixelFormat.Format32bppArgb);
                runtime.Map.MapArguments.BackColor = Color.Transparent;
                Envelope imageGeoEnv         = PrjToGeoEnv(priObj, priObj.OriginalEnvelope.Clone());
                MapImageGeneratorDefault map = new MapImageGeneratorDefault(runtime);
                runtime.Host = map as CodeCell.AgileMap.Core.IMapRuntimeHost;
                map.GetMapImage(map.GeoEnvelope2Viewport(imageGeoEnv), new Size(priObj.Size.Width, priObj.Size.Height), ref bitmap);
                return(bitmap as Bitmap);
            }
            finally
            {
                runtime.Host = hostLayer as CodeCell.AgileMap.Core.IMapRuntimeHost;
                runtime.Map.MapArguments.BackColor = oBackcolor;
            }
            //IRenderLayer renderLayer = layer as IRenderLayer;//GeoGridLayer
            //if (filter(layer) && renderLayer.Visible)
            //{
            //    renderLayer.Render(this, drawArgs);
            //}
        }