public override void OnBeginDrag() { var selection = DesignView.Context.As <ISelectionContext>().Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); NodeList.Clear(); m_isUniformScaling = false; IEnumerable <DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable <DomNode>()); foreach (DomNode node in rootDomNodes) { ITransformable transNode = node.As <ITransformable>(); if (transNode == null || (transNode.TransformationType & TransformationTypes.Scale) == 0) { continue; } IVisible vn = node.As <IVisible>(); if (!vn.Visible) { continue; } ILockable lockable = node.As <ILockable>(); if (lockable.IsLocked) { continue; } // force uniform scaling if any node requires it if ((transNode.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) { m_isUniformScaling = true; } NodeList.Add(transNode); IManipulatorNotify notifier = transNode.As <IManipulatorNotify>(); if (notifier != null) { notifier.OnBeginDrag(); } } m_originalValues = new Vec3F[NodeList.Count]; int k = 0; foreach (ITransformable node in NodeList) { m_originalValues[k++] = node.Scale; } if (NodeList.Count > 0) { transactionContext.Begin("Scale".Localize()); } }
public override PropertyTreeMetaObject StartStep( PropertyTreeMetaObject target, PropertyTreeNavigator self, NodeList children) { if (!(target is UntypedToTypedMetaObject)) return target; if (!children.Any()) return target; try { // TODO Only supports one child (lame spec) var rootType = target.Root.ComponentType; var types = children.Select(t => ConvertToType(t, rootType)).ToArray(); target = target.BindGenericParameters(types); } catch (Exception ex) { if (ex.IsCriticalException()) throw; Parent.errors.CouldNotBindGenericParameters(target.ComponentType, ex, self.FileLocation); } Parent.Bind(target, children.First(), null); children.Clear(); return target; }
internal void Initialize() { DeviceList.Clear(); ComponentList.Clear(); ExecutionEnvironmentList.Clear(); NodeList.Clear(); }
/// <summary> /// 装载清单数据 /// </summary> public void Load() { NodeList.ListChanged -= OnNodeList_ListChanged; RootList.Clear(); NodeList.Clear(); updateList.Clear(); List <ContractBoiNode> lstNode = new List <ContractBoiNode>(); Boq = contractBoqService.GetByProjectNo(ProjectNo); if (Boq != null) { lstNode = Convert(Boq.BoiList); lstNode.ForEach(m => NodeList.Add(m)); } else { Boq = new ContractBoq(); Boq.ProjectNo = ProjectNo; Boq.BoQName = ProjectName; } NodeList.ListChanged += OnNodeList_ListChanged; if (ListChanged != null) { ListChanged(); } }
public void ClearEmptyTest() { var list = new NodeList(); list.Clear(); Assert.That(list, Is.Empty); }
private void ClearProperties() { RuleList.Clear(); BagList.Clear(); NodeList.Clear(); ChildList.Clear(); }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) { return; } var selectionCntx = DesignView.Context.As <ISelectionContext>(); var selection = selectionCntx.Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); NodeList.Clear(); IEnumerable <DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable <DomNode>()); foreach (DomNode domNode in rootDomNodes) { ITransformable node = domNode.As <ITransformable>(); if (node == null || (node.TransformationType & TransformationTypes.Rotation) == 0) { continue; } IVisible vn = node.As <IVisible>(); if (!vn.Visible) { continue; } ILockable lockable = node.As <ILockable>(); if (lockable.IsLocked) { continue; } NodeList.Add(node); IManipulatorNotify notifier = node.As <IManipulatorNotify>(); if (notifier != null) { notifier.OnBeginDrag(); } } m_rotations = new Matrix4F[NodeList.Count]; for (int k = 0; k < NodeList.Count; k++) { ITransformable node = NodeList[k]; Matrix4F m = new Matrix4F(node.Transform); m.Translation = new Vec3F(0, 0, 0); m.Normalize(m); m_rotations[k] = m; } if (NodeList.Count > 0) { transactionContext.Begin("Rotate".Localize()); } }
/// <summary> /// Parses the specified tokens. /// </summary> /// <param name="tokens">The tokens.</param> protected override void Parse( List<string> tokens ) { // Get the block markup. The list of tokens contains all of the lava from the start tag to // the end of the template. This will pull out just the internals of the block. // We must take into consideration nested tags of the same type var endTagFound = false; var startTag = $@"{{\[\s*{ _tagName }\s*\]}}"; var endTag = $@"{{\[\s*end{ _tagName }\s*\]}}"; var childTags = 0; Regex regExStart = new Regex( startTag ); Regex regExEnd = new Regex( endTag ); NodeList = NodeList ?? new List<object>(); NodeList.Clear(); string token; while ( ( token = tokens.Shift() ) != null ) { Match startTagMatch = regExStart.Match( token ); if ( startTagMatch.Success ) { childTags++; // increment the child tag counter _blockMarkup.Append( token ); } else { Match endTagMatch = regExEnd.Match( token ); if ( endTagMatch.Success ) { if ( childTags > 0 ) { childTags--; // decrement the child tag counter _blockMarkup.Append( token ); } else { endTagFound = true; break; } } else { _blockMarkup.Append( token ); } } } if ( !endTagFound ) { AssertMissingDelimitation(); } }
public override void Dispose() { base.Dispose(); if (_occupyNodes != null) { _occupyNodes.Clear(); } }
public override void Dispose() { base.Dispose(); if (_nodeList != null) { _nodeList.Clear(); } }
public void Clear() { rootNodes.Clear(); if (Cleared != null) { Cleared(this, EventArgs.Empty); } }
public override void Dispose() { base.Dispose(); if (_flyingList != null) { _flyingList.Clear(); } }
// ------------------------------------------------------------------ // Contruit la liste (à plat) de tous les nodes du registryTree // C'est pratique pour y faire des recherches // ------------------------------------------------------------------ public void BuildList() { NodeList.Clear(); if (RegistryTree.Count > 0) { NodeList = BuildNodeList(RegistryTree[0]); } }
public void Reset() { // TODO: send ShutDown to each node //foreach (GingerNodeInfo GNI in NodeList) //{ // GNI. //} NodeList.Clear(); }
public void ClearTest() { //Fill list with one node Module node1 = new Module(); nodes.Add(node1); //Check if size is bigger than zero Assert.AreEqual(1, nodes.Count); //Clear list and check if zero elements in it nodes.Clear(); Assert.AreEqual(0, nodes.Count); }
public void LateUpdate() { //before calculating other figures, update intersection figures. intersectionManager.ins.UpdateIntersections(rManList); if (rManList.Count > 0) { updateNodeList = new NodeList <string>(); updateNodeList = rManList.Clone(); ReactionManager(rManList, rManList); rManList.Clear(); } }
/// <summary> /// /// </summary> /// <param name="tag"></param> /// <param name="markup"></param> /// <param name="tokens"></param> public override void UnknownTag(string tag, string markup, IEnumerable <string> tokens) { NodeList.Clear(); switch (tag) { case "when": RecordWhenCondition(markup); break; case "else": RecordElseCondition(markup); break; default: base.UnknownTag(tag, markup, tokens); break; } }
public void InitializeSystemNode() { RootNode.Name = "Root"; RootNode.NameE = "Root"; RootNode.SystemNode = true; RootNode.ElementList.Clear(); RootNode.ElementList.Add(new PmxNode.NodeElement { ElementType = PmxNode.ElementType.Bone, Index = 0 }); ExpNode.Name = "表情"; ExpNode.NameE = "Exp"; ExpNode.SystemNode = true; ExpNode.ElementList.Clear(); NodeList.Clear(); NodeList.Add(RootNode); NodeList.Add(ExpNode); }
/// <summary> /// 装载清单数据 /// </summary> public void Load() { RootList.Clear(); NodeList.Clear(); updateList.Clear(); List <ContractBoiChangeNode> lstNode = new List <ContractBoiChangeNode>(); Boq = contractBoqService.GetByProjectNo(ProjectNo); lstNode = Convert(Boq.BoiList); ////初始化批复值 //RootList.ForEach(m => //{ // InitReply(lstNode, m); //}); lstNode.ForEach(m => NodeList.Add(m)); NodeList.ListChanged += OnNodeList_ListChanged; RootList.ForEach(m => m.PropertyChanged += M_PropertyChanged); InitChanged(); }
private void DesignateAsRole(ApplicationEngine engine, Role role, ECPoint[] nodes) { if (nodes.Length == 0) { throw new ArgumentException(nameof(nodes)); } if (!Enum.IsDefined(typeof(Role), role)) { throw new ArgumentOutOfRangeException(nameof(role)); } if (!CheckCommittee(engine)) { throw new InvalidOperationException(); } NodeList list = engine.Snapshot.Storages.GetAndChange(CreateStorageKey((byte)role)).GetInteroperable <NodeList>(); list.Clear(); list.AddRange(nodes); list.Sort(); }
public override void OnEndDrag(ViewControl vc, Point scrPt) { if (NodeList.Count > 0) { for (int k = 0; k < NodeList.Count; k++) { IManipulatorNotify notifier = NodeList[k].As <IManipulatorNotify>(); if (notifier != null) { notifier.OnEndDrag(); } } var transactionContext = DesignView.Context.As <ITransactionContext>(); try { if (transactionContext.InTransaction) { transactionContext.End(); } } catch (InvalidTransactionException ex) { if (transactionContext.InTransaction) { transactionContext.Cancel(); } if (ex.ReportError) { Outputs.WriteLine(OutputMessageType.Error, ex.Message); } } } NodeList.Clear(); m_originalScales = null; m_originalTranslations = null; m_hitRegion = HitRegion.None; m_scale = new Vec3F(1, 1, 1); }
public void FinishTransaction() { if (NodeList.Count > 0) { for (int k = 0; k < NodeList.Count; k++) { IManipulatorNotify notifier = NodeList[k].As <IManipulatorNotify>(); if (notifier != null) { notifier.OnEndDrag(); } } var transactionContexts = TransactionContextList; foreach (var t in transactionContexts) { try { if (t.InTransaction) { t.End(); } } catch (InvalidTransactionException ex) { if (t.InTransaction) { t.Cancel(); } if (ex.ReportError) { Outputs.WriteLine(OutputMessageType.Error, ex.Message); } } } NodeList.Clear(); } }
public void ClearNotEmptyTest() { var owner = new Node(); var node1 = new Node(); var node2 = new Node(); var node3 = new Node(); var nodes = new List <Node> { node1, node2, node3 }; var list = new NodeList(owner) { node1, node2, node3 }; list.Clear(); Assert.That(list, Is.Empty); foreach (var node in nodes) { Assert.That(node.Parent, Is.Null); Assert.That(node.NextSibling, Is.Null); } }
/// <summary> /// /// </summary> /// <param name="tokens"></param> protected override void Parse(IEnumerable <string> tokens) { NodeList.Clear(); string token; var t = tokens as List <string>; while ((token = t.Shift()) != null) { var fullTokenMatch = FullToken.Match(token); if (fullTokenMatch.Success && BlockDelimiter == fullTokenMatch.Groups[1].Value) { EndTag(); return; } else { NodeList.Add(token); } } AssertMissingDelimitation(); }
protected override void Parse(List <string> tokens) { NodeList = NodeList ?? new List <object>(); NodeList.Clear(); string token; while ((token = tokens.Shift()) != null) { Match fullTokenMatch = FullToken.Match(token); if (fullTokenMatch.Success && BlockDelimiter == fullTokenMatch.Groups[1].Value) { EndTag(); return; } else { NodeList.Add(token); } } AssertMissingDelimitation(); }
private void MakeStep() { NodeList <Node> temp = this.nodeToUpdate2; temp.Clear(); this.nodeToUpdate2 = this.nodeToUpdate; this.nodeToUpdate = temp; for (int i = 0; i < this.nodeToUpdate2.Count(); i++) { this.nodeToUpdate2.array[i].Live(); } for (int i = 0; i < this.nodeToUpdate2.Count(); i++) { this.nodeToUpdate2.array[i].UpdateMap(); } /* * for (int i = 0; i < this.Width; i++) * { * for (int j = 0; j < this.Height; j++) * { * this.nodes[i, j].Live(); * } * } * * for (int i = 0; i < this.Width; i++) * { * for (int j = 0; j < this.Height; j++) * { * this.nodes[i, j].UpdateMap(); * } * } */ this.step++; this.StepText.text = "Step: " + this.step; }
protected override void Parse(List <string> tokens) { NodeList = NodeList ?? new List <object>(); NodeList.Clear(); string token; while ((token = tokens.Shift()) != null) { Match isTagMatch = IsTag.Match(token); if (isTagMatch.Success) { Match fullTokenMatch = FullToken.Match(token); if (fullTokenMatch.Success) { // If we found the proper block delimitor just end parsing here and let the outer block // proceed if (BlockDelimiter == fullTokenMatch.Groups[1].Value) { EndTag(); return; } // Fetch the tag from registered blocks Tag tag; if ((tag = Template.CreateTag(fullTokenMatch.Groups[1].Value)) != null) { tag.Initialize(fullTokenMatch.Groups[1].Value, fullTokenMatch.Groups[2].Value, tokens); NodeList.Add(tag); // If the tag has some rules (eg: it must occur once) then check for them tag.AssertTagRulesViolation(NodeList); } else { // This tag is not registered with the system // pass it to the current block for special handling or error reporting UnknownTag(fullTokenMatch.Groups[1].Value, fullTokenMatch.Groups[2].Value, tokens); } } else { throw new SyntaxException(Liquid.ResourceManager.GetString("BlockTagNotTerminatedException"), token, Liquid.TagEnd); } } else if (IsVariable.Match(token).Success) { NodeList.Add(CreateVariable(token)); } else if (token == string.Empty) { // Pass } else { NodeList.Add(token); } } // Make sure that its ok to end parsing in the current block. // Effectively this method will throw an exception unless the current block is // of type Document AssertMissingDelimitation(); }
public Dictionary<string, PropertyTreeMetaObject> ExtractParameterDictionary( OperatorDefinition op, PropertyTreeMetaObject target, IServiceProvider serviceProvider, NodeList children) { // Named constructor arguments var duplicates = new HashSet<QualifiedName>(); var mapped = new Dictionary<QualifiedName, PropertyTreeNavigator>(); foreach (var child in children) { // Implicitly map default NS to real var impliedName = ImpliedName(child, target); if (duplicates.Contains(impliedName)) { // Duplicates can't bind to parameters (only to param arrays) } else if (mapped.ContainsKey(impliedName)) { // Detected a duplicate duplicates.Add(impliedName); mapped.Remove(impliedName); } else { mapped.Add(impliedName, child); } } var args = new Dictionary<string, PropertyTreeMetaObject>(op.Parameters.Count); PropertyDefinition myParam = null; List<string> requiredMissing = new List<string>(); foreach (PropertyDefinition p in op.Parameters) { // Fallback to empty ns PropertyTreeNavigator nav; QualifiedName impliedName = p.QualifiedName; if (p.QualifiedName.Namespace.IsDefault) { impliedName = impliedName.ChangeNamespace(op.Namespace); } if (mapped.TryGetValue(impliedName, out nav)) { // Binds a parameter required for activating an instance // TODO Should we supply/use attributes from the parameter // and/or corresponding property descriptor? var childContext = target.CreateChild(p.PropertyType); args[p.Name] = Bind(childContext, nav, serviceProvider); children.Remove(nav); } else if (p.IsOptional) { PropertyTreeMetaObject defaultValue; if (p.DefaultValue == null) defaultValue = PropertyTreeMetaObject.Create(p.PropertyType); else defaultValue = PropertyTreeMetaObject.Create(p.DefaultValue); args[p.Name] = defaultValue; } else if (p.IsParamArray) myParam = p; else if (TypeHelper.IsParameterRequired(p.PropertyType)) { requiredMissing.Add(Utility.DisplayName(p.QualifiedName)); } } if (requiredMissing.Count > 0) errors.RequiredPropertiesMissing(requiredMissing, op, FindFileLocation(serviceProvider)); if (myParam == null && target.GetDefinition().DefaultProperty == null && duplicates.Any(t => target.SelectProperty(t) != null)) errors.DuplicatePropertyName(duplicates, FindFileLocation(serviceProvider)); // Try param array if (myParam != null) { var all = new List<object>(); var elementType = myParam.PropertyType.GetElementType(); foreach (var kvp in children) { // Bind child nodes so tha latebound applies var childrenList = NodeList.Create(PropertyTreeBinderImpl.SelectChildren(kvp)); var inline = BindChildNodes(PropertyTreeMetaObject.Create(elementType), kvp, childrenList); var inlineVal = inline.Component; all.Add(inlineVal); } children.Clear(); var array = Array.CreateInstance(elementType, all.Count); ((System.Collections.ICollection) all).CopyTo(array, 0); args[myParam.Name] = PropertyTreeMetaObject.Create(array); } return args; }
private void DeleteAllExecute(object obj) { NodeList.Clear(); }
public void Clear() { rootNodes.Clear(); }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) { return; } var selection = DesignView.Context.As <ISelectionContext>().Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); NodeList.Clear(); m_isUniformScaling = false; IEnumerable <DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable <DomNode>()); foreach (DomNode node in rootDomNodes) { ITransformable transNode = node.As <ITransformable>(); if (transNode == null || (transNode.TransformationType & TransformationTypes.Scale) == 0) { continue; } IVisible vn = node.As <IVisible>(); if (!vn.Visible) { continue; } ILockable lockable = node.As <ILockable>(); if (lockable.IsLocked) { continue; } // force uniform scaling if any node requires it if ((transNode.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) { m_isUniformScaling = true; } NodeList.Add(transNode); IManipulatorNotify notifier = transNode.As <IManipulatorNotify>(); if (notifier != null) { notifier.OnBeginDrag(); } } // to compute offset use bounding box in local space. Vec3F offset = Vec3F.ZeroVector;// 0.5f; // use bounding box in local space switch (m_hitRegion) { case HitRegion.XAxis: case HitRegion.YAxis: case HitRegion.ZAxis: offset = new Vec3F(-1, -1, -1); break; case HitRegion.NegXAxis: case HitRegion.NegYAxis: case HitRegion.NegZAxis: offset = new Vec3F(1, 1, 1); break; default: break; } m_originalScales = new Vec3F[NodeList.Count]; m_originalTranslations = new Vec3F[NodeList.Count]; m_pivotOffset = new Vec3F[NodeList.Count]; int k = 0; foreach (ITransformable node in NodeList) { IBoundable boundable = node.As <IBoundable>(); Vec3F pivot = Vec3F.Mul(boundable.LocalBoundingBox.Radius, offset); m_pivotOffset[k] = pivot; m_originalScales[k] = node.Scale; Matrix4F mtrx = TransformUtils.CalcTransform( Vec3F.ZeroVector, node.Rotation, node.Scale, pivot ); m_originalTranslations[k] = node.Translation - mtrx.Translation; k++; } if (NodeList.Count > 0) { transactionContext.Begin("Extend".Localize()); } }
/// <summary> /// Clear local cache</summary> private void Clear() { NodeList.Clear(); m_originalValues = null; m_originalRotations = null; }