/// <summary> /// 地图就绪事件 /// </summary> /// <param name="e"></param> void iMSMap1_MapReady(ZDIMS.Event.IMSMapEvent e) { if (!DesignerProperties.IsInDesignTool) { //添加图片填充区域对象 IMSPictureFillStyle PicFill = new IMSPictureFillStyle(); //添加对象选择监听事件 PicFill.ChossedMarkerOverCallBack += new IMSPictureFillStyle.ChossedMarkerHander(callback); this.graphicsLayer.AddGraphics(PicFill);//添加对象 //设置坐标 PicFill.Points.Add(new Point(8.99919517012924, 29.671057152220655)); PicFill.Points.Add(new Point(12.99919517012924, 10.671057152220655)); PicFill.Points.Add(new Point(-40.99919517012924, 12.671057152220655)); PicFill.Draw();//绘制对象 //添加预定义多边形对象 IMSSimpleFillStyle fill = new IMSSimpleFillStyle(); this.graphicsLayer.AddGraphics(fill); fill.ChossedMarkerOverCallBack += callback;//监听选择事件 //设置坐标 fill.Points.Add(new Point(10.99919517012924, 29.671057152220655)); fill.Points.Add(new Point(19.99919517012924, 10.671057152220655)); fill.Points.Add(new Point(33.99919517012924, 32.671057152220655)); fill.Draw(); } }
/// <summary> /// 图片填充区边框类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void setStrokeType_DropDownClosed(object sender, EventArgs e) { if (this.setStrokeType != null) { if (this._polygonStyle != null) { //根据选择的类型设置边框样式 LineType tmp = LineType.Dot; string type = ((Image)(this.setStrokeType.SelectionBoxItem)).Tag.ToString(); switch (type) { case "Soild": { tmp = LineType.Solid; break; } case "Dash": { tmp = LineType.Dash; break; } case "DashDot": { tmp = LineType.DashDot; break; } case "Dot": { tmp = LineType.Dot; break; } case "DashDotDot": { tmp = LineType.DashDotDot; break; } } if (this._polygonStyle is IMSPictureFillStyle) { IMSPictureFillStyle t = this._polygonStyle as IMSPictureFillStyle; t.StrokeLineSymbol = tmp;//设置边框样式 } else { MessageBox.Show("选图片填充区对象"); return; } } } }
/// <summary> /// 填充透明度 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetOpacity_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (this._polygonStyle != null) { if (this._polygonStyle is IMSPictureFillStyle) { IMSPictureFillStyle tmp = this._polygonStyle as IMSPictureFillStyle; tmp.fillOpacity = ((Slider)sender).Value;//设置透明度属性 } else { MessageBox.Show("选择图片填充区对象"); return; } } }
/// <summary> /// 图片路径 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void setSource_DropDownClosed(object sender, EventArgs e) { if (this.setSource != null) { if (this._polygonStyle != null) { if (this._polygonStyle is IMSPictureFillStyle) { IMSPictureFillStyle tmp = this._polygonStyle as IMSPictureFillStyle; //设置图片路径 tmp.ImgSource = ((Image)(this.setSource.SelectionBoxItem)).Tag.ToString(); } else { MessageBox.Show("未选择编辑的图片填充区对象!"); return; } } } }
/// <summary> /// 设置边框颜色 /// </summary> /// <param name="strColor"></param> void piccolorsPicker_ColorhangedOverCallBack(Color strColor) { if (this.colorsPicker != null) { if (this._polygonStyle != null) { if (this._polygonStyle is IMSPictureFillStyle) { IMSPictureFillStyle tmp = this._polygonStyle as IMSPictureFillStyle; tmp.StrokeColor = strColor;//设置图片填充对象边框颜色 } else { MessageBox.Show("未选择编辑的图片填充区对象!"); return; } } } }