Esempio n. 1
0
        void iMSMap1_MapReady(ZDIMS.Event.IMSMapEvent e)
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                //添加线样式对象
                IMSPredefinedLineStyle lines;
                lines = new IMSPredefinedLineStyle();
                this.graphicsLayer.AddGraphics(lines);
                //添加对象选择监听事件
                lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack);
                //设置坐标
                lines.Points.Add(new Point(45.99919517012924, 30.671057152220655));
                lines.Points.Add(new Point(20.99919517012924, 10.671057152220655));
                lines.LineSymbol = LineType.DashDotDot;
                lines.Draw();

                lines = new IMSPredefinedLineStyle();
                lines.StrokeThickness = 5;
                lines.LineSymbol      = LineType.Solid;
                this.graphicsLayer.AddGraphics(lines);
                lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack);
                lines.Points.Add(new Point(4.99919517012924, 29.671057152220655));
                lines.Points.Add(new Point(-10.99919517012924, 3.671057152220655));
                lines.Points.Add(new Point(-40.99919517012924, 35.671057152220655));
                lines.LineSymbol = LineType.DashDotDot;
                lines.Draw();
            }
        }
 /// <summary>
 /// 回调函数
 /// </summary>
 /// <param name="logPntArr"></param>
 void freeline(List <Point> logPntArr)
 {
     line = new IMSPredefinedLineStyle();
     this.graphicsLayer.AddGraphicsAt(line, 1000000);
     line.Stroke = new SolidColorBrush(Colors.Red);
     line.Draw(logPntArr);
 }
 /// <summary>
 /// 绘制预定义线样式对象
 /// </summary>
 /// <param name="logPntArr"></param>
 //private void PrelineStyle(List<Point> logPntArr)//(GraphicsLayer gLayer, IGraphics graphics, List<Point> logPntArr)
 //{
 private void PrelineStyle(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
 {
     //初始化线样式对象
     this._lineStyle = new IMSPredefinedLineStyle();
     this.graphicsLayer.AddGraphics(this._lineStyle);
     this._lineStyle.LineSymbol = this.lineType; //设置线的显示样式
     this._lineStyle.Draw(logPntArr);            //添加坐标,绘制线
 }
Esempio n. 4
0
 /// <summary>
 /// 右键菜单“取消选择”,监听事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void item_Click(object sender, RoutedEventArgs e)
 {
     //取消当前选择的对象
     if (this._Lines != null)
     {
         this._Lines.EnableEdit = false;
         this._Lines            = null;
     }
 }
        /// <summary>
        /// 绘制线下拉控件监听事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DrawLine_DropDownClosed(object sender, EventArgs e)
        {
            //根据选择对象,设置线样式
            if (this.DrawLine != null)
            {
                switch (((Image)(this.DrawLine.SelectionBoxItem)).Tag.ToString())
                {
                case "Soild":
                {
                    this.lineType = LineType.Solid;
                    break;
                }

                case "Dash":
                {
                    lineType = LineType.Dash;
                    break;
                }

                case "DashDot":
                {
                    lineType = LineType.DashDot;
                    break;
                }

                case "Dot":
                {
                    lineType = LineType.Dot;
                    break;
                }

                case "DashDotDot":
                {
                    lineType = LineType.DashDotDot;
                    break;
                }
                }
                //设置绘制类型,添加绘制结束监听事件
                this.drawingCtl.FreeDrawingType = FreeHanderType.None;
                //this.drawingCtl.DrawingOverCallback = null;
                //初始化临时绘制线对象
                IMSPredefinedLineStyle lin = new IMSPredefinedLineStyle();
                lin.LineSymbol = this.lineType;//设置线样式
                this.graphicsLayer.DrawingType = DrawingType.Polyline;

                this.graphicsLayer.RemoveGraphics(this.graphicsLayer.DrawingObj);

                this.graphicsLayer.DrawingObj            = lin;
                this.graphicsLayer.DrawingObj.Visibility = System.Windows.Visibility.Collapsed;
                this.graphicsLayer.DrawingOverCallback  += new DrawingEventHandler(PrelineStyle);
                this.graphicsLayer.AddGraphics(lin);
                //this.drawingCtl.drawObj = lin;//将临时绘制对象赋给图形绘制控件
                //this.drawingCtl.DrawingOverCallback += new freeDrawing.DrawEventHanders(PrelineStyle);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 对象选择处理事件
 /// </summary>
 /// <param name="sender"></param>
 void chossedCallBack(IMSPredefinedLineStyle sender)
 {
     //清除上次选择的对象
     if (this._Lines != null)
     {
         this._Lines.EnableEdit = false;
     }
     //设置当前选择的对象
     this._Lines            = sender;
     this._Lines.EnableEdit = true;
 }
Esempio n. 7
0
 /// <summary>
 /// 线对象选择回调事件
 /// </summary>
 /// <param name="sender"></param>
 void chossedCallBack(IMSPredefinedLineStyle sender)
 {
     //清除上次选择的对象
     if (this.shape != null)
     {
         this.shape.EnableEdit = false;
     }
     if (_markers != null)
     {
         _markers.EnableEdit = false;
     }
     //设置当前选择的对象
     this.shape            = sender;
     this.shape.EnableEdit = true;
 }
Esempio n. 8
0
 /// <summary>
 /// 设置颜色
 /// </summary>
 /// <param name="strColor"></param>
 void colorsPicker_ColorhangedOverCallBack(Color strColor)
 {
     if (this.colorsPicker != null)
     {
         if (this._Lines != null)
         {
             IMSPredefinedLineStyle tmp = _Lines;
             tmp.Color = strColor;//设置线颜色
         }
         else
         {
             MessageBox.Show("未选择编辑的线对象!");
             return;
         }
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 添加线
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddLine_Click(object sender, RoutedEventArgs e)
        {
            //初始化线样式对象
            IMSPredefinedLineStyle lines;

            lines             = new IMSPredefinedLineStyle();
            lines.IsShowMenum = true; //允许显示右键菜单
            lines.IsCursor    = true; //鼠标形状为手形
            //监听对象选择事件
            lines.ChossedMarkerOverCallBack += new IMSPredefinedLineStyle.ChossedMarkerHander(chossedCallBack);
            this.graphicesLaye.AddGraphics(lines);//图形添加到绘图层对象
            //设置线的坐标
            lines.Points.Add(new Point(6.99919517012924, 30.671057152220655));
            lines.Points.Add(new Point(20.99919517012924, 10.671057152220655));
            lines.LineSymbol = LineType.DashDotDot; //设置线的显示样式为:_ .._ ..
            lines.Draw();                           //绘制对象
        }