//-------------------------------------------------------------------------------------------------- public static SketchEditorSettings GetOrCreate(Sketch sketch) { if (_Settings.TryGetValue(sketch, out var settings)) { return(settings); } settings = new SketchEditorSettings(); _Settings.SetValue(sketch, settings); return(settings); }
public void WeakTableStorage() { var table = new WeakTable <BaseObject, string>(); var obj1 = new BaseObject(); table.SetValue(obj1, "obj1"); Assert.IsTrue(table.HasValue(obj1)); Assert.AreEqual("obj1", table.GetValue(obj1)); string s; Assert.IsTrue(table.TryGetValue(obj1, out s)); Assert.AreEqual("obj1", s); }
public void WeakTableKeyIsNull() { var table = new WeakTable <BaseObject, string>(); Assert.IsFalse(table.HasValue(null)); Assert.IsNull(table.GetValue(null)); Assert.IsFalse(table.TryGetValue(null, out _)); table.SetValue(null, "obj0"); string s; Assert.IsTrue(table.TryGetValue(null, out s)); Assert.AreEqual("obj0", s); }
//-------------------------------------------------------------------------------------------------- void _UpdatePresentation() { _UpdateMarker(); if (_AisShape == null) { return; } var layer = _ShapeSource?.GetLayer(); if (layer == null) { return; } AttributeSet attributeSet; if (!_DrawerCache.TryGetValue(layer, out attributeSet)) { attributeSet = new AttributeSet(); _UpdateAttributesForLayer(layer, ref attributeSet); _DrawerCache.SetValue(layer, attributeSet); } _AisShape.SetAttributes(attributeSet.Drawer); //_AisShape.SetHilightAttributes(attributeSet.HilightDrawer); _AisShape.SynchronizeAspects(); if (_Options.HasFlag(Options.Ghosting)) { _UpdatePresentationForGhost(); } //TODO maybe not needed due to call to SynchronizeAspects AisContext.RecomputePrsOnly(_AisShape, false, true); }