private void CreateDrawingArea() { Editor.Log("creating area"); this.drawingArea = new DrawingArea(); }
/// <summary> /// Metoda starajici se o vykresleni soustavy /// </summary> public void StarSystemDrawer() { TreeView tree = this.GetStarSystemObjectTree(); if (SelectedStarSystem == null) { return; } //Editor.Log("aftercheck"); StarSystem starSystem = SelectedStarSystem; //Editor.Log("system" + starSystem.Name); Editor.StarSystemEditor.LoadObject(starSystem); //if (this.GetDrawingArea().Canvas == null) return; DrawingArea.Canvas.Children.Clear(); StarView starView = new StarView(starSystem.Star); //Editor.Log("system" + starSystem.Name); Ellipse star = starView.GetShape(); double sunRadius = DEFAULT_SUN_RADIUS * ObjectSizeRatio; Canvas.SetLeft(star, (DrawingAreaSize - sunRadius)); Canvas.SetTop(star, (DrawingAreaSize - sunRadius)); DrawingArea.Canvas.Children.Add(star); DrawingArea.ShowStarSystemInfo(); this.GetLoadedObjectData(); //new system preparation //drawingArea.AddShapeView(new StarView(starSystem.Star)); //((TreeViewItem)tree.Items[0]).Items.Clear(); foreach (Planet planet in starSystem.Planets) { PlanetView planetView = new PlanetView(planet); Ellipse trajectoryShape = planetView.GetTrajectoryShape(); Canvas.SetLeft(trajectoryShape, planetView.TrajectoryView.Position.X); Canvas.SetTop(trajectoryShape, planetView.TrajectoryView.Position.Y); DrawingArea.Canvas.Children.Add(trajectoryShape); Ellipse planetShape = planetView.GetShape(); //TreeViewItem planetNode = new TreeViewItem(); //planetNode.Header = planet.AlternativeName; //planetNode.Tag = planetView; //((TreeViewItem)tree.Items[0]).Items.Add(planetNode); Canvas.SetLeft(planetShape, planetView.Position.X); Canvas.SetTop(planetShape, planetView.Position.Y); DrawingArea.Canvas.Children.Add(planetShape); } foreach (WormholeEndpoint wormhole in starSystem.WormholeEndpoints) { EndpointView endpointView = new EndpointView(wormhole); Ellipse trajectoryShape = endpointView.GetTrajectoryShape(); Canvas.SetLeft(trajectoryShape, endpointView.TrajectoryView.Position.X); Canvas.SetTop(trajectoryShape, endpointView.TrajectoryView.Position.Y); DrawingArea.Canvas.Children.Add(trajectoryShape); Ellipse endpointShape = endpointView.GetShape(); Canvas.SetLeft(endpointShape, endpointView.Position.X); Canvas.SetTop(endpointShape, endpointView.Position.Y); DrawingArea.Canvas.Children.Add(endpointShape); //TrajectoryView trajectoryView = new TrajectoryView(wormhole.Trajectory); //Ellipse ellipse = trajectoryView.GetShape(); //ellipse.Stroke = Brushes.Teal; ////placement logic //Canvas.SetLeft(ellipse, trajectoryView.Position.X); //Canvas.SetTop(ellipse, trajectoryView.Position.Y); //canvas.Children.Add(ellipse); } }