/// <summary> /// ihned odebere objekt ze sceny /// </summary> private void DirectRemoveFromScene(ISceneObject obj) { objects.Remove(obj); BeginInvoke(new Action(() => { if (obj is IHeavyWeightSceneObject) { GetCanvas().Children.Remove((obj as IHeavyWeightSceneObject).HeavyWeightGeometry); } else if (obj.GetGeometry() != null) { area.Remove(obj.GetGeometry(), obj.Category); } })); }
/// <summary> /// ihned prida objekt do sceny /// </summary> private void DirectAttachToScene(ISceneObject obj) { if (obj.Id == -1) { Logger.Error("Trying to add object " + obj.GetType().Name + " to scene, but it has uninitialized id -> skipped!"); return; } for (int i = idsToRemove.Count - 1; i >= 0; i--) { if (obj.Id == idsToRemove[i]) { idsToRemove.RemoveAt(i); return; } } if (obj.GetGeometry() == null && !(obj is IEmpty)) { Logger.Warn("Trying to add geometry object to scene, but it is null -> skipped!"); return; } objects.Add(obj); BeginInvoke(new Action(() => { if (obj is IHeavyWeightSceneObject) { GetCanvas().Children.Add((obj as IHeavyWeightSceneObject).HeavyWeightGeometry); } else if (obj is ParticleEmmitor) { (obj as ParticleEmmitor).Init(GetParticleArea()); } else if (!(obj is IEmpty)) { area.Add(obj.GetGeometry(), obj.Category); } })); }