Example #1
0
        /// <summary>
        /// 获取绘图工具(绘制非持久图形)
        /// </summary>
        /// <returns></returns>
        public moUserDrawingTool GetDrawingTool()
        {
            Graphics          g            = Graphics.FromHwnd(this.Handle);
            moUserDrawingTool sDrawingTool = CreateDrawingTool(g);

            return(sDrawingTool);
        }
Example #2
0
        /// <summary>
        /// 新建一个绘图工具
        /// </summary>
        /// <returns></returns>
        private moUserDrawingTool CreateDrawingTool(Graphics graphics)
        {
            moRectangle       sExtent      = GetExtent();
            double            sMapScale    = mMapDrawingReference.MapScale;
            double            dpm          = mMapDrawingReference.dpm;
            double            mpu          = mMapDrawingReference.mpu;
            moUserDrawingTool sDrawingTool = new moUserDrawingTool(graphics, sExtent, sMapScale, dpm, mpu);

            return(sDrawingTool);
        }
Example #3
0
        private void DrawBufferMap2()
        {
            //(1)获取地图窗口的范围
            moRectangle sExtent = GetExtent();

            if (sExtent.IsEmpty == true)
            {
                return;
            }
            //(2)绘制缓冲位图1
            Graphics g = Graphics.FromImage(mBufferMap2);

            g.Clear(Color.White);
            Rectangle sRect = new Rectangle(0, 0, mBufferMap1.Width, mBufferMap1.Height);

            g.DrawImage(mBufferMap1, sRect, sRect, GraphicsUnit.Pixel);
            //(3)绘制所有图层的选择要素,采用倒序
            double sMapScale   = mMapDrawingReference.MapScale;
            double dpm         = mMapDrawingReference.dpm;
            double mpu         = mMapDrawingReference.mpu;
            Int32  sLayerCount = _Layers.Count;

            for (Int32 i = sLayerCount - 1; i >= 0; i--)
            {
                moMapLayer sLayer = _Layers.GetItem(i);
                if (sLayer.ShapeType == moGeometryTypeConstant.Point)
                {
                    sLayer.DrawSelectedFeatures(g, sExtent, sMapScale, dpm, mpu, mSelectedPointSymbol);
                }
                else if (sLayer.ShapeType == moGeometryTypeConstant.MultiPolyline)
                {
                    sLayer.DrawSelectedFeatures(g, sExtent, sMapScale, dpm, mpu, mSelectedLineSymbol);
                }
                else if (sLayer.ShapeType == moGeometryTypeConstant.MultiPolygon)
                {
                    sLayer.DrawSelectedFeatures(g, sExtent, sMapScale, dpm, mpu, mSelectedFillSymbol);
                }
            }
            //(4)触发事件,以便用户程序继续绘图
            if (AfterTrackingLayerDraw != null)
            {
                //新建绘图工具
                moUserDrawingTool sDrawingTool = CreateDrawingTool(g);
                AfterTrackingLayerDraw(this, sDrawingTool);
            }
            g.Dispose();
        }