/// <override></override> public override void CopyFrom(Shape source) { if (source == null) { throw new ArgumentNullException("source"); } this.permissionSetName = source.SecurityDomainName; this.tag = source.Tag; this.data = source.Data; this.displayService = source.DisplayService; //this.Parent = source.Parent; // Do not recalculate Center after adding the children because in case the group is rotated, // the rotation center would not be the same. if (source.Children != null) { if (ChildrenCollection == null) { ChildrenCollection = (GroupShapeAggregation)CreateChildrenCollection(source.Children.Count); } ChildrenCollection.CopyFrom(source.Children); } // Do not assign to the property but to the field because the children are already on their (rotated) positions if (source is IPlanarShape) { this.angle = ((IPlanarShape)source).Angle; } if (source is ShapeGroup) { this.angle = ((ShapeGroup)source).Angle; } }
/// <summary> /// コンストラクタ /// </summary> internal NodeBase(NodeBase parent) { Parent = parent; Name = new Value.String(); IsRendered = new Value.Boolean(true); Children = new ChildrenCollection(this); }
/// <summary> /// コンストラクタ /// </summary> internal NodeBase(NodeBase parent) { Parent = parent; Name = new Value.String(); IsRendered = new Value.Boolean(true); Children = new ChildrenCollection(this); }
/// <override></override> public override void Draw(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } ChildrenCollection.Draw(graphics); }
public void Given_a_collection_where_two_names_have_been_reserved_Then_the_first_name_can_be_released_and_reserved_again() { ChildrenCollection sut = EmptyChildrenCollection.Instance; sut = sut.ReserveName("Name"); sut = sut.ReserveName("Name2"); sut = sut.ReleaseName("Name"); sut = sut.ReserveName("Name"); }
/// <override></override> public override void DrawOutline(Graphics graphics, Pen pen) { if (graphics == null) { throw new ArgumentNullException("graphics"); } if (pen == null) { throw new ArgumentNullException("pen"); } ChildrenCollection.DrawOutline(graphics, pen); }
/// <override></override> public override Rectangle GetBoundingRectangle(bool tight) { Rectangle result = Rectangle.Empty; if (ChildrenCollection.Count <= 0) { result.Offset(X, Y); } else { result = ChildrenCollection.GetBoundingRectangle(tight); if (!Geometry.RectangleContainsPoint(result, X, Y)) { result = Geometry.UniteRectangles(X, Y, X, Y, result); } } return(result); }
/// <override></override> public override bool MoveBy(int deltaX, int deltaY) { bool result = false; Invalidate(); if (Owner != null) { Owner.NotifyChildMoving(this); } result = ChildrenCollection.NotifyParentMoved(deltaX, deltaY); if (Owner != null) { Owner.NotifyChildMoved(this); } Invalidate(); return(result); }
static void Main(string[] args) { var listOfElelement = new List <ChildrenConfigElement>() { new ChildrenConfigElement() { CityName = "Lahore", SchoolName = "City School Lahore" }, new ChildrenConfigElement() { CityName = "Karachi", SchoolName = "City School Karachi" } }; var chilCollection = new ChildrenCollection() { DefaultValue = -2, FullName = "Children Name 2", Enabled = true }; listOfElelement.ForEach(r => chilCollection.Add(r)); IChildren setting = new Children() { Name = "Fahad", FatherName = "Anwar UL Haq", childrenCollection = chilCollection }; //Setting setting2 = new Setting(setting); IChildren setting3 = Children.MapProfile(setting); Console.WriteLine("Source Object Values are... "); ///////////////////////////////////////////////////////////////////// //// Setting 1 /// ///////////////////////////////////////////////////////////////////// //PrintProperties(setting, 1); //Console.WriteLine("/////////////////////////////////////////////////"); /////////////////////////////////////////////////////////////////////// ////// Setting 2 After Generic Map /// /////////////////////////////////////////////////////////////////////// //PrintProperties(setting2, 1); Console.WriteLine("/////////////////////////////////////////////////"); ///////////////////////////////////////////////////////////////////// //// Setting 3 After Assembly Map /// ///////////////////////////////////////////////////////////////////// PrintProperties(setting3, 1); Console.ReadLine(); }
internal ModelRoot() { _extensionsUsed = new List <string>(); _extensionsRequired = new List <string>(); _accessors = new ChildrenCollection <Accessor, ModelRoot>(this); _animations = new ChildrenCollection <Animation, ModelRoot>(this); _buffers = new ChildrenCollection <Buffer, ModelRoot>(this); _bufferViews = new ChildrenCollection <BufferView, ModelRoot>(this); _cameras = new ChildrenCollection <Camera, ModelRoot>(this); _images = new ChildrenCollection <Image, ModelRoot>(this); _materials = new ChildrenCollection <Material, ModelRoot>(this); _meshes = new ChildrenCollection <Mesh, ModelRoot>(this); _nodes = new ChildrenCollection <Node, ModelRoot>(this); _samplers = new ChildrenCollection <TextureSampler, ModelRoot>(this); _scenes = new ChildrenCollection <Scene, ModelRoot>(this); _skins = new ChildrenCollection <Skin, ModelRoot>(this); _textures = new ChildrenCollection <Texture, ModelRoot>(this); }
public static void Main(string[] args) { var chilCollection = new ChildrenCollection(); var listOfElelement = new List <ChildrenElements>() { new ChildrenElements() { CityName = "Lahore", SchoolName = "City School Lahore" }, new ChildrenElements() { CityName = "Karachi", SchoolName = "City School Karachi" } }; listOfElelement.ForEach(r => chilCollection.Add(r)); chilCollection.DefaultValue = -2; chilCollection.FullName = "Children Name 2"; chilCollection.Enabled = true; IChildren children1 = new Children() { Name = "Fahad", FatherName = "Anwar UL Haq", childrenCollection = chilCollection }; Children children2 = new Children(children1, true); Children children3 = new Children(children1, false); Console.WriteLine("Source Object Values are... "); ///////////////////////////////////////////////////////////////////// //// Children 1 /// ///////////////////////////////////////////////////////////////////// PrintProperties(children1, 1); Console.WriteLine("/////////////////////////////////////////////////"); ///////////////////////////////////////////////////////////////////// //// Children 2 After Generic Map /// ///////////////////////////////////////////////////////////////////// PrintProperties(children2, 1); Console.WriteLine("/////////////////////////////////////////////////"); ///////////////////////////////////////////////////////////////////// //// Children 3 After Assembly Map /// ///////////////////////////////////////////////////////////////////// PrintProperties(children3, 1); Console.ReadLine(); }
/// <summary> /// Removes a table of paths. /// </summary> /// <param name="pathTable">The table of paths.</param> protected virtual void Remove(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { if (pathTable == null) { throw new ArgumentNullException(nameof(pathTable)); } IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { ITreeNodePath Path = Entry.Key; IPathConnection Connection = Entry.Value; IFolderPath? ParentPath = Connection.ParentPath; if (ParentPath != null) { ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; foreach (ISolutionTreeNode Child in (IEnumerable <ISolutionTreeNode>)ChildrenCollection) { if (Child.Path.IsEqual(Path)) { ChildrenCollection.Remove(Child); break; } } if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
/// <summary> /// Initializes a new instance. /// </summary> protected Instance() { var type = GetType(); Destroyed = new Signal(this); // the destroyed event will be used by Signal, so it needs to be created first. Changed = new Signal <string>(this); ParentChanged = new Signal <Instance>(this); ChildAdded = new Signal <Instance>(this); ChildRemoved = new Signal <Instance>(this); AncestryChanged = new Signal <Instance, Instance>(this); DescendantAdded = new Signal <Instance>(this); DescendantRemoving = new Signal <Instance>(this); _waitForChildList = new Dictionary <string, List <LuaThread> >(); Children = new ChildrenCollection(); Name = type.Name; _archivable = true; IsDestroyed = false; if (this is ISingleton) { var oldId = _instanceId; _instanceId = type.Name.ToUpper(); // ReSharper disable once VirtualMemberCallInConstructor OnInstanceIdChanged(_instanceId, oldId); } else { InstanceId = InstanceId.Generate(); } DescendantAdded.Event += d => { Parent?.DescendantAdded.Fire(d); }; DescendantRemoving.Event += d => { Parent?.DescendantAdded.Fire(d); }; Game.InvokeInstanceAdded(this); }
/// <override></override> public override bool IntersectsWith(int x, int y, int width, int height) { Rectangle rect = Rectangle.Empty; rect.X = x; rect.Y = y; rect.Width = width; rect.Height = height; if (ChildrenCollection.Count <= 0) { return(Geometry.RectangleContainsPoint(rect, X, Y)); } else if (Geometry.RectangleIntersectsWithRectangle(rect, ChildrenCollection.GetBoundingRectangle(false))) { foreach (Shape shape in ChildrenCollection) { if (shape.IntersectsWith(x, y, width, height)) { return(true); } } } return(false); }
/// <override></override> public override bool Rotate(int deltaAngle, int x, int y) { bool result = true; // Notify Owner if (Owner != null) { Owner.NotifyChildRotating(this); } // First, calculate the (normalized) rotation angle angle = (3600 + angle + deltaAngle) % 3600; // Then, calculate the new position of the center point (when performing an excentered rotation) // and move the shape (including its children) to the new center point if (x != X || y != Y) { int toX = X; int toY = Y; Geometry.RotatePoint(x, y, Geometry.TenthsOfDegreeToDegrees(deltaAngle), ref toX, ref toY); if (!MoveTo(toX, toY)) { result = false; } } // Notify children and owner (calls rotate for all children) if (!ChildrenCollection.NotifyParentRotated(deltaAngle, X, Y)) { result = false; } if (Owner != null) { Owner.NotifyChildRotated(this); } return(result); }
protected internal override void RemoveChild(GroupChild child) { ChildrenCollection.Remove((RelationalGroupChild)child); }
protected internal override void AddChild(GroupChild child) { ChildrenCollection.Add(new RelationalGroupChild { GroupID = this.ID, ChildGroupID = child.ChildGroupID }); }
public GridWindow() { Children = new ChildrenCollection(this); }
public ChildrenControl() { Children = new ChildrenCollection(this); }
internal _ModelPunctualLights(ModelRoot root) { _lights = new ChildrenCollection <PunctualLight, ModelRoot>(root); }
internal AgiRootStkMetadata(ModelRoot root) { _solarPanelGroups = new ChildrenCollection <AgiStkSolarPanelGroup, AgiRootStkMetadata>(this); }
/// <summary> /// Adds a table of path. /// </summary> /// <param name="pathTable">The table to add.</param> protected virtual void Add(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { if (pathTable == null) { throw new ArgumentNullException(nameof(pathTable)); } ClearExpandedFolders(); List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); List <ITreeNodePath> PathList = new List <ITreeNodePath>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { PathList.Add(Entry.Key); } while (PathList.Count > 0) { IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; int i = 0; while (i < PathList.Count) { ITreeNodePath Path = PathList[i]; IPathConnection Connection = pathTable[Path]; IFolderPath? ParentPath = Connection.ParentPath; if (ParentPath != null && FlatFolderTable.ContainsKey(ParentPath)) { PathList.RemoveAt(i); ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; bool IsHandled = false; switch (Path) { case IFolderPath AsFolderPath: IFolderProperties FolderProperties = (IFolderProperties)Connection.Properties; ISolutionFolder NewFolder = CreateSolutionFolder(ParentFolder, AsFolderPath, FolderProperties); ChildrenCollection.Add(NewFolder); if (Connection.IsExpanded) { AddExpandedFolder(NewFolder); } IsHandled = true; break; case IItemPath AsItemPath: IItemProperties ItemProperties = (IItemProperties)Connection.Properties; ISolutionItem NewItem = CreateSolutionItem(ParentFolder, AsItemPath, ItemProperties); ChildrenCollection.Add(NewItem); IsHandled = true; break; } Debug.Assert(IsHandled); if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } else { i++; } } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
internal AgiRootArticulations(ModelRoot root) { _articulations = new ChildrenCollection <AgiArticulation, AgiRootArticulations>(this); }
private void SetTerminatedChildrenCollection() { _childrenDoNotCallMeDirectly = TerminatedChildrenCollection.Instance; }
internal Animation() { _channels = new ChildrenCollection <AnimationChannel, Animation>(this); _samplers = new ChildrenCollection <AnimationSampler, Animation>(this); }
internal KHR_lights_punctualglTFextension(ModelRoot root) { _lights = new ChildrenCollection <PunctualLight, ModelRoot>(root); }
protected virtual void Add(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); ClearExpandedFolders(); List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); List <ITreeNodePath> PathList = new List <ITreeNodePath>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { PathList.Add(Entry.Key); } while (PathList.Count > 0) { IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; int i = 0; while (i < PathList.Count) { ITreeNodePath Path = PathList[i]; IPathConnection Connection = pathTable[Path]; IFolderPath ParentPath = Connection.ParentPath; if (FlatFolderTable.ContainsKey(ParentPath)) { PathList.RemoveAt(i); ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; IFolderPath AsFolderPath; IItemPath AsItemPath; if ((AsFolderPath = Path as IFolderPath) != null) { IFolderProperties Properties = (IFolderProperties)Connection.Properties; ISolutionFolder NewFolder = CreateSolutionFolder(ParentFolder, AsFolderPath, Properties); ChildrenCollection.Add(NewFolder); if (Connection.IsExpanded) { AddExpandedFolder(NewFolder); } } else if ((AsItemPath = Path as IItemPath) != null) { IItemProperties Properties = (IItemProperties)Connection.Properties; ISolutionItem NewItem = CreateSolutionItem(ParentFolder, AsItemPath, Properties); ChildrenCollection.Add(NewItem); } else { Assert.InvalidExecutionPath(); } if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } else { i++; } } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
internal Mesh() { _primitives = new ChildrenCollection <MeshPrimitive, Mesh>(this); _weights = new List <double>(); }
public ChildCollections() { _children = new ChildrenCollection(this); }