private void UpdateObjecCircle(SimulationObject SimO, SimObjGraphicsSettings gfxSet) { if (gfxSet.DrawCircle) { if (gfxSet.CircleRef == null) { gfxSet.CircleRef = new ObjectCircle(SimO.LastTableObject.Center); _tmgr.DisplayManager.AddElement(gfxSet.CircleRef, DisplayManager.DisplayLayer.top); } else { gfxSet.CircleRef.Center = SimO.LastTableObject.Center; } gfxSet.CircleRef.SetColor(gfxSet.CircleColor); gfxSet.CircleRef.SetText(1, gfxSet.Text1); gfxSet.CircleRef.SetText(2, gfxSet.Text2); } else { //Do not draw circle if (gfxSet.CircleRef != null) { _tmgr.DisplayManager.DeleteElement(gfxSet.CircleRef); gfxSet.CircleRef = null; } } }
private void UpdateSecScreenLine(SimulationObject SimO, SimObjGraphicsSettings gfxSet) { if (gfxSet.DrawSecScreenLine && SimO.LastTableObject.RotationDefined) { bool recalculate = false; if (gfxSet.SecScreenLineDest != null) { //Case 1: a target object is set if (gfxSet.SecScreenLineRef == null) { gfxSet.SecScreenLineRef = new ScreenLine(SimO.LastTableObject.Center, gfxSet.SecScreenLineDest.LastTableObject.Center, gfxSet.SecSlElementType); gfxSet.SecScreenLineRef.LineElementColor = gfxSet.SecSlElementColor; _tmgr.DisplayManager.AddElement(gfxSet.SecScreenLineRef, DisplayManager.DisplayLayer.middle); recalculate = true; } else { gfxSet.SecScreenLineRef.LineElementColor = gfxSet.SecSlElementColor; if (!gfxSet.SecScreenLineRef.Source.Equals(SimO.LastTableObject.Center)) { gfxSet.SecScreenLineRef.Source = SimO.LastTableObject.Center; recalculate = true; } if (!gfxSet.SecScreenLineRef.Destination.Equals(gfxSet.SecScreenLineDest.LastTableObject.Center)) { gfxSet.SecScreenLineRef.Destination = gfxSet.SecScreenLineDest.LastTableObject.Center; recalculate = true; } } } else { //Case 2: Use direction Vector if (gfxSet.SecScreenLineRef == null) { gfxSet.SecScreenLineRef = new ScreenLine(SimO.LastTableObject.Center, gfxSet.SecScreenLineDirection, gfxSet.SecSlElementType); gfxSet.SecScreenLineRef.LineElementColor = gfxSet.SecSlElementColor; _tmgr.DisplayManager.AddElement(gfxSet.SecScreenLineRef, DisplayManager.DisplayLayer.middle); recalculate = true; } else { gfxSet.SecScreenLineRef.LineElementColor = gfxSet.SecSlElementColor; if (!gfxSet.SecScreenLineRef.Source.Equals(SimO.LastTableObject.Center)) { gfxSet.SecScreenLineRef.Source = SimO.LastTableObject.Center; recalculate = true; } TPoint dest = new TPoint( Convert.ToInt32(SimO.LastTableObject.Center.ScreenX + gfxSet.SecScreenLineDirection.X * 1000), Convert.ToInt32(SimO.LastTableObject.Center.ScreenY + gfxSet.SecScreenLineDirection.Y * 1000), TPoint.PointCreationType.screen); if (!gfxSet.SecScreenLineRef.Destination.Equals(dest)) { gfxSet.SecScreenLineRef.Destination = dest; recalculate = true; } } } if (recalculate) gfxSet.SecScreenLineRef.CalculateLine(); } else { //Do not draw ScreenLine if (gfxSet.SecScreenLineRef != null) { _tmgr.DisplayManager.DeleteElement(gfxSet.SecScreenLineRef); gfxSet.SecScreenLineRef = null; } } }