public void drawRegionOverlay(ExplorerRegion region, Color highlight_color, Point touch_relative_point) { Polygon highlight = getRegionOverlay(region, highlight_color); highlightedRegions.Add(region, highlight); background.Children.Add(highlight); }
public void drawRegionWindow(ExplorerRegion region, Color highlight_color, Point screen_position) { ContentCardRegion regionCard = new ContentCardRegion(parentCanvas, highlight_color, region); regionCard.OnContentCardOffscreen += card_OnContentCardOffscreen; regionCard.TouchDown += card_TouchDown; regionCard.TouchUp += card_TouchUp; regionCard.TouchMove += card_TouchMove; Canvas.SetLeft(regionCard, screen_position.X + 10); Canvas.SetTop(regionCard, screen_position.Y + 10); parentCanvas.Children.Add(regionCard); }
public ContentCardRegion(Canvas parent_canvas, Color highlight_color, ExplorerRegion map_region) : base(parent_canvas, highlight_color) { mapRegion = map_region; StackPanel background = new StackPanel(); background.Orientation = Orientation.Horizontal; background.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); background.Margin = new Thickness(3); StackPanel detailsSide = new StackPanel(); detailsSide.Orientation = Orientation.Vertical; Label title = new Label(); title.Content = map_region.getName(); title.FontSize = 15; title.MaxWidth = 150; title.FontWeight = FontWeights.Bold; detailsSide.Children.Add(title); ExplorerContentText descriptionContentText = mapRegion.getDefaultContentText(); if (descriptionContentText != null) { TextBox desc = new TextBox(); desc.TextWrapping = TextWrapping.Wrap; desc.BorderThickness = new Thickness(0); desc.Text = descriptionContentText.getText(); desc.FontSize = 10; desc.MaxWidth = 150; detailsSide.Children.Add(desc); } background.Children.Add(detailsSide); ExplorerContentImage defaultContentImage = map_region.getDefaultContentImage(); if (defaultContentImage != null) { Image defaultImage = defaultContentImage.getImage(); defaultImage.MaxHeight = 50; defaultImage.MinHeight = 50; defaultImage.Margin = new Thickness(5, 0, 0, 0); background.Children.Add(defaultImage); } setContent(background); }
public void removeRegionOverlay(ExplorerRegion region) { if (highlightedRegions.ContainsKey(region)) { parentCanvas.Children.Remove(highlightedRegions[region]); highlightedRegions.Remove(region); } }
private Polygon getRegionOverlay(ExplorerRegion region, Color color) { Polygon regionPolygon = new Polygon(); foreach (ExplorerPoint point in region.getPoints()) { regionPolygon.Points.Add(new Point(point.getX(), point.getY())); } regionPolygon.Stroke = new SolidColorBrush(color); regionPolygon.StrokeThickness = 5; return regionPolygon; }