private static FillSymbol cloneFillSymbol(FillSymbol fillSymbol) { if (fillSymbol == null) { return(null); } ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol mappingFillSymbol = fillSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol; if (mappingFillSymbol != null) { ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol sfs = new ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol() { BorderBrush = CloneBrush(mappingFillSymbol.BorderBrush), BorderThickness = mappingFillSymbol.BorderThickness, ControlTemplate = mappingFillSymbol.ControlTemplate, Fill = CloneBrush(mappingFillSymbol.Fill), SelectionColor = CloneBrush(mappingFillSymbol.SelectionColor), }; return(sfs); } SimpleFillSymbol simpleFillSymbol = fillSymbol as SimpleFillSymbol; if (simpleFillSymbol != null) { SimpleFillSymbol sfs = new SimpleFillSymbol() { BorderBrush = CloneBrush(simpleFillSymbol.BorderBrush), BorderThickness = simpleFillSymbol.BorderThickness, ControlTemplate = simpleFillSymbol.ControlTemplate, Fill = CloneBrush(simpleFillSymbol.Fill), }; return(sfs); } PictureFillSymbol pictureFillSymbol = fillSymbol as PictureFillSymbol; if (pictureFillSymbol != null) { PictureFillSymbol pfs = new PictureFillSymbol() { BorderBrush = CloneBrush(pictureFillSymbol.BorderBrush), BorderThickness = pictureFillSymbol.BorderThickness, ControlTemplate = pictureFillSymbol.ControlTemplate, Fill = CloneBrush(pictureFillSymbol.Fill), Source = pictureFillSymbol.Source, }; return(pfs); } FillSymbol fs = new FillSymbol() { BorderBrush = CloneBrush(fillSymbol.BorderBrush), BorderThickness = fillSymbol.BorderThickness, ControlTemplate = fillSymbol.ControlTemplate, Fill = CloneBrush(fillSymbol.Fill), }; return(fs); }
public static void InitTextures(List <clsTextureGroup> list_0, bool bool_0) { try { foreach (clsTextureGroup current in list_0) { clsTextureGroup clsTextureGroup = current; short num = 0; while ((int)num < clsTextureGroup.TexturePaths.Count) { bool flag = clsTextureGroup.Symbols.Count < (int)(num + 1) || clsTextureGroup.AspectRatios.Count < (int)(num + 1) || clsTextureGroup.SymbolIsDirty.Count < (int)(num + 1) || (bool_0 && clsTextureGroup.SymbolIsDirty[(int)num]) || !bool_0 || clsTextureGroup.SymbolIsDirty[(int)num]; if (flag) { IPictureFillSymbol pictureFillSymbol = new PictureFillSymbol(); if (clsTextureGroup.TexturePaths[(int)num].IndexOf('[') == 0) { string text = clsTextureGroup.TexturePaths[(int)num].Substring(1, clsTextureGroup.TexturePaths[(int)num].Length - 2); text = System.Windows.Forms.Application.StartupPath + "\\" + text + ".bmp"; pictureFillSymbol.CreateFillSymbolFromFile(esriIPictureType.esriIPictureBitmap, text); } else { pictureFillSymbol.CreateFillSymbolFromFile(esriIPictureType.esriIPictureBitmap, clsTextureGroup.TexturePaths[(int)num]); } clsTextureGroup.Symbols.Add(pictureFillSymbol as ISymbol); int height = pictureFillSymbol.Picture.Height; int width = pictureFillSymbol.Picture.Width; double item = (double)height / (double)width; clsTextureGroup.AspectRatios.Add(item); } num += 1; } clsTextureGroup.RoofSymbol = (new SimpleFillSymbol { Color = new RgbColor { RGB = clsTextureGroup.RoofColorRGB } } as ISymbol); short num2 = 0; while ((int)num2 < clsTextureGroup.Symbols.Count) { clsTextureGroup.SymbolIsDirty.Add(false); num2 += 1; } } } catch { } }
public void ShowImage(Stream fs) { if (fs.Length == 0) { return; } var selectedSensorImageRecord = coastalWatch.SelectedSensorImageRecord; var selectedLayer = Map.Layers[selectedSensorImageRecord.SensorName] as GraphicsLayer; coastalWatch.SelectedLayer = selectedLayer; if (!coastalWatch.KeepSeries) { selectedLayer.Graphics.Clear(); } var source = new BitmapImage(); source.SetSource(fs); ESRI.ArcGIS.Client.Geometry.PointCollection pc = new ESRI.ArcGIS.Client.Geometry.PointCollection(); MapPoint pt = new MapPoint(selectedSensorImageRecord.BBox[0], selectedSensorImageRecord.BBox[3]); pc.Add(pt); pt = new MapPoint(selectedSensorImageRecord.BBox[1], selectedSensorImageRecord.BBox[3]); pc.Add(pt); pt = new MapPoint(selectedSensorImageRecord.BBox[1], selectedSensorImageRecord.BBox[2]); pc.Add(pt); pt = new MapPoint(selectedSensorImageRecord.BBox[0], selectedSensorImageRecord.BBox[2]); pc.Add(pt); pt = new MapPoint(selectedSensorImageRecord.BBox[0], selectedSensorImageRecord.BBox[3]); pc.Add(pt); PictureFillSymbol symbl = new PictureFillSymbol() { Source = source, BorderThickness = 0 }; Graphic graphic = new Graphic(); ESRI.ArcGIS.Client.Geometry.Polygon ep = new Polygon(); ep.Rings.Add(pc); graphic.Geometry = ep; graphic.Symbol = symbl; graphic.Geometry.SpatialReference = new SpatialReference(4326); selectedLayer.Graphics.Add(graphic); selectedLayer.Refresh(); }
private void myFillSymSureBtn_Click(object sender, EventArgs e) { if (myFillSymbolComboBox.SelectedIndex == 0) { MarkerType = enumMarkerType.SimpleMarker; simpleFillSymbol.Color = resultColor; simpleLineSymbol.Color = outlineColor; simpleFillSymbol.Outline = simpleLineSymbol; } else if (myFillSymbolComboBox.SelectedIndex == 1) { MarkerType = enumMarkerType.PictureMarker; //simpleFillSymbol.Outline = simpleLineSymbol; pictureFillSymbol = new PictureFillSymbol(ImgUri); pictureFillSymbol.Outline = simpleLineSymbol; } this.DialogResult = DialogResult.OK; }
public void Init() { for (int i = 0; i < this.TexturePaths.Count; i++) { bool flag = this.Symbols.Count <= i || this.AspectRatios.Count <= i || this.SymbolIsDirty.Count <= i || this.SymbolIsDirty[i] || this.SymbolIsDirty[i]; if (flag) { IPictureFillSymbol pictureFillSymbol = new PictureFillSymbol(); if (this.TexturePaths[i].IndexOf('[') == 0) { string text = this.TexturePaths[i].Substring(1, this.TexturePaths[i].Length - 2); text = System.Windows.Forms.Application.StartupPath + "\\" + text + ".bmp"; pictureFillSymbol.CreateFillSymbolFromFile(esriIPictureType.esriIPictureBitmap, text); } else { pictureFillSymbol.CreateFillSymbolFromFile(esriIPictureType.esriIPictureBitmap, this.TexturePaths[i]); } this.Symbols.Add(pictureFillSymbol as ISymbol); double num = (double)pictureFillSymbol.Picture.Height; double num2 = (double)pictureFillSymbol.Picture.Width; double item = num / num2; this.AspectRatios.Add(item); } } this.RoofSymbol = (new SimpleFillSymbol { Color = new RgbColor { RGB = this.RoofColorRGB } } as ISymbol); for (int j = 0; j < this.Symbols.Count; j++) { this.SymbolIsDirty.Add(false); } }
// 确定按钮——符号渲染 / 窗口关闭 private void myFillSymSureBtn_Click(object sender, RoutedEventArgs e) { if (myFillSymbolComboBox.SelectedIndex == 0) { MarkerType = enumMarkerType.SimpleMarker; simpleFillSymbol.Color = resultColor; simpleLineSymbol.Color = outlineColor; simpleFillSymbol.Outline = simpleLineSymbol; fillSymbol.Symbol = simpleFillSymbol; } else if (myFillSymbolComboBox.SelectedIndex == 1) { MarkerType = enumMarkerType.PictureMarker; if (ImgUri == null) { w.Close(); return; } pictureFillSymbol = new PictureFillSymbol(ImgUri); pictureFillSymbol.Outline = simpleLineSymbol; fillSymbol.Symbol = pictureFillSymbol; } w.Close(); }
private void cbxsymboltype_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (grduc != null) { switch ((sender as ComboBox).SelectedIndex) { case 0: { var s = new SimpleMarkerSymbol(); s.OnSymbolChanged += StringChanged; s.OnSymbolChanged += (sen, eve) => { txtjson.Text = eve.Symbolstring; ucstylepreview.SymbolString = txtjson.Text; }; s.SetValue(Grid.RowProperty, 0); s.SetValue(Grid.ColumnProperty, 0); grduc.Children.Clear(); grduc.Children.Add(s); //initializing first time txtjson.Text = s.SymbolString; ucstylepreview.SymbolString = s.SymbolString; break; } case 1: { var s = new SimpleLineSymbol(); s.OnSymbolChanged += StringChanged; s.OnSymbolChanged += (sen, eve) => { txtjson.Text = eve.Symbolstring; ucstylepreview.SymbolString = txtjson.Text; }; s.SetValue(Grid.RowProperty, 0); s.SetValue(Grid.ColumnProperty, 0); grduc.Children.Clear(); grduc.Children.Add(s); //initializing first time txtjson.Text = s.SymbolString; ucstylepreview.SymbolString = s.SymbolString; break; } case 2: { var s = new SimpleFillSymbol(); s.OnSymbolChanged += StringChanged; s.OnSymbolChanged += (sen, eve) => { txtjson.Text = eve.Symbolstring; ucstylepreview.SymbolString = txtjson.Text; }; s.SetValue(Grid.RowProperty, 0); s.SetValue(Grid.ColumnProperty, 0); grduc.Children.Clear(); grduc.Children.Add(s); //initializing first time txtjson.Text = s.SymbolString; ucstylepreview.SymbolString = s.SymbolString; break; } case 3: { var s = new PictureMarkerSymbol(); s.OnSymbolChanged += StringChanged; s.OnSymbolChanged += (sen, eve) => { txtjson.Text = eve.Symbolstring; ucstylepreview.SymbolString = txtjson.Text; }; s.SetValue(Grid.RowProperty, 0); s.SetValue(Grid.ColumnProperty, 0); grduc.Children.Clear(); grduc.Children.Add(s); //initializing first time txtjson.Text = s.SymbolString; ucstylepreview.SymbolString = s.SymbolString; break; } case 4: { var s = new PictureFillSymbol(); s.OnSymbolChanged += StringChanged; s.OnSymbolChanged += (sen, eve) => { txtjson.Text = eve.Symbolstring; ucstylepreview.SymbolString = txtjson.Text; }; s.SetValue(Grid.RowProperty, 0); s.SetValue(Grid.ColumnProperty, 0); grduc.Children.Clear(); grduc.Children.Add(s); //initializing first time txtjson.Text = s.SymbolString; ucstylepreview.SymbolString = s.SymbolString; break; } } } }
private static FillSymbol cloneFillSymbol(FillSymbol fillSymbol) { if (fillSymbol == null) return null; ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol mappingFillSymbol = fillSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol; if (mappingFillSymbol != null) { ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol sfs = new ESRI.ArcGIS.Mapping.Core.Symbols.SimpleFillSymbol() { BorderBrush = CloneBrush(mappingFillSymbol.BorderBrush), BorderThickness = mappingFillSymbol.BorderThickness, ControlTemplate = mappingFillSymbol.ControlTemplate, Fill = CloneBrush(mappingFillSymbol.Fill), SelectionColor = CloneBrush(mappingFillSymbol.SelectionColor), }; return sfs; } SimpleFillSymbol simpleFillSymbol = fillSymbol as SimpleFillSymbol; if (simpleFillSymbol != null) { SimpleFillSymbol sfs = new SimpleFillSymbol() { BorderBrush = CloneBrush(simpleFillSymbol.BorderBrush), BorderThickness = simpleFillSymbol.BorderThickness, ControlTemplate = simpleFillSymbol.ControlTemplate, Fill = CloneBrush(simpleFillSymbol.Fill), }; return sfs; } PictureFillSymbol pictureFillSymbol = fillSymbol as PictureFillSymbol; if (pictureFillSymbol != null) { PictureFillSymbol pfs = new PictureFillSymbol() { BorderBrush = CloneBrush(pictureFillSymbol.BorderBrush), BorderThickness = pictureFillSymbol.BorderThickness, ControlTemplate = pictureFillSymbol.ControlTemplate, Fill = CloneBrush(pictureFillSymbol.Fill), Source = pictureFillSymbol.Source, }; return pfs; } FillSymbol fs = new FillSymbol() { BorderBrush = CloneBrush(fillSymbol.BorderBrush), BorderThickness = fillSymbol.BorderThickness, ControlTemplate = fillSymbol.ControlTemplate, Fill = CloneBrush(fillSymbol.Fill), }; return fs; }