Ejemplo n.º 1
0
    public SkeletonItem[] PopulateRoot(IEnumerable<IState> states)
    {
      var i = 0;
      foreach (var s in states) {
        displayNodes[i++] = new ContainerNode<IDisplayNode>(this.name, x => x, s.Nodes);
      }

      return BfsExpand(this);
    }
Ejemplo n.º 2
0
        private XmlNode AddGroupDefinition(string groupId, IContainer container)
        {
            XmlElement newElement = null;

            StringBuilder builder = new StringBuilder();

            builder.Append("translate(");
            builder.Append(XmlConvert.ToString(container.Offset.X));
            builder.Append(",");
            builder.Append(XmlConvert.ToString(container.Offset.Y));
            builder.Append(")");

            newElement = base.CreateElement("g");
            newElement.SetAttribute("id", groupId);
            newElement.SetAttribute("transform", builder.ToString());

            ContainerNode.AppendChild(newElement);

            return(newElement as XmlNode);
        }
Ejemplo n.º 3
0
        internal static bool TryParseSet(JinjaEnvironment environment, Lexer lexer, ILookaroundEnumerator <ParsingNode> enumerator, [NotNullWhen(true)] out ASTNode?parsedNode)
        {
            parsedNode = default;
            if (SetParser.StartBlock.TryParse(enumerator.Current) == false)
            {
                return(false);
            }
            var startParsingNode = enumerator.Current;

            if (SetParser.StartBlock.TryGetAccumulations(SetParser.SetState.VariableName, out var variableNames) == false)
            {
                throw new NotImplementedException();
            }
            if (variableNames == null || variableNames.Length == 0)
            {
                throw new NotImplementedException();
            }
            if (variableNames.Length != 1)
            {
                throw new NotImplementedException();                            // Not supported yet
            }
            if (SetParser.StartBlock.TryGetAccumulation(SetParser.SetState.AssignmentExpression, 0, out var assignmentExpression))
            {
                parsedNode = new SetNode(startParsingNode, variableNames, assignmentExpression, null);
                return(true);
            }

            enumerator.MoveNext();
            var contents = ASTGenerator.ParseUntilFailure(environment, lexer, enumerator).ToArray();


            if (SetParser.EndBlock.TryParse(enumerator.Current) == false)
            {
                throw new NotImplementedException();
            }

            var contentsNode = new ContainerNode(null, contents, null);

            parsedNode = new SetNode(startParsingNode, variableNames, contentsNode, enumerator.Current);
            return(true);
        }
Ejemplo n.º 4
0
        public Item TryExtractItem(ContainerNode input, NetObjectList <Item> itemList, int index, int flux)
        {
            //Exception for multiple thread collisions
            Item source = itemList[index];
            Item tosend = null;

            if (source is SObject)
            {
                SObject obj          = (SObject)source;
                SObject tosendObject = (SObject)tosend;
                if (input.CanRecieveItem(source) && !IsEmpty())
                {
                    if (obj.Stack <= flux)
                    {
                        tosendObject = obj;
                        itemList.RemoveAt(index);
                    }
                    else
                    {
                        obj.stack.Value         -= flux;
                        tosendObject             = (SObject)obj.getOne();
                        tosendObject.stack.Value = flux;
                    }
                    Chest.clearNulls();
                    return(tosendObject);
                }
            }
            else if (source is Tool)
            {
                Tool tool       = (Tool)source;
                Tool tosendTool = (Tool)tosend;
                if (input.CanRecieveItem(tool))
                {
                    tosendTool = tool;
                    itemList.RemoveAt(index);
                }
                Chest.clearNulls();
                return(tosendTool);
            }
            return(null);
        }
            void IDirectory.Move(string srcDirectoryName, string destDirectoryName)
            {
                srcDirectoryName = _nodeNavigator.GetFullPath(srcDirectoryName);
                string srcParentFolder = _nodeNavigator.GetParentPath(srcDirectoryName);
                string src             = Path.GetFileName(srcDirectoryName);

                string destParentFolder = _nodeNavigator.GetParentPath(destDirectoryName);

                destDirectoryName = _nodeNavigator.GetFullPath(Path.Combine(srcParentFolder, destDirectoryName));
                string dest = Path.GetFileName(destDirectoryName);

                ContainerNode destParent = (ContainerNode)_nodeNavigator.GetOrCreate(_volumes, destParentFolder, false);
                ContainerNode srcParent  = (ContainerNode)_nodeNavigator.Get(_volumes, srcParentFolder);

                if (ReferenceEquals(srcParent, destParent))
                {
                    if (destParent.StringComparer.Equals(src, dest))
                    {
                        return;                                                 // TODO: Throw Exception?
                    }
                    destParent.Directories[src].Name = dest;
                }
                else
                {
                    DirectoryNode srcDirectory  = srcParent.Directories[src];
                    DirectoryNode destDirectory = destParent.Directories[dest];

                    if (destDirectory != null)
                    {
                        throw new IOException("Cannot create a file when that file already exists.");
                    }

                    destDirectory = srcDirectory;
                    lock (destParent.Directories.SyncLock)
                    {
                        srcParent.Directories.Remove(srcDirectory);
                        destParent.Directories.Add(srcDirectory);
                    }
                    destDirectory.Name = dest;
                }
            }
Ejemplo n.º 6
0
        private bool GenNodePath(ContainerNode parent, Node node, List <int> ret)
        {
            if (parent.Children.Contains(node))
            {
                ret.Add(parent.Children.IndexOf(node));
                return(true);
            }
            foreach (var node1 in parent.Children.Where(o => o is ContainerNode))
            {
                var child = (ContainerNode)node1;
                ret.Add(parent.Children.IndexOf(child));
                if (GenNodePath(child, node, ret))
                {
                    return(true);
                }
                ret.Remove(ret.Count - 1);
                return(false);
            }

            return(false);
        }
Ejemplo n.º 7
0
        internal static bool TryParseCall(JinjaEnvironment environment, Lexer lexer, ILookaroundEnumerator <ParsingNode> enumerator, [NotNullWhen(true)] out ASTNode?parsedNode)
        {
            parsedNode = default;


            if (CallParser.StartBlock.TryParse(enumerator.Current, out var outsideStart, out var insideStart) == false)
            {
                return(false);
            }
            if (CallParser.StartBlock.TryGetAccumulation(CallParser.CallState.CallDefinition, 0, out var callDefinition) == false)
            {
                throw new NotImplementedException();
            }
            var startParsingNode = enumerator.Current;

            enumerator.MoveNext();
            var contents = ASTGenerator.ParseUntilFailure(environment, lexer, enumerator).ToArray();

            if (CallParser.EndBlock.TryParse(enumerator.Current, out var insideEnd, out var outsideEnd) == false)
            {
                return(false);
            }
            var endParsingNode = enumerator.Current;
            var contentsNode   = new ContainerNode(null, contents, null,
                                                   new WhiteSpaceControlSet(insideStart, insideEnd)
                                                   );

            if (TryParseCallDefinition(lexer, callDefinition, out var callArgumentList, out var macroCall) == false)
            {
                throw new NotImplementedException();
            }


            parsedNode = new CallNode(startParsingNode,
                                      ExpressionNode.FromString(environment, callArgumentList),
                                      ExpressionNode.FromString(environment, macroCall), contentsNode, endParsingNode,
                                      new WhiteSpaceControlSet(outsideStart, outsideEnd)
                                      );
            return(true);
        }
        private void GetChildItems(ContainerNode parentContainer, string path, bool recurse, uint depth, Action <PSObject, string, string, bool> writeItemObject)
        {
            foreach (var childGetItem in parentContainer.GetChildItems())
            {
                var childItemPSObject = childGetItem.GetItem();
                if (childItemPSObject is not null)
                {
                    var childItemPath = Path.Join(path, childGetItem.Name);
                    writeItemObject(childItemPSObject, childItemPath, childGetItem.Name, childGetItem is ContainerNode);

                    //TODO: recurse in cmdlet provider will be slow if the underlying model could optimize fetching of data.
                    // alternatives:
                    // - let first container pull in the whole operation -> change IGetChildItems to GetChildItems( bool recurse, uint depth)
                    // - notify first container of incoming request so it can prepare the fetch: IPrepareGetChildItems: Prepare(bool recurse, uint depth) then resurce in provider
                    //   General solution would be to introduce a call context to allow an impl. to inspect the original request.
                    if (recurse && depth > 0 && childGetItem is ContainerNode childContainer)
                    {
                        this.GetChildItems(childContainer, childItemPath, recurse, depth - 1, writeItemObject);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        void ImageLibrary(StructuredReport report)
        {
            ContainerNode library = new ContainerNode(new CodedEntry("111028", "DCM", "Image Library"), ContinuityOfContent.Separate);

            report.Root.Add(library, RelationshipType.Contains);

            // there would be one of these for each image
            ImageNode image = new ImageNode(null, SOPClass.DigitalMammographyImageStorageForProcessing,
                                            "1.2.840.113564.10956419.20110513130130750480.1000000000003");

            image.ImageLaterality              = Laterality.Right;
            image.ImageView                    = ViewForMammography.CC;
            image.PatientOrientationRow        = "P";
            image.PatientOrientationColumn     = "L";
            image.StudyDate                    = "20110513";
            image.StudyTime                    = "130157";
            image.ContentDate                  = "20110513";
            image.ContentTime                  = "130156";
            image.HorizontalImagerPixelSpacing = "49";
            image.VerticalImagerPixelSpacing   = "49";

            library.Add(image, RelationshipType.Contains);
        }
Ejemplo n.º 10
0
        public override void FillChildren(ContainerNode in_parentCont, ComplexValue list)
        {
            DataTable dTable = list.dtable;

            for (int i = 0; i < dTable.Rows.Count; i++)
            {
                var ct_id      = dTable.Rows[i].Field <long>("ct_id");
                var parent_id  = dTable.Rows[i].Field <long>("parent_id");
                var name       = dTable.Rows[i].Field <string>("name");
                var created_at = dTable.Rows[i].Field <DateTime?>("created_at");

                var cMap = new ContainerMap(name, ct_id, null, parent_id, 0,
                                            -1, -1, -1, created_at);

                var           cont       = new ContainerNode(cMap);
                ContainerNode parentCont = in_parentCont;
                if (in_parentCont == null)
                {
                    parentCont = GetContainerByID(parent_id);
                }
                parentCont.AddChild(cont);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Заполнение внутреннего хранилища.
        /// Узел основного хранилища заполняется данными о дочерних контейнерах,
        /// чтобы у узла возник крестик.
        /// </summary>
        public override void Refresh()
        {
            containers.Clear();

            long parent_id    = -1;
            long _order       = 0;
            long _fh_id       = -1;
            long _predecessor = -1;
            long _successor   = -1;
            var  MainMap      = new ContainerMap(Session.MainStoreName, Session.MainStoreID, null, parent_id, _order,
                                                 _fh_id, _predecessor, _successor, DateTime.Now);

            var maincontainer = new ContainerNode(MainMap);

            containers.Add(maincontainer);

            var list_ids = new List <string>();

            list_ids.Add(Session.MainStoreID.ToString());
            var list = dbServer.GetChildrenInContainerList(tpList.tplDBtable, list_ids);

            this.FillChildren(maincontainer, list);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Gets the value associated with the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <returns> true if the dictionary contains an element with the specified key; otherwise, false.</returns>
        public bool TryGetValue(TKey key, out TValue value)
        {
            value = default(TValue);

            ContainerNode accNode = node;

            while (accNode != null)
            {
                ContainerValue containerValue;
                if (accNode.AssociativeContainer.TryGetValue(key, out containerValue))
                {
                    if (containerValue.HasValue)
                    {
                        value = containerValue.Value;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                accNode = accNode.PreviousNode;
            }

            ContainerValue rootValue;

            if (rootContainer.TryGetValue(key, out rootValue))
            {
                value = rootValue.Value;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 13
0
        internal static bool TryParseBlock(JinjaEnvironment environment, Lexer lexer, ILookaroundEnumerator <ParsingNode> enumerator, [NotNullWhen(true)] out ASTNode?parsedNode)
        {
            parsedNode = default;
            if (BlockParser.StartBlock.TryParse(enumerator.Current) == false)
            {
                return(false);
            }
            var startParsingNode = enumerator.Current;

            if (BlockParser.StartBlock.TryGetAccumulation(BlockParser.BlockState.BlockName, 0, out var startingBlockName) == false)
            {
                throw new NotImplementedException();
            }
            if (string.IsNullOrEmpty(startingBlockName))
            {
                throw new NotImplementedException();
            }
            enumerator.MoveNext();

            var contents = ASTGenerator.ParseUntilFailure(environment, lexer, enumerator).ToArray();


            if (BlockParser.EndBlock.TryParse(enumerator.Current) == false)
            {
                throw new NotImplementedException();
            }
            if (BlockParser.EndBlock.TryGetAccumulation(BlockParser.BlockState.BlockName, 0, out var endBlockName) && !string.IsNullOrEmpty(endBlockName) && endBlockName != startingBlockName)
            {
                throw new NotImplementedException();
            }

            var contentsBlock = new ContainerNode(null, contents, null);

            parsedNode = new BlockNode(startParsingNode, startingBlockName, contentsBlock, enumerator.Current);
            return(true);
        }
Ejemplo n.º 14
0
 public ContainerNode writeNewContainer(string name)
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.PersistentDocument_writeNewContainer(swigCPtr, name), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Ejemplo n.º 15
0
 public override void readObject(ContainerNode node)
 {
     pjsua2PINVOKE.AuthCredInfo_readObject(swigCPtr, ContainerNode.getCPtr(node));
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
 }
 public ContainerRoot addNodes(ContainerNode cn)
 {
     return this.deleg.addNodes(cn);
 }
Ejemplo n.º 17
0
 public void Transform(ContainerNode item)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 18
0
 internal BlockNode(ParsingNode?startParsingNode, string name, ContainerNode blockContents, ParsingNode?endParsingNode)
     : base(startParsingNode, blockContents.YieldOne(), endParsingNode)
 {
     Name          = name;
     BlockContents = blockContents;
 }
Ejemplo n.º 19
0
        internal IEnumerable<IBaseRenderer> GetRenderers(ContainerNode _containerNode, IBaseRenderer parent)
        {
            var nodes = _containerNode.Nodes;
            for (int i = nodes.Count - 1; i >= 0; i--)
            {
                var child = nodes[i];
                
                var childStyle = child as Style;
                if(childStyle != null)
                    foreach(var childSubRenderer in GetRenderers(childStyle, parent))
                        yield return childSubRenderer;

                var renderer = child.Renderer ?? (child.Renderer = CreateRenderer(child, null, parent));
                if (renderer != null) 
                    yield return renderer;
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CollectionItem"/> class.
 /// </summary>
 /// <param name="node">The <see cref="ContainerNode"/> which contains the grouped items.</param>
 public CollectionItem(ContainerNode node) 
 {
     this.node = node;
 }
Ejemplo n.º 21
0
 public WorkFlow()
 {
     _rootNode = new ContainerNode <TState>(_workFlowContext);
 }
Ejemplo n.º 22
0
        public void CascadeStyles(ContainerNode container)
        {
            var nodes = container.Nodes;
            for (int i = 0; i < nodes.Count; i++)
            {
                var style = nodes[i] as Style;
                if (style != null)
                    for (int j = i + 1; j < nodes.Count; j++)
                        if (nodes[j].Cascade(style))
                            return;

                var childContainer = nodes[i] as ContainerNode;
                if (childContainer != null)
                    CascadeStyles(childContainer);
            }
        }
Ejemplo n.º 23
0
 public override void FillDocs(ContainerNode cont, ComplexValue list)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 24
0
 public void ShowButton(ListItemSelectedEvent e, ContainerNode container, [JoinAll] ScreenNode screenNode)
 {
     screenNode.containersScreen.SetOpenButtonsActive(container.userItemCounter.Count > 0L, false);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContainerNode"/> class. New instance
 /// will be inserted to the linked list after the given node.
 /// </summary>
 /// <param name="previousNode">The previous node.</param>
 public ContainerNode(ContainerNode previousNode)
 {
     AssociativeContainer = new Dictionary <TKey, ContainerValue>();
     PreviousNode         = previousNode;
     NumberInSequence     = previousNode.NumberInSequence + 1;
 }
Ejemplo n.º 26
0
		private void SetTreeNodes(IList<ReportSuite> reportSuites)
		{
			foreach (ReportSuite suite in reportSuites)
			{
				ContainerNode suitenode = new ContainerNode(suite.Name);
				suitenode.Name = suite.Name;
				foreach (ReportAssembly reportAssembly in suite.Assemblies)
				{
					ContainerNode assemblyNode = new ContainerNode(reportAssembly.Location);
					assemblyNode.Name = reportAssembly.Location;
					foreach (TestClass testClass in reportAssembly.TestClasses)
					{
						ContainerNode testClassNode = new ContainerNode(testClass.Name);
						testClassNode.Name = testClass.TestNamespace;
						foreach (Test test in testClass.Tests)
						{
							bool testPassed = test.Passed;
							string testName = test.Name;
							TestCaseNode testNode = new TestCaseNode(testName);
							if (!testPassed)
							{
								FailStateNode dummy = new DummyTreeNode("-");
								testNode.Nodes.Add(dummy);
								testNode.NotifyChildAttached(dummy);
							}
							testClassNode.Nodes.Add(testNode);
							testClassNode.NotifyChildAttached(testNode);
						}
						assemblyNode.Nodes.Add(testClassNode);
						testClassNode.NotifyAttachedToParent();
					}
					suitenode.Nodes.Add(assemblyNode);
					assemblyNode.NotifyAttachedToParent();
				}
				reportTreeView.Nodes.Add(suitenode);
			}

		}
Ejemplo n.º 27
0
 public override void writeObject(ContainerNode node)
 {
     pjsua2PINVOKE.AccountRegConfig_writeObject(swigCPtr, ContainerNode.getCPtr(node));
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 28
0
    public override ContainerNode getRootContainer()
    {
        ContainerNode ret = new ContainerNode(pjsua2PINVOKE.JsonDocument_getRootContainer(swigCPtr), false);

        return(ret);
    }
Ejemplo n.º 29
0
 internal MacroNode(JinjaEnvironment environment, ParsingNode?startParsingNode, string macroText, ContainerNode contents, ParsingNode?endParsingNode, WhiteSpaceControlSet?whiteSpace = null)
     : base(startParsingNode, contents.ParsingNodes, endParsingNode)
 {
     Contents          = contents;
     WhiteSpaceControl = whiteSpace ?? new WhiteSpaceControlSet();
     //MacroText = macroText;
     if (environment.Evaluation.TryParseFunctionDeclaration(macroText, out var functionDeclaration) == false || functionDeclaration == null)
     {
         throw new NotImplementedException();
     }
     FunctionDeclaration = functionDeclaration;
 }
Ejemplo n.º 30
0
 public virtual ContainerNode getRootContainer()
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.PersistentDocument_getRootContainer(swigCPtr), false);
     return ret;
 }
Ejemplo n.º 31
0
 public STContainer(ContainerNode node)
     : base(node)
 {
 }
Ejemplo n.º 32
0
    private void ApplyEdits(RenderBatch batch, ContainerNode parent, int childIndex, ArrayBuilderSegment <RenderTreeEdit> edits)
    {
        var currentDepth             = 0;
        var childIndexAtCurrentDepth = childIndex;
        var permutations             = new List <PermutationListEntry>();

        for (var editIndex = edits.Offset; editIndex < edits.Offset + edits.Count; editIndex++)
        {
            var edit = edits.Array[editIndex];
            switch (edit.Type)
            {
            case RenderTreeEditType.PrependFrame:
            {
                var frame        = batch.ReferenceFrames.Array[edit.ReferenceFrameIndex];
                var siblingIndex = edit.SiblingIndex;
                InsertFrame(batch, parent, childIndexAtCurrentDepth + siblingIndex, batch.ReferenceFrames.Array, frame, edit.ReferenceFrameIndex);
                break;
            }

            case RenderTreeEditType.RemoveFrame:
            {
                var siblingIndex = edit.SiblingIndex;
                parent.RemoveLogicalChild(childIndexAtCurrentDepth + siblingIndex);
                break;
            }

            case RenderTreeEditType.SetAttribute:
            {
                var frame        = batch.ReferenceFrames.Array[edit.ReferenceFrameIndex];
                var siblingIndex = edit.SiblingIndex;
                var node         = parent.Children[childIndexAtCurrentDepth + siblingIndex];
                if (node is ElementNode element)
                {
                    ApplyAttribute(batch, element, frame);
                }
                else
                {
                    throw new Exception("Cannot set attribute on non-element child");
                }
                break;
            }

            case RenderTreeEditType.RemoveAttribute:
            {
                // Note that we don't have to dispose the info we track about event handlers here, because the
                // disposed event handler IDs are delivered separately (in the 'disposedEventHandlerIds' array)
                var siblingIndex = edit.SiblingIndex;
                var node         = parent.Children[childIndexAtCurrentDepth + siblingIndex];
                if (node is ElementNode element)
                {
                    var attributeName = edit.RemovedAttributeName !;

                    // First try to remove any special property we use for this attribute
                    if (!TryApplySpecialProperty(batch, element, attributeName, default))
                    {
                        // If that's not applicable, it's a regular DOM attribute so remove that
                        element.RemoveAttribute(attributeName);
                    }
                }
                else
                {
                    throw new Exception("Cannot remove attribute from non-element child");
                }
                break;
            }

            case RenderTreeEditType.UpdateText:
            {
                var frame        = batch.ReferenceFrames.Array[edit.ReferenceFrameIndex];
                var siblingIndex = edit.SiblingIndex;
                var node         = parent.Children[childIndexAtCurrentDepth + siblingIndex];
                if (node is TextNode textNode)
                {
                    textNode.TextContent = frame.TextContent;
                }
                else
                {
                    throw new Exception("Cannot set text content on non-text child");
                }
                break;
            }


            case RenderTreeEditType.UpdateMarkup:
            {
                var frame        = batch.ReferenceFrames.Array[edit.ReferenceFrameIndex];
                var siblingIndex = edit.SiblingIndex;
                parent.RemoveLogicalChild(childIndexAtCurrentDepth + siblingIndex);
                InsertMarkup(parent, childIndexAtCurrentDepth + siblingIndex, frame);
                break;
            }

            case RenderTreeEditType.StepIn:
            {
                var siblingIndex = edit.SiblingIndex;
                parent = (ContainerNode)parent.Children[childIndexAtCurrentDepth + siblingIndex];
                currentDepth++;
                childIndexAtCurrentDepth = 0;
                break;
            }

            case RenderTreeEditType.StepOut:
            {
                parent = parent.Parent ?? throw new InvalidOperationException($"Cannot step out of {parent}");
                currentDepth--;
                childIndexAtCurrentDepth = currentDepth == 0 ? childIndex : 0;         // The childIndex is only ever nonzero at zero depth
                break;
            }

            case RenderTreeEditType.PermutationListEntry:
            {
                permutations.Add(new PermutationListEntry(childIndexAtCurrentDepth + edit.SiblingIndex, childIndexAtCurrentDepth + edit.MoveToSiblingIndex));
                break;
            }

            case RenderTreeEditType.PermutationListEnd:
            {
                throw new NotSupportedException();
                //permuteLogicalChildren(parent, permutations!);
                //permutations.Clear();
                //break;
            }

            default:
            {
                throw new Exception($"Unknown edit type: '{edit.Type}'");
            }
            }
        }
    }
Ejemplo n.º 33
0
 public SceneGraph()
 {
     this._root = new ContainerNode();
 }
Ejemplo n.º 34
0
 internal void Render(ContainerNode container, Feature feature)
 {
     var nodes = container.Nodes;
     for (int i = nodes.Count - 1; i >= 0; i--)
     {
         var childRenderer = (IFeatureRenderer)nodes[i].Renderer;
         if (childRenderer != null && childRenderer.Visible)
         {
             childRenderer.Render(feature);
             if (CancelPending)
                 break;
         }
     }
 }
Ejemplo n.º 35
0
 internal CallNode(ParsingNode?startParsingNode, ExpressionNode callerDefinition, ExpressionNode macroCall, ContainerNode contents, ParsingNode?endParsingNode, WhiteSpaceControlSet?whiteSpace = null)
     : base(startParsingNode, contents.ParsingNodes, endParsingNode)
 {
     Contents          = contents;
     WhiteSpaceControl = whiteSpace ?? new WhiteSpaceControlSet();
     MacroCall         = macroCall;
     CallerDefinition  = callerDefinition;
 }
Ejemplo n.º 36
0
 public override ContainerNode getRootContainer()
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.JsonDocument_getRootContainer(swigCPtr), false);
     return ret;
 }
Ejemplo n.º 37
0
 public virtual void writeObject(ContainerNode node)
 {
     pjsua2PINVOKE.PersistentObject_writeObject(swigCPtr, ContainerNode.getCPtr(node));
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 38
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ContainerNode obj)
 {
     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
 public ContainerRoot removeNodes(ContainerNode cn)
 {
     return this.deleg.removeNodes(cn);
 }
Ejemplo n.º 40
0
 public ContainerNode readArray(string name)
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.ContainerNode_readArray__SWIG_0(swigCPtr, name), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Ejemplo n.º 41
0
 public Expression Transform(ContainerNode item)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 42
0
 public ContainerNode readArray()
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.PersistentDocument_readArray__SWIG_1(swigCPtr), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Ejemplo n.º 43
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ContainerNode obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 44
0
 public IEnumerable <bool> Transform(ContainerNode item) => TransformAll(item.Children);
Ejemplo n.º 45
0
        public override bool OnMouseUp(MouseEventArgs e)
        {
            mousedown = false;
            MoveNode(e, true);


            HashSet <ContainerNode> containersThatWillChangeInBounds = new HashSet <ContainerNode>();

            foreach (var n in diagram.SelectedObjects.OfType <Node>())
            {
                ContainerNode cn = n.Container;
                while (cn != null)
                {
                    containersThatWillChangeInBounds.Add(cn);
                    cn = cn.Container;
                }
            }

            if ((Control.ModifierKeys & Keys.Shift) != Keys.Shift)
            {
                var nodesIntersecting = new HashSet <Node>(diagram.NodesAt(e.X, e.Y));

                var nodesIntersectingThatAreNotPartOfSelection = nodesIntersecting.Except(selectedObjectsPositions.Keys.OfType <Node>());
                var nodesIntersectingThatArePartOfSelection    = nodesIntersecting.Where(n => selectedObjectsPositions.ContainsKey(n));

                var targetNode = nodesIntersectingThatAreNotPartOfSelection.FirstOrDefault();
                if (targetNode != null)
                {
                    targetNode.OnNodeDragDrop(diagram.SelectedObjects.OfType <Node>().Where(n => n != targetNode));
                }
                else
                {
                    var nodesToCheckIfTheyNeedToBeRemovedFromTheirContainer = diagram.SelectedObjects.OfType <Node>().ToList();
                    if (nodeAtDragPoint is ContainerNode)
                    {
                        // the node we're dragging is a container, any child node shouldn't be removed just by dragging the its container
                        foreach (var child in ((ContainerNode)nodeAtDragPoint).GetAllChildren())
                        {
                            nodesToCheckIfTheyNeedToBeRemovedFromTheirContainer.Remove(child);
                        }
                    }

                    foreach (var n in nodesToCheckIfTheyNeedToBeRemovedFromTheirContainer)
                    {
                        if (n.Container != null && !nodesIntersecting.Contains(n.Container))
                        {
                            var container = n.Container;
                            container.Children.Remove(n);
                        }
                    }
                }
            }

            // everything is moved, allow bounds to be updated based on their children
            foreach (var c in suspendedContainers.OrderByDescending(cn => cn.Depth))
            {
                c.ResumeFit();
            }


            // add new containers (those that are referenced by the changed children)
            foreach (var n in diagram.SelectedObjects.OfType <Node>())
            {
                ContainerNode cn = n.Container;
                while (cn != null)
                {
                    containersThatWillChangeInBounds.Add(cn);
                    cn = cn.Container;
                }
            }


            foreach (var c in containersThatWillChangeInBounds.OrderByDescending(cn => cn.Depth))
            {
                c.UpdateBounds();
            }
            diagram.Invalidate();

            //var nodesIntersecting =  diagram.Nodes.Where(n => selectedObjectsPositions.OfType<Node>().Any(selNode => n.Area.IntersectsWith(selNode.Area)));

            return(true);
        }
		/// <summary>
		/// Insert a node to the proper depth using the path.
		/// </summary>
		public void InsertNode(FolderConfigurationNodeBase node, Path path)
		{
			// There is no recommended path.  Add it immediately
			if (path == null || path.Segments.Count == 0)
			{
				AddChildNode(node);
				return;
			}

			var text  = CollectionUtils.FirstElement(path.Segments).LocalizedText;
			var childWithMatchingText = _subTree == null ? null : CollectionUtils.SelectFirst(_subTree.Items, child => child.Text == text);
			
			if (childWithMatchingText == null)
			{
				if (path.Segments.Count == 1)
				{
					// There are no more depth to the path, add child now.
					AddChildNode(node);
					PropagateCheckStateUp(node.Parent);
				}
				else
				{
					// create a container node and insert into the container node's subtree
					var containerNode = new ContainerNode(text);
					AddChildNode(containerNode);
					containerNode.InsertNode(node, path.SubPath(1, path.Segments.Count - 1));
				}
			}
			else
			{
				if (path.Segments.Count == 1)
				{
					// There are no more depth to the path, add child now.
					if (childWithMatchingText is ContainerNode)
						ReplaceChildNode(childWithMatchingText, node);
					else
						AddChildNode(node);

					PropagateCheckStateUp(node.Parent);
				}
				else
				{
					// insert this node child's subtree
					childWithMatchingText.InsertNode(node, path.SubPath(1, path.Segments.Count - 1));
				}
			}
		}
Ejemplo n.º 47
0
        public virtual ContainerNode getRootContainer()
        {
            ContainerNode ret = new ContainerNode(pjsua2PINVOKE.PersistentDocument_getRootContainer(swigCPtr), false);

            return(ret);
        }
Ejemplo n.º 48
0
 public void Transform(ContainerNode item)
 {
     TransformASTNode(item);
 }
Ejemplo n.º 49
0
 public ContainerNode readContainer()
 {
     ContainerNode ret = new ContainerNode(pjsua2PINVOKE.ContainerNode_readContainer__SWIG_1(swigCPtr), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Ejemplo n.º 50
0
        /// <summary>
        /// 按 KNX 控件类型,给树上添加控件节点
        /// </summary>
        /// <param name="parentNode"></param>
        /// <param name="knxControl"></param>
        private static void AddControlNode(ContainerNode parentNode, KNXControlBase knxControl /*, UIEditor.Entity.ViewNode.PropertiesChangedDelegate proChangedDelegate*/)
        {
            switch (knxControl.GetType().Name)
            {
            case MyConst.Controls.KnxBlindsType:
                var blindsNode = new BlindsNode(knxControl as KNXBlinds);
                //blindsNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(blindsNode);
                break;

            case MyConst.Controls.KnxLabelType:
                var labelNode = new LabelNode(knxControl as KNXLabel);
                //labelNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(labelNode);
                break;

            case MyConst.Controls.KnxSceneButtonType:
                var sceneButtonNode = new SceneButtonNode(knxControl as KNXSceneButton);
                //sceneButtonNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(sceneButtonNode);
                break;

            case MyConst.Controls.KnxSliderSwitchType:
                var sliderSwitchNode = new SliderSwitchNode(knxControl as KNXSliderSwitch);
                //sliderSwitchNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(sliderSwitchNode);
                break;

            case MyConst.Controls.KnxSwitchType:
                var switchNode = new SwitchNode(knxControl as KNXSwitch);
                //switchNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(switchNode);
                break;

            case MyConst.Controls.KnxValueDisplayType:
                var valueDisplayNode = new ValueDisplayNode(knxControl as KNXValueDisplay);
                //valueDisplayNode.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(valueDisplayNode);
                break;

            case MyConst.Controls.KnxTimerButtonType:
                var timerButton = new TimerButtonNode(knxControl as KNXTimerButton);
                //timerButton.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(timerButton);
                break;

            case MyConst.Controls.KnxDigitalAdjustment:
                var digitalAdjustment = new DigitalAdjustmentNode(knxControl as KNXDigitalAdjustment);
                //digitalAdjustment.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(digitalAdjustment);
                break;

            case MyConst.Controls.KnxGroupBoxType:
                var groupBox = new GroupBoxNode(knxControl as KNXGroupBox);
                //groupBox.PropertiesChangedEvent += proChangedDelegate;
                parentNode.Nodes.Add(groupBox);

                KNXGroupBox knxGroupBox = knxControl as KNXGroupBox;
                if (knxGroupBox.Controls != null && knxGroupBox.Controls.Count > 0)
                {
                    foreach (var item in knxGroupBox.Controls)
                    {
                        AddControlNode(groupBox, item /*, proChangedDelegate*/);
                    }
                }

                break;

            default:
                MessageBox.Show(ResourceMng.GetString("Message39") + knxControl.GetType().Name, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
        }