public SimulationVisualPod2D( IPodInfo pod, DetailLevel detailLevel, Transformation2D transformer, double strokeThickness, Func <bool> heatModeEnabled, MouseButtonEventHandler elementClickAction, SimulationAnimation2D controller) : base(pod, detailLevel, transformer, strokeThickness, elementClickAction, controller) { _pod = pod; _heatModeEnabled = heatModeEnabled; // Build geometry _geometry = new RectangleGeometry( new Rect( new Point(-_transformer.ProjectXLength(_pod.GetInfoRadius()), -_transformer.ProjectYLength(_pod.GetInfoRadius())), new Size(_transformer.ProjectXLength(_pod.GetInfoRadius() * 2), _transformer.ProjectYLength(_pod.GetInfoRadius() * 2)))); // Paint it Fill = VisualizationConstants.BrushPodVisual; Cursor = System.Windows.Input.Cursors.Hand; MouseDown += _elementClickAction; Stroke = VisualizationConstants.BrushOutline; StrokeThickness = StrokeThicknessReference; // Initialize Init(); }
/// <summary> /// Gets Pod information explicitly and initialize it. /// </summary> /// <param name="resolve"></param> /// <param name="throwOnFail"></param> public static void Initialize(OwnerReferencesResolve resolve = OwnerReferencesResolve.All, bool throwOnFail = false) { lock (_syncObject) { if (_current != null) { return; } if (!_serviceProvider.IsRunningOnKubernetes) { _current = new PseudoPodInfo(); return; } try { _current = _serviceProvider.CreatePodInfoAsync(resolve).GetAwaiter().GetResult(); } catch (Exception) { if (throwOnFail) { throw; } else { _current = new PseudoPodInfo(); } } } }
public void Register(IPodInfo pod, SimulationVisualPod2D visual) { if (!_managedInfoObjects.ContainsKey(pod)) { _managedInfoObjects[pod] = new SimulationInfoPod(_infoHost, pod); } _managed2DVisuals[visual] = _managedInfoObjects[pod]; _managed2DVisuals[visual].ManagedVisual2D = visual; }
public SimulationVisualContentManager(TreeViewItem contentHost, IPodInfo pod) { _contentHost = contentHost; _pod = pod; }
public SimulationVisualPod3D(IPodInfo pod, DetailLevel detailLevel, Func <bool> heatModeEnabled) : base(pod) { Pod = pod; _heatModeEnabled = heatModeEnabled; Brush coloredBrush = VisualizationConstants.BrushPodVisual; // Add main part var visual = new BoxVisual3D { Fill = coloredBrush, Center = new Point3D(0, 0, _height / 8.0), Length = Pod.GetInfoRadius() * 2, Width = Pod.GetInfoRadius() * 2, Height = _height / 4.0 * 3.0 }; Children.Add(visual); // Add feet (if detailed drawing mode) if (detailLevel == DetailLevel.Aesthetics) { double feetLength = Pod.GetInfoRadius() / 10; double feetHeight = _height / 4.0; visual = new BoxVisual3D { Fill = coloredBrush, Center = new Point3D(-Pod.GetInfoRadius() + feetLength / 2.0, -Pod.GetInfoRadius() + feetLength / 2.0, -_height / 2.0 + feetHeight / 2.0), Length = feetLength, Width = feetLength, Height = feetHeight }; Children.Add(visual); visual = new BoxVisual3D { Fill = coloredBrush, Center = new Point3D(Pod.GetInfoRadius() - feetLength / 2.0, -Pod.GetInfoRadius() + feetLength / 2.0, -_height / 2.0 + feetHeight / 2.0), Length = feetLength, Width = feetLength, Height = feetHeight }; Children.Add(visual); visual = new BoxVisual3D { Fill = coloredBrush, Center = new Point3D(-Pod.GetInfoRadius() + feetLength / 2.0, Pod.GetInfoRadius() - feetLength / 2.0, -_height / 2.0 + feetHeight / 2.0), Length = feetLength, Width = feetLength, Height = feetHeight }; Children.Add(visual); visual = new BoxVisual3D { Fill = coloredBrush, Center = new Point3D(Pod.GetInfoRadius() - feetLength / 2.0, Pod.GetInfoRadius() - feetLength / 2.0, -_height / 2.0 + feetHeight / 2.0), Length = feetLength, Width = feetLength, Height = feetHeight }; Children.Add(visual); } }