public object Clone() { Puzzle puzzle = new Puzzle(); // puzzle.AssetName = AssetName; puzzle.BgFgOrigin = BgFgOrigin; puzzle.BackgroundTextureName = BackgroundTextureName; puzzle.CollisionLayer = (collisionLayer != null ? CollisionLayer.Clone() as int[] : null); puzzle.Dimensions = Dimensions; puzzle.ForegroundTextureName = ForegroundTextureName; puzzle.GridOrigin = GridOrigin; puzzle.IsCleared = IsCleared; puzzle.IsGridShiftX = IsGridShiftX; puzzle.isGridShiftY = IsGridShiftY; puzzle.IsLocked = IsLocked; puzzle.Key = Key; puzzle.MusicCueName = MusicCueName; puzzle.Name = Name; puzzle.Place = Place; puzzle.OurSolution = OurSolution; puzzle.PlayerSolution = PlayerSolution; puzzle.portraitTexture = portraitTexture; puzzle.PuzzleLayer = (puzzleLayer != null ? PuzzleLayer.Clone() as int[] : null); puzzle.ShapeLayer = (shapeLayer != null ? ShapeLayer.Clone() as int[] : null); puzzle.Size = Size; puzzle.Statistics = Statistics; puzzle.TileLayer = (tileLayer != null ? TileLayer.Clone() as int[] : null); puzzle.TileSize = TileSize; puzzle.tilesPerRow = tilesPerRow; return(puzzle); }
public MapForm(ApplicationForm owner) { // set the owner form this.owner = owner; InitializeComponent(); // initialize the map formsMap1.XMapUrl = "https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap"; formsMap1.XMapCredentials = "xtok:561677741926322"; // This event-listener will create a reference from the map-control to the form. // So if the objects of the map aren't freed properly, the form will also leak memory. formsMap1.ViewportEndChanged += formsMap1_ViewportEndChanged; // go to Karlsruhe formsMap1.SetMapLocation(new Point(8.5, 49), 8); // add a new Shape Layer layer = new ShapeLayer("MyShapes"); formsMap1.Layers.Add(layer); // this will create a memory leak if not properly deatch on finalization! owner.AddTruckButton.Click += button2_Click; }
public void UpdatePoints(CGPoint[] points) { var path = new CGPath(); path.AddLines(points); ShapeLayer.UpdateShape(path); }
public void Insert(ShapeLayer item, int index) { if (index >= 0 && index <= _layers.Count) { _layers.Insert(index, item); } }
private ShapeLayer AddVideoLayer(FileLibraryItem item, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeVideo shape = new ShapeVideo(); if (!SetSignInfo(shape, sign)) { return(null); } shape.VideoUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; layer.EmphasisEffect.Duration = sign.Template.Message.DisplayTime; return(layer); }
private void Form1_Load(object sender, EventArgs e) { // initialize base map (for xServer internet) formsMap1.XMapUrl = "https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap"; formsMap1.XMapCredentials = "xtok:561677741926322"; // go to Karlsruhe formsMap1.SetMapLocation(new Point(8.4, 49), 16); // add a new Shape Layer var layer = new ShapeLayer("MyShapes"); formsMap1.Layers.Add(layer); // create a truck marker var marker = new Truck { Color = Colors.Brown, Width = 50, ToolTip = "Hello Map" }; // set position and add to map ShapeCanvas.SetLocation(marker, new Point(8.4, 49)); layer.Shapes.Add(marker); }
void VisitShapeLayer(ShapeLayer shapeLayer) { foreach (var content in shapeLayer.Contents) { VisitShapeLayerContent(content); } }
YamlObject FromShapeLayer(ShapeLayer layer, YamlMap superclassContent) { var result = superclassContent; result.Add("Content", FromSpan(layer.Contents, FromShapeLayerContent)); return(result); }
private ShapeLayer AddImageLayer(FileLibraryItem item, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeImage shape = new ShapeImage(); if (!SetSignInfo(shape, sign)) { return(null); } shape.ImageUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; //shape.ComputeDestBoundBatchLoad(); ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; //layer.EmphasisEffect.StartTime = 0; //layer.EmphasisEffect.EndTime = long.Parse(sign.Template.Message.DisplayTime.ToString()); layer.EmphasisEffect.Left = 0; layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth; shape.ComputeDestBoundBatchLoad(); return(layer); }
private ShapeLayer AddVideoLayer(FileLibraryItem item, int length, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeVideo shape = new ShapeVideo(); if (!SetSignInfo(shape, sign)) { return(null); } shape.VideoUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; //layer.EmphasisEffect.StartTime = 0; //layer.EmphasisEffect.EndTime = long.Parse(length.ToString()); //layer.EmphasisEffect.Duration = length;// sign.Template.Message.DefaultLength; layer.EmphasisEffect.Left = 0; layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth; return(layer); }
void UpdateShape() { var path = new CGPath(); path.AddRoundedRect(new CGRect(0, 0, 1, 1), RadiusX, RadiusY); ShapeLayer.UpdateShape(path); }
/// <summary> /// Helper method for setting the enable flag of a dedicated Feature Layer (specified by the corresponding theme). /// If the XML file contains some invalid content, the current value is not changed. /// </summary> /// <param name="themeId">Textual representation of the theme (id), which is directly used the XML snippet. </param> /// <param name="value">Enable/disable the corresponding Feature Layer, i.e. showing/hiding its content in the map and /// taking into consideration its attributes or not. </param> private void SetEnabled(string themeId, bool value) { try { FeatureLayerXElement.XPathSelectElements("./FeatureLayer/Themes/Theme") .First(theme => theme.Attribute("id").Value == themeId) .Attribute("enabled") .Value = value.ToString().ToLower(); if (UseTrafficIncidents || UseTruckAttributes || UsePreferredRoutes || UseRestrictionZones || UseSpeedPatterns) { if (map.Layers["Feature Layer routes"] == null) { shapeLayer = new ShapeLayer("Feature Layer routes"); map.Layers.InsertBefore(shapeLayer, "Labels"); } } else { if (map.Layers["Feature Layer routes"] != null) { map.Layers.Remove(map.Layers["Feature Layer routes"]); shapeLayer = null; } } } catch { return; } // Something does not match the XML RefreshMap(); }
void Map_Loaded(object sender, RoutedEventArgs e) { var myLayer = new ShapeLayer("MyLayer"); Map.Layers.Add(myLayer); AddPinWithLabel(myLayer); }
/// <summary> /// Shows how to render circles with a geographic radius of 250km /// Note: you'll have to take the latitude into account! /// </summary> /// <param name="layer"></param> public void AddPinWithLabel(ShapeLayer layer) { for (int lon = -180; lon <= +180; lon = lon + 10) { for (int lat = -80; lat <= +80; lat = lat + 10) { double radius = 250000; // radius in meters double cosB = Math.Cos((lat / 360.0) * (2 * Math.PI)); // factor depends on latitude double ellipseSize = Math.Abs(1.0 / cosB * radius) * 2; // size mercator units var ellipse = new Ellipse { Width = ellipseSize, Height = ellipseSize, Fill = new SolidColorBrush(Color.FromArgb(128, 0, 0, 255)), Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 25000 }; ShapeCanvas.SetScaleFactor(ellipse, 1); // scale linear ShapeCanvas.SetLocation(ellipse, new Point(lon, lat)); layer.Shapes.Add(ellipse); } } }
public static LayerEffect EmptyEffect(ShapeLayer layer, EffectType type) { var effect = new EmptyEffect1(type, layer); effect._name = "None"; return(effect); }
void UpdateShape() { var path = new CGPath(); path.AddEllipseInRect(new CGRect(0, 0, 1, 1)); ShapeLayer.UpdateShape(path); }
public void ShowDimaInDynMap(dynamic idList, dynamic locationsList, dynamic violatedLocationsList) { var dimaPointsLayer = new List <System.Windows.Point>(); reachablePointsLayer = new ShapeLayer("Reachable") { SpatialReferenceId = "EPSG:4326" }; int i = 0; foreach (var reachWaypoint in locationsList) { i++; System.Windows.Point reachableDimaPoint; var markerBlue = new Ptv.XServer.Controls.Map.Symbols.Ball { Color = System.Windows.Media.Colors.Blue }; reachableDimaPoint = new System.Windows.Point(reachWaypoint.coordinate.x, reachWaypoint.coordinate.y); ShapeCanvas.SetLocation(markerBlue, reachableDimaPoint); markerBlue.Width = markerBlue.Height = 20; markerBlue.ToolTip = i + " - " + idList[i - 1]; reachablePointsLayer.Shapes.Add(markerBlue); reachablePointsLayer.Refresh(); dimaPointsLayer.Add(reachableDimaPoint); } violatedPointsLayer = new ShapeLayer("Violated") { SpatialReferenceId = "EPSG:4326" }; int j = 0; foreach (var reachWaypoint in violatedLocationsList) { j++; System.Windows.Point reachableDimaPoint; var markerBlue = new Ptv.XServer.Controls.Map.Symbols.Ball { Color = System.Windows.Media.Colors.Red }; reachableDimaPoint = new System.Windows.Point(reachWaypoint.coordinate.x, reachWaypoint.coordinate.y); ShapeCanvas.SetLocation(markerBlue, reachableDimaPoint); markerBlue.Width = markerBlue.Height = 13; //markerBlue.ToolTip = i + " - " + idList[i - 1]; reachablePointsLayer.Shapes.Add(markerBlue); reachablePointsLayer.Refresh(); dimaPointsLayer.Add(reachableDimaPoint); } dynMap.Layers.Add(reachablePointsLayer); dynMap.Layers.Add(violatedPointsLayer); reachablePointsLayer.Refresh(); violatedPointsLayer.Refresh(); dynMap.SetEnvelope(new Ptv.XServer.Controls.Map.MapRectangle(dimaPointsLayer).Inflate(1.1, 1.1), "EPSG:4326"); dynMap.Focus(); }
private void AppendEmptyLayer() { ShapeLayer layer = new ShapeLayer(); layer.Shape = new DefaultShape(); layer.EmphasisEffect.Duration = _videoLayers[0].EndTime - _videoLayers[0].StartTime; AppendLayer(layer); }
private void Map_Loaded(object sender, RoutedEventArgs e) { var myLayer = new ShapeLayer("MyLayer"); Map.Layers.Add(myLayer); AddPinWithLabel(myLayer); }
void UpdateShape() { var path = new CGPath(); path.MoveToPoint(_x1, _y1); path.AddLineToPoint(_x2, _y2); ShapeLayer.UpdateShape(path); }
public LayerAdapter(LayerControl layerControl, ShapeLayer shapeLayer) { this._layerControl = layerControl; _shapeLayer = shapeLayer; _layerControl.lblLayerName.Text = shapeLayer.Name; _layerControl.lblVisible.EditValue = (shapeLayer.IsVisible ? Resource.GetImage(Resource.Images.VisiableLayer) : null); //LoadEffect(shapeLayer); }
private void Window_Loaded(object sender, RoutedEventArgs e) { var myLayer = new ShapeLayer("MyLayer"); Map.Layers.Add(myLayer); AddPieCharts(myLayer); }
internal void InitEffectAdapter(ShapeLayer shapeLayer) { if (_emphasisEffect == null) { _emphasisEffect = new EffectLabel.EffectAdapter(shapeLayer.EmphasisEffect, _layerControl.ctlEmphasis, _layerControl); _entryEffect = new EffectLabel.EffectAdapter(shapeLayer.EntryEffect, _layerControl.ctlEntryEffect, _layerControl); _exitEffect = new EffectLabel.EffectAdapter(shapeLayer.ExitEffect, _layerControl.ctlExitEffect, _layerControl); } }
private void btnAdd_Click(object sender, EventArgs e) { ShapeLabel shape = new ShapeLabel(); ShapeLayer layer = new ShapeLayer(shape); //layerContainer.AddLayer(layer); //pnLayers.Controls.Add(frameLayer); //pnLayers.Controls.SetChildIndex(frameLayer, 0); //propertyGrid1.SelectedObject = layer; }
/// <summary> /// Function: Convert ShapeLayer to ufe.Layer /// Author : Jerry Xu /// Date : 2008-12-2 /// </summary> /// <param name="layer">ShapeLayer</param> /// <returns>Layer</returns> private FrameContentType ConvertLayer(ShapeLayer layer) { var ufeLayer = new ProWrite.UFE.Entity.FrameContentType(); ufeLayer.Length = long.Parse(layer.Duration.ToString()); ufeLayer.StartTime = long.Parse(layer.StartTime.ToString()); if (layer.EntryEffect != null && layer.EntryEffect.Name != null && layer.EntryEffect.Duration != 0) { ufeLayer.EntryEffect = ConvertEffect(layer.EntryEffect); } if (layer.EmphasisEffect != null && layer.EmphasisEffect.Name != null && !layer.EmphasisEffect.IsEmpty && layer.EmphasisEffect.Duration != 0) { ufeLayer.EmphasisEffect = ConvertEmphasisEffect(layer.EmphasisEffect); } if (layer.ExitEffect != null && layer.ExitEffect.Name != null && layer.ExitEffect.Duration != 0) { ufeLayer.ExitEffect = ConvertEffect(layer.ExitEffect); } ufeLayer.Type = ConvertLayerType(layer.Shape.LayerType); ufeLayer.Bounds = ConvertLayerBounds(layer.Shape); ufeLayer.Text = ConvertTextType(layer.Shape); if (layer.Shape != null) { //ScrollType if (layer.Shape.LayerType == LayerType.Temp || layer.Shape.LayerType == LayerType.Time || layer.Shape.LayerType == LayerType.DynamicText) { switch (layer.Shape.LayerType) { case LayerType.Time: ufeLayer.DLTSource = 1; ufeLayer.DLTField = (int)(layer.Shape as ShapeTime).DisplayFormat; break; case LayerType.Temp: ufeLayer.DLTSource = 2; ufeLayer.DLTField = (int)(layer.Shape as ShapeTemp).DisplayFormat + 1; break; } ufeLayer.ScrollEffect = ConvertScrollEffectType(layer); } ufeLayer.DLTisLocal = true; var pair = shapeConverter.Convert(layer.Shape); if (pair != null) { Shapes.Add(pair); if (!string.IsNullOrEmpty(pair.File.ToFilePath)) { ufeLayer.FileName = pair.File.Id; } } } return(ufeLayer); }
private static ILayer CreateShapeLayer(Point center) { var shapeLayer = new ShapeLayer("Shape layer") { Copyright = "DDS" }; AddCircle(shapeLayer, center, 500); return(shapeLayer); }
public FrmLayerForsidePanel() { InitializeComponent(); ShapeLayer layer = new ShapeLayer(new ShapeLabel()); layer.Name = "How are you"; ctrl = new LayerForsidePanel(layer); this.Controls.Add(ctrl); }
public LayerForsidePanel(ShapeLayer layer) { _layer = layer; this.AllowDrop = true; this.Height = _.Height; this.Dock = DockStyle.Top; this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
public LayerControl(ShapeLayer m_layer, bool isNewLayer) { Check.Require(m_layer, "item", Check.NotNull); Index = -1; InitializeComponent(); foresidePanel.Controls.Add(_nameEditor); _nameEditor.Visible = false; BorderStyle = BorderStyle.FixedSingle; _isNewLayer = isNewLayer; _shapeLayer = m_layer; _layer = new LayerAdapter(this, m_layer); }
/// <summary> /// Tries to create all relevant layers and other resources needed for this use case. /// </summary> protected override void Enable() { #region doc:CreateLayers tourLayer = new ShapeLayer("Tours"); wpfMap.Layers.InsertBefore(tourLayer, "Labels"); // add before xmap labels orderLayer = new ShapeLayer("Orders"); wpfMap.Layers.Add(orderLayer); depotLayer = new ShapeLayer("Depots"); wpfMap.Layers.Add(depotLayer); #endregion doc:CreateLayers }
private bool AppendLayer(VideoLayerCollection layers, ShapeLayer layer) { Layer videoLayer = DESLayerConverter.Instance.Convert(layer); //layer.ToVideoLayer(); if (videoLayer == null) { return(false); } videoLayer.Level = _level++; layers.Add(videoLayer); return(true); }
/// <summary> /// Function:Append item /// Description: /// Author:Kevin /// Date:2008-7-2 /// </summary> /// <param name="item">item</param> private void AppendLayer(ShapeLayer layer) { //layer.Accept(Visitor); Layer videoLayer = DESLayerConverter.Instance.Convert(layer);// layer.ToVideoLayer(); if (videoLayer == null) { return; } videoLayer.Level = _level++;//(short)item.LayerIndex; _videoLayers.Add(videoLayer); }
public Window1() { InitializeComponent(); tourLayer = new ShapeLayer("Tours"); Map.Layers.InsertBefore(tourLayer, "Labels"); // add before xmap labels orderLayer = new ShapeLayer("Orders"); Map.Layers.Add(orderLayer); depotLayer = new ShapeLayer("Depots"); Map.Layers.Add(depotLayer); }
/// <summary> Removes the layer containing the geocoding results from the LayerCollection. </summary> /// <param name="wpfMap"> The map which contains the layer. </param> public void Remove(WpfMap wpfMap) { ContentLayer.Shapes.Clear(); ContentLayer?.Refresh(); #region doc:remove result layer wpfMap?.Layers.Remove(ContentLayer); ContentLayer = null; #endregion }
// Shows how to add an arbitrary controls to the map // As sample the pie charts series of Wpf toolkit is used // http://wpf.codeplex.com/releases/view/40535 public void AddPieCharts(ShapeLayer layer) { // our demo data var stores = new List<Store>{ new Store { Name = "KA-Center", Latitude = 48.96, Longitude = 8.39, Sales = new List<Sale>{ new Sale{Type = "Food", Amount= 30}, new Sale { Type = "Non Food", Amount = 70 }} }, new Store { Name = "KA-North", Latitude = 49.04, Longitude = 8.41, Sales = new List<Sale>{ new Sale{Type = "Food", Amount = 40}, new Sale { Type = "Non Food", Amount = 50 }, new Sale { Type = "Pet Food", Amount = 10 }} }}; foreach (var store in stores) { // initialize a pie chart for each element Chart chartView = new Chart(); chartView.BeginInit(); chartView.Width = 300; chartView.Height = 250; chartView.Background = new SolidColorBrush(Color.FromArgb(192, 255, 255, 255)); PieSeries pieSeries = new PieSeries(); chartView.Title = store.Name; pieSeries.IndependentValuePath = "Type"; pieSeries.DependentValuePath = "Amount"; pieSeries.ItemsSource = store.Sales; pieSeries.IsSelectionEnabled = true; chartView.Series.Add(pieSeries); chartView.EndInit(); // Add to map ShapeCanvas.SetLocation(chartView, new Point(store.Longitude, store.Latitude)); ShapeCanvas.SetAnchor(chartView, LocationAnchor.Center); ShapeCanvas.SetScaleFactor(chartView, .1); // adopt the element to the scale factor layer.Shapes.Add(chartView); } }
void Map_Loaded(object sender, RoutedEventArgs e) { // To demonstrate the decomposed tiles, a rectangluar shape is addded. shapeLayer = new ShapeLayer("CustomShapes") { Caption = "Custom Shapes", Opacity=.8 }; Map.Layers.Add(shapeLayer); var poly = new MapPolygon { Points = new PointCollection(new Point[]{new Point(7.9,48.9), new Point(7.9,49.1), new Point(8.1,49.1), new Point(8.1,48.9)}), Fill = new SolidColorBrush(Colors.Blue), MapStrokeThickness = 3, Stroke = new SolidColorBrush(Colors.Black), }; shapeLayer.Shapes.Add(poly); }
/// <summary> /// The arrow demo is uses an adaption of Chales Petzold's WPF arrow class /// http://charlespetzold.com/blog/2007/04/191200.html to be used as custom MapSape /// </summary> /// <param name="layer"></param> public void AddPinWithLabel(ShapeLayer layer) { var center = new System.Windows.Point(8.4, 49); // KA var radius = 1; // radius in degrees of latitude var rand = new Random(); Func<System.Windows.Point, double, System.Windows.Point> randomCoordinate = (c, r) => { var angle = rand.NextDouble() * 2 * Math.PI; var distance = r * Math.Sqrt(rand.NextDouble()); return new System.Windows.Point { X = c.X + distance * Math.Cos(angle), Y = c.Y + distance * Math.Sin(angle) }; }; bool useBitmapCache = true; var pin = new Pyramid(); pin.Width = pin.Height = 10; pin.Measure(new Size(pin.Width, pin.Height)); pin.Arrange(new Rect(0, 0, pin.Width, pin.Height)); var bitmap = new RenderTargetBitmap((int)pin.Width, (int)pin.Height, 96, 96, PixelFormats.Pbgra32); bitmap.Render(pin); bitmap.Freeze(); for (int i = 0; i < 5000; i++) { FrameworkElement symbol = null; if(useBitmapCache) symbol = new Image { Source = bitmap }; else symbol = new Pyramid(); symbol.Width = pin.Height = 10; ShapeCanvas.SetLocation(symbol, randomCoordinate(center, radius)); symbol.ToolTip = "Hello"; layer.Shapes.Add(symbol); } this.Map.SetMapLocation(center, 9); }
/// <summary> /// The arrow demo is uses an adaption of Chales Petzold's WPF arrow class /// http://charlespetzold.com/blog/2007/04/191200.html to be used as custom MapSape /// </summary> /// <param name="layer"></param> public void AddPinWithLabel(ShapeLayer layer) { // text and symbol as two shapes Control pin = new Pin(); pin.Width = pin.Height = 30; ShapeCanvas.SetLocation(pin, new Point(8.4, 49)); ShapeCanvas.SetAnchor(pin, LocationAnchor.RightBottom); layer.Shapes.Add(pin); TextBlock tb = new TextBlock { Text = "Hello" }; tb.Background = new SolidColorBrush(Colors.White); tb.Foreground = new SolidColorBrush(Colors.Black); ShapeCanvas.SetLocation(tb, new Point(8.4, 49)); ShapeCanvas.SetAnchor(tb, LocationAnchor.LeftTop); layer.Shapes.Add(tb); // text with symbol in a view box var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(50) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(50) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50) }); var viewBox = new Viewbox() { Stretch = Stretch.Uniform }; pin = new Cube(); viewBox.Child = pin; Grid.SetRow(viewBox, 0); grid.Children.Add(viewBox); viewBox = new Viewbox() { Stretch = Stretch.Uniform }; tb = new TextBlock { Text = "Hello" }; tb.Background = new SolidColorBrush(Colors.White); tb.Foreground = new SolidColorBrush(Colors.Black); viewBox.Child = tb; Grid.SetRow(viewBox, 1); grid.Children.Add(viewBox); ShapeCanvas.SetLocation(grid, new Point(8.5, 49)); ShapeCanvas.SetScaleFactor(grid, .1); layer.Shapes.Add(grid); }
/// <summary> /// Load local image files and add it to the map /// See also http://www.i-programmer.info/programming/wpf-workings/520-bitmapimage-and-local-files-.html /// </summary> /// <param name="layer"></param> public void AddShapes(ShapeLayer layer) { // add ptv logo var ptvLogo = new Image(); var src = new BitmapImage(); src.BeginInit(); src.CacheOption = BitmapCacheOption.OnLoad; src.UriSource = new Uri("Icons\\Logo_PTV_Screen-mini.tif", UriKind.Relative); src.EndInit(); ptvLogo.Source = src; ShapeCanvas.SetLocation(ptvLogo, new Point(8.428253, 49.013432)); ptvLogo.Name = "PTV"; // optional: set explicit size and scale factor ptvLogo.Height = 100; ShapeCanvas.SetScaleFactor(ptvLogo, .1); layer.Shapes.Add(ptvLogo); // add cas logo var casLogo = new Image(); src = new BitmapImage(); src.BeginInit(); src.CacheOption = BitmapCacheOption.OnLoad; src.UriSource = new Uri("Icons\\logoCAS-Software-AG-DE.gif", UriKind.Relative); src.EndInit(); casLogo.Source = src; casLogo.Name = "CAS"; ShapeCanvas.SetLocation(casLogo, new Point(8.439220, 49.021664)); // optional: set explicit size and scale factor casLogo.Height = 100; ShapeCanvas.SetScaleFactor(casLogo, .1); layer.Shapes.Add(casLogo); }
void Map_Loaded(object sender, RoutedEventArgs e) { this.hardwareLevel.Text = "Hardware Level: " + (RenderCapability.Tier >> 16).ToString(); var myLayer = new ShapeLayer("MyLayer"); myLayer.LazyUpdate = true; Map.Layers.Add(myLayer); // Map.Layers.SetVisible(myLayer, false); AddPinWithLabel(myLayer); }
public void SetPlainLine(PointCollection pc, ShapeLayer layer, Color color, string toolTip) { MapPolyline poly = new MapPolyline(); poly.Points = pc; poly.MapStrokeThickness = 30; poly.StrokeLineJoin = PenLineJoin.Round; poly.StrokeStartLineCap = PenLineCap.Flat; poly.StrokeEndLineCap = PenLineCap.Triangle; poly.Stroke = new SolidColorBrush(color); poly.ScaleFactor = .2; poly.ToolTip = toolTip; layer.Shapes.Add(poly); }
void Map_Loaded(object sender, RoutedEventArgs e) { var myLayer = new ShapeLayer("MyLayer"); Map.Layers.Add(myLayer); // get the map view containing the content var mapView = Ptv.XServer.Controls.Map.Tools.MapElementExtensions.FindChild<Ptv.XServer.Controls.Map.MapView>(Map); // add interactor to the map view for the shape collection selectInteractor = new SilverMap.UseCases.SharpMap.SelectInteractor(mapView, myLayer.Shapes); // if the collection changes diplay it selectInteractor.SelectedElements.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedElements_CollectionChanged); AddShapes(myLayer); }
/// <summary> /// The arrow demo is uses an adaption of Chales Petzold's WPF arrow class /// http://charlespetzold.com/blog/2007/04/191200.html to be used as custom MapSape /// </summary> /// <param name="layer"></param> public void AddArrows(ShapeLayer layer) { // ArrowLine with animated arrow properties. ArrowLine aline1 = new ArrowLine(); aline1.Stroke = Brushes.Red; aline1.MapStrokeThickness = 30; // the adaptive stroke thickness aline1.ScaleFactor = .25; // the scale factor [0..1]. 0: Don't scale (thickness = pixels); 1: scale linear (thickness = mercator units) aline1.ArrowLength = 3; // the arrow length is relative to the arrow stroke thickness aline1.X1 = 8.100; aline1.Y1 = 49.400; aline1.X2 = 8.400; aline1.Y2 = 49.100; layer.Shapes.Add(aline1); DoubleAnimation animaDouble1 = new DoubleAnimation(10, 50, new Duration(new TimeSpan(0, 0, 5))); animaDouble1.AutoReverse = true; animaDouble1.RepeatBehavior = RepeatBehavior.Forever; aline1.BeginAnimation(ArrowLine.ArrowAngleProperty, animaDouble1); DoubleAnimation animaDouble2 = new DoubleAnimation(1, 20, new Duration(new TimeSpan(0, 0, 5))); animaDouble2.AutoReverse = true; animaDouble2.RepeatBehavior = RepeatBehavior.Forever; aline1.BeginAnimation(ArrowLine.ArrowLengthProperty, animaDouble2); // ArrowLine with animated point properties. ArrowLine aline2 = new ArrowLine(); aline2.ArrowEnds = ArrowEnds.Both; aline2.Stroke = Brushes.Blue; aline2.MapStrokeThickness = 30; aline2.ScaleFactor = .25; aline1.ArrowLength = 3; aline2.X1 = 8.100; aline2.Y1 = 49.100; aline2.X2 = 8.200; aline2.Y2 = 49.400; layer.Shapes.Add(aline2); AnimationTimeline animaDouble3 = new DoubleAnimation(8.100, 8.400, new Duration(new TimeSpan(0, 0, 5))); animaDouble3.AutoReverse = true; animaDouble3.RepeatBehavior = RepeatBehavior.Forever; aline2.BeginAnimation(ArrowLine.X1Property, animaDouble3); AnimationTimeline animaDouble4 = new DoubleAnimation(49.400, 49.100, new Duration(new TimeSpan(0, 0, 5))); animaDouble4.AutoReverse = true; animaDouble4.RepeatBehavior = RepeatBehavior.Forever; aline2.BeginAnimation(ArrowLine.Y2Property, animaDouble4); // ArrowPolyline rotated. ArrowPolyline apoly = new ArrowPolyline(); apoly.ArrowEnds = ArrowEnds.Both; apoly.Stroke = Brushes.Green; apoly.MapStrokeThickness = 30; apoly.ScaleFactor = .25; aline1.ArrowLength = 3; apoly.Points.Add(new Point(8.25, 49.25)); apoly.Points.Add(new Point(8.125, 49.25)); apoly.Points.Add(new Point(8.125, 49.125)); apoly.Points.Add(new Point(8.25, 49.125)); layer.Shapes.Add(apoly); // the rotation center of the canvas needs to be calculated for a rotate transform // only works after the shape has been added to the canvas. var rotateCenter = apoly.GeoTransform(new Point(8, 49)); RotateTransform xform = new RotateTransform(0, rotateCenter.X, rotateCenter.Y); apoly.RenderTransform = xform; AnimationTimeline animaDouble5 = new DoubleAnimation(0, 360, new Duration(new TimeSpan(0, 0, 10))); animaDouble5.RepeatBehavior = RepeatBehavior.Forever; xform.BeginAnimation(RotateTransform.AngleProperty, animaDouble5); }
public void SetAnimDash(PointCollection pc, ShapeLayer layer) { MapPolyline animDashLine = new MapPolyline() { MapStrokeThickness = 20, Points = pc, ScaleFactor = 0.2 }; animDashLine.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromArgb(128, 255, 255, 255)); animDashLine.StrokeLineJoin = PenLineJoin.Round; animDashLine.StrokeStartLineCap = PenLineCap.Flat; animDashLine.StrokeEndLineCap = PenLineCap.Triangle; animDashLine.StrokeDashCap = PenLineCap.Triangle; var dc = new DoubleCollection { 2, 2 }; animDashLine.IsHitTestVisible = false; animDashLine.StrokeDashArray = dc; DoubleAnimation animation = new DoubleAnimation { From = 4, To = 0, FillBehavior = System.Windows.Media.Animation.FillBehavior.HoldEnd, RepeatBehavior = RepeatBehavior.Forever }; var strokeStoryboard = new Storyboard(); strokeStoryboard.Children.Add(animation); Storyboard.SetTargetProperty(animation, new PropertyPath("(Line.StrokeDashOffset)")); Storyboard.SetTarget(animation, animDashLine); strokeStoryboard.Begin(); layer.Shapes.Add(animDashLine); }