public void DrawCircle(double left, double top, iS3Symbol symbol) { Color fill = (Color)ColorConverter.ConvertFromString(symbol.colorName); var myPolygon = new System.Windows.Shapes.Ellipse(); myPolygon.Width = 15; myPolygon.Height = 15; myPolygon.Stroke = new SolidColorBrush(Colors.Gray); myPolygon.StrokeThickness = 1; myPolygon.Fill = new SolidColorBrush(fill); Canvas.SetLeft(myPolygon, left); Canvas.SetTop(myPolygon, top); Container.Children.Add(myPolygon); TextBlock textBlock = new TextBlock(); textBlock.Text = symbol.label; textBlock.Foreground = new SolidColorBrush(Colors.Black); Canvas.SetLeft(textBlock, left + 30); Canvas.SetTop(textBlock, top); Container.Children.Add(textBlock); }
public void DrawRectangle(double left, double top, iS3Symbol symbol) { Color fill = (Color)ColorConverter.ConvertFromString(symbol.colorName); var myPolygon = new System.Windows.Shapes.Polygon(); var lefttop = new Point(left, top); var righttop = new Point(left, top + 15); var rightbottom = new Point(left + 15, top + 15); var leftbottom = new Point(left + 15, top); var points = new Point[] { lefttop, righttop, rightbottom, leftbottom }; myPolygon.Points = new System.Windows.Media.PointCollection(points); myPolygon.Stroke = new SolidColorBrush(Colors.Gray); myPolygon.StrokeThickness = 1; myPolygon.Fill = new SolidColorBrush(fill); Container.Children.Add(myPolygon); TextBlock textBlock = new TextBlock(); textBlock.Text = symbol.label; textBlock.Foreground = new SolidColorBrush(Colors.Black); Canvas.SetLeft(textBlock, left + 30); Canvas.SetTop(textBlock, top); Container.Children.Add(textBlock); }
public void DrawIcon(double left, double top, iS3Symbol symbol) { string imageFilesPath = Directory.GetCurrentDirectory() + "\\images\\" + symbol.refPath; Image simpleImage = new Image(); simpleImage.Width = 15; // Create source. BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(imageFilesPath, UriKind.Absolute); bi.EndInit(); // Set the image source. simpleImage.Source = bi; Canvas.SetLeft(simpleImage, left); Canvas.SetTop(simpleImage, top); Container.Children.Add(simpleImage); TextBlock textBlock = new TextBlock(); textBlock.Text = symbol.label; textBlock.Foreground = new SolidColorBrush(Colors.Black); Canvas.SetLeft(textBlock, left + 30); Canvas.SetTop(textBlock, top); Container.Children.Add(textBlock); }
public void setlegend(iS3Legned _legend) { legend = _legend; clearLegend(); LegendTitle.Text = legend.legndTitle; Legend.Height = 30 + 20 + 30 * legend.iS3SymbolList.Count; for (int i = 0; i < legend.iS3SymbolList.Count; i++) { iS3Symbol symbol = legend.iS3SymbolList[i]; switch (symbol.symbolType) { case SymbolType.Rectangle: DrawRectangle(10, 10 + 30 * i, symbol); break; case SymbolType.Triangle: DrawTriangle(10, 10 + 30 * i, symbol); break; case SymbolType.Circle: DrawCircle(10, 10 + 30 * i, symbol); break; case SymbolType.Icon: DrawIcon(10, 10 + 30 * i, symbol); break; default: break; } } }
public void update() { clearLegend(); LegendTitle.Text = legend.legndTitle; Legend.Height = 30 + 20 + 30 * legend.iS3SymbolList.Count; for (int i = 0; i < legend.iS3SymbolList.Count; i++) { iS3Symbol symbol = legend.iS3SymbolList[i]; //图形 DrawRectangle(10, 10 + 30 * i, symbol); } }
public virtual void addLegend(iS3Symbol symbol) { if (legend != null) { legend.iS3SymbolList.Add(symbol); } else { legend = new iS3Legned(); } update(); }
public virtual void addLegend(iS3Symbol symbol) { }