/// <summary> /// Adds a new NumPagesField /// </summary> public void Add(NumPagesField numPagesField) { Elements.Add(numPagesField); }
/// <summary> /// Adds a new image to the text area. /// </summary> public void Add(Image image) { Elements.Add(image); }
/// <summary> /// Adds a new Bookmark /// </summary> public void Add(BookmarkField bookmark) { Elements.Add(bookmark); }
// Renderは親から子供の順番 private IElement[] Render(XdObjectJson xdObject, [CanBeNull] Obb parent) { var eid = _nextEid; _nextEid++; var originalObb = _obbHolder.Get(xdObject); var obb = originalObb.CalcObbInWorld(parent); var position = obb.CalcLocalRect().center - (parent?.Size ?? Vector2.zero) / 2f; var size = obb.Size; var anchorX = AnchorXType.Center; var anchorY = AnchorYType.Middle; var rotation = obb.Rotation; if (Mathf.Abs(rotation) < 0.0001f) { rotation = 0f; } var constRight = xdObject.Meta.Ux.ConstraintRight; var constLeft = xdObject.Meta.Ux.ConstraintLeft; if (constRight && constLeft) { anchorX = AnchorXType.Stretch; } else if (constRight) { anchorX = AnchorXType.Right; } else if (constLeft) { anchorX = AnchorXType.Left; } var constTop = xdObject.Meta.Ux.ConstraintTop; var constBottom = xdObject.Meta.Ux.ConstraintBottom; if (constTop && constBottom) { anchorY = AnchorYType.Stretch; } else if (constTop) { anchorY = AnchorYType.Top; } else if (constBottom) { anchorY = AnchorYType.Bottom; } foreach (var parser in _objectParsers) { if (!parser.Is(xdObject)) { continue; } var(components, assets) = parser.Render(xdObject, obb, _xdAssetHolder); var children = new IElement[] { }; if (xdObject.Group != null) { children = Render(xdObject.Group.Children, originalObb); } var element = new ObjectElement( eid, xdObject.GetSimpleName(), position, size, anchorX, anchorY, rotation, xdObject.Visible ?? true, components, children.Select(x => x.Eid).ToArray() ); foreach (var asset in assets) { if (Assets.Any(x => x.FileName == asset.FileName)) { continue; } Assets.Add(asset); } Elements.Add(element); return(new IElement[] { element }); } if (xdObject.Type == "group") { var components = new List <IComponent>(); foreach (var parser in _groupParsers) { if (!parser.Is(xdObject)) { continue; } var(c, assets) = parser.Render(xdObject, _xdAssetHolder, _obbHolder); components.AddRange(c); foreach (var asset in assets) { if (Assets.Any(x => x.FileName == asset.FileName)) { continue; } Assets.Add(asset); } break; } var generatedChildren = new IElement[] { }; if (xdObject.Group != null) { generatedChildren = Render(xdObject.Group.Children, originalObb); } var group = new ObjectElement( eid, xdObject.GetSimpleName(), position, size, anchorX, anchorY, rotation, xdObject.Visible ?? true, components.ToArray(), generatedChildren.Select(x => x.Eid).ToArray() ); Elements.Add(group); return(new IElement[] { group }); } throw new Exception($"Unknown object type {xdObject.Type}"); }
/// <summary> /// Adds a new paragraph to the text area. /// </summary> public void Add(Paragraph paragraph) { Elements.Add(paragraph); }
public override Value Evaluate(FSharpList <Value> args) { var name = ((Value.String)args[0]).Item; var number = ((Value.String)args[1]).Item; var tb = (FamilySymbol)((Value.Container)args[2]).Item; if (!args[3].IsList) { throw new Exception("The views input must be a list of views."); } var views = ((Value.List)args[3]).Item; Autodesk.Revit.DB.ViewSheet sheet = null; if (this.Elements.Any()) { if (dynUtils.TryGetElement(this.Elements[0], out sheet)) { if (sheet.Name != null && sheet.Name != name) { sheet.Name = name; } if (number != null && sheet.SheetNumber != number) { sheet.SheetNumber = number; } } else { //create a new view sheet sheet = Autodesk.Revit.DB.ViewSheet.Create(dynRevitSettings.Doc.Document, tb.Id); sheet.Name = name; sheet.SheetNumber = number; Elements[0] = sheet.Id; } } else { sheet = Autodesk.Revit.DB.ViewSheet.Create(dynRevitSettings.Doc.Document, tb.Id); sheet.Name = name; sheet.SheetNumber = number; Elements.Add(sheet.Id); } //rearrange views on sheets //first clear the collection of views on the sheet //sheet.Views.Clear(); var width = sheet.Outline.Max.U - sheet.Outline.Min.U; var height = sheet.Outline.Max.V - sheet.Outline.Min.V; var packer = new CygonRectanglePacker(width, height); foreach (var val in views) { var view = (View)((Value.Container)val).Item; var viewWidth = view.Outline.Max.U - view.Outline.Min.U; var viewHeight = view.Outline.Max.V - view.Outline.Min.V; UV placement = null; if (packer.TryPack(viewWidth, viewHeight, out placement)) { if (sheet.Views.Contains(view)) { //move the view //find the corresponding viewport var collector = new FilteredElementCollector(dynRevitSettings.Doc.Document); collector.OfClass(typeof(Viewport)); var found = collector.ToElements() .Cast <Viewport>() .Where(x => x.SheetId == sheet.Id && x.ViewId == view.Id); var enumerable = found as Viewport[] ?? found.ToArray(); if (!enumerable.Any()) { continue; } var viewport = enumerable.First(); viewport.SetBoxCenter(new XYZ(placement.U + viewWidth / 2, placement.V + viewHeight / 2, 0)); } else { //place the view on the sheet if (Viewport.CanAddViewToSheet(dynRevitSettings.Doc.Document, sheet.Id, view.Id)) { var viewport = Viewport.Create(dynRevitSettings.Doc.Document, sheet.Id, view.Id, new XYZ(placement.U + viewWidth / 2, placement.V + viewHeight / 2, 0)); } } } else { throw new Exception("View could not be packed on sheet."); } } return(Value.NewContainer(sheet)); }
/// <summary> /// Adds a new chart to the header or footer. /// </summary> public void Add(Chart chart) { Elements.Add(chart); }
protected override void OnInitDeciderElements() { Elements.Add("next", new NextButtonElement("think_instructions")); }
/// <summary> /// Registers the specified entry. /// </summary> /// <param name="entry">The entry.</param> public void Register(Element entry) { Elements.Add(entry.Path, entry); }
protected override void OnInitPlayerElements() { Elements.Add("trophy", new ImageElement("trophy")); Elements.Add("separator", new ImageElement("")); }
protected override void OnInitElements() { Elements.Add("question", new TextElement(Game.Controller.Question)); Elements.Add("round", new TextElement("Round " + (Game.Controller.RoundNumber + 1).ToString())); }
public void AddElement(string name, Drawable element) { Elements.Add(name, element); }
private static void AccumulateParents(Element el, Elements parents) { Element parent = el.Parent; if (parent != null && !parent.TagName.Equals("#root")) { parents.Add(parent); AccumulateParents(parent, parents); } }
// exclude set. package open so that Elements can implement .not() selector. public static Elements FilterOut(IEnumerable<Element> elements, IEnumerable<Element> outs) { Elements output = new Elements(); foreach (Element el in elements) { bool found = false; foreach (Element outEl in outs) { if (el.Equals(outEl)) { found = true; break; } } if (!found) { output.Add(el); } } return output; }
/// <summary> /// Adds a new DateField /// </summary> public void Add(DateField dateField) { Elements.Add(dateField); }
public void ShowToolbar(MyToolbar toolbar) { if (m_shownToolbar != null) { m_shownToolbar.ItemChanged -= Toolbar_ItemChanged; m_shownToolbar.ItemUpdated -= Toolbar_ItemUpdated; m_shownToolbar.SelectedSlotChanged -= Toolbar_SelectedSlotChanged; m_shownToolbar.SlotActivated -= Toolbar_SlotActivated; m_shownToolbar.ItemEnabledChanged -= Toolbar_ItemEnabledChanged; m_shownToolbar.CurrentPageChanged -= Toolbar_CurrentPageChanged; foreach (var label in m_pageLabelList) { Elements.Remove(label); } m_pageLabelList.Clear(); } m_shownToolbar = toolbar; if (m_shownToolbar == null) // Toolbar can be null in the passenger seat { m_toolbarItemsGrid.Enabled = false; m_toolbarItemsGrid.Visible = false; } else { var slotCount = toolbar.SlotCount; m_toolbarItemsGrid.ColumnsCount = slotCount + (toolbar.ShowHolsterSlot ? 1 : 0); for (int i = 0; i < slotCount; ++i) { SetGridItemAt(i, toolbar.GetSlotItem(i), clear: true); } m_selectedItemLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM; m_colorVariantPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM; m_colorVariantPanel.Visible = MyFakes.ENABLE_BLOCK_COLORING; // character != null; if (toolbar.ShowHolsterSlot) { SetGridItemAt(slotCount, new MyToolbarItemEmpty(), new string[] { @"Textures\GUI\Icons\HideWeapon.dds" }, null, MyTexts.GetString(MyCommonTexts.HideWeapon)); } if (toolbar.PageCount > 1) { for (int i = 0; i < toolbar.PageCount; ++i) { m_textCache.Clear(); m_textCache.AppendInt32(i + 1); MyGuiControlLabel pageLabel = new MyGuiControlLabel(text: MyToolbarComponent.GetSlotControlText(i).ToString() ?? m_textCache.ToString()); pageLabel.BackgroundTexture = MyGuiConstants.TEXTURE_TOOLBAR_TAB; pageLabel.TextScale = 0.7f; pageLabel.Size = m_toolbarItemsGrid.ItemSize * new Vector2(0.5f, 0.35f); pageLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; m_pageLabelList.Add(pageLabel); Elements.Add(pageLabel); } } RepositionControls(); HighlightCurrentPageLabel(); RefreshSelectedItem(toolbar); m_shownToolbar.ItemChanged -= Toolbar_ItemChanged; m_shownToolbar.ItemChanged += Toolbar_ItemChanged; m_shownToolbar.ItemUpdated -= Toolbar_ItemUpdated; m_shownToolbar.ItemUpdated += Toolbar_ItemUpdated; m_shownToolbar.SelectedSlotChanged -= Toolbar_SelectedSlotChanged; m_shownToolbar.SelectedSlotChanged += Toolbar_SelectedSlotChanged; m_shownToolbar.SlotActivated -= Toolbar_SlotActivated; m_shownToolbar.SlotActivated += Toolbar_SlotActivated; m_shownToolbar.ItemEnabledChanged -= Toolbar_ItemEnabledChanged; m_shownToolbar.ItemEnabledChanged += Toolbar_ItemEnabledChanged; m_shownToolbar.CurrentPageChanged -= Toolbar_CurrentPageChanged; m_shownToolbar.CurrentPageChanged += Toolbar_CurrentPageChanged; MaxSize = MinSize = new Vector2(m_toolbarItemsGrid.Size.X, m_toolbarItemsGrid.Size.Y + m_selectedItemLabel.Size.Y + m_colorVariantPanel.Size.Y); m_toolbarItemsGrid.Enabled = true; m_toolbarItemsGrid.Visible = true; } }
//Adds a renge of elements, skipping duplicates private void AddRange(Elements nodes, Elements add) { foreach (Element element in add.Values) { if (!nodes.Contains(element.Key)) nodes.Add(element.Key,element); } }
public TestCanvas() : base() { Elements.Add(new Image("MainMenu/MenuBackground1", new Rectangle(0, 0, Globals.ScreenWidth, Globals.ScreenHeight))); box = new DialogueBox("To jest jakis bardzo dlugi dialog, ktory z pewnoscia nie powinien sie zmiescic w tym polu, a zwlaszcza w jednej linijce. Sprawdzmy, czy nasz niesamowity system dialogowy dziala tak jak powinien. Zobaczmy co sie stanie po wyswietleniu okienka..."); }
public override Value Evaluate(FSharpList <Value> args) { View3D view = null; var eye = (XYZ)((Value.Container)args[0]).Item; var target = (XYZ)((Value.Container)args[1]).Item; var name = ((Value.String)args[2]).Item; var extents = ((Value.Container)args[3]).Item; var isolate = Convert.ToBoolean(((Value.Number)args[4]).Item); var globalUp = XYZ.BasisZ; var direction = target.Subtract(eye); var up = direction.CrossProduct(globalUp).CrossProduct(direction); var orient = new ViewOrientation3D(eye, up, direction); if (this.Elements.Any()) { if (dynUtils.TryGetElement(this.Elements[0], out view)) { if (!view.ViewDirection.IsAlmostEqualTo(direction) || !view.Origin.IsAlmostEqualTo(eye)) { view.Unlock(); view.SetOrientation(orient); view.SaveOrientationAndLock(); } if (!view.Name.Equals(name)) { view.Name = ViewBase.CreateUniqueViewName(name); } } else { //create a new view view = ViewBase.Create3DView(orient, name, isPerspective); Elements[0] = view.Id; } } else { view = Create3DView(orient, name, isPerspective); Elements.Add(view.Id); } var fec = dynRevitUtils.SetupFilters(dynRevitSettings.Doc.Document); if (isolate) { view.CropBoxActive = true; var element = extents as Element; if (element != null) { var e = element; var all = fec.ToElements(); var toHide = fec.ToElements().Where(x => !x.IsHidden(view) && x.CanBeHidden(view) && x.Id != e.Id).Select(x => x.Id).ToList(); if (toHide.Count > 0) { view.HideElements(toHide); } dynRevitSettings.Doc.Document.Regenerate(); Debug.WriteLine(string.Format("Eye:{0},Origin{1}, BBox_Origin{2}, Element{3}", eye.ToString(), view.Origin.ToString(), view.CropBox.Transform.Origin.ToString(), (element.Location as LocationPoint).Point.ToString())); //http://wikihelp.autodesk.com/Revit/fra/2013/Help/0000-API_Deve0/0039-Basic_In39/0067-Views67/0069-The_View69 if (isPerspective) { var farClip = view.get_Parameter("Far Clip Active"); farClip.Set(0); } else { //http://adndevblog.typepad.com/aec/2012/05/set-crop-box-of-3d-view-that-exactly-fits-an-element.html var pts = new List <XYZ>(); ParseElementGeometry(element, pts); var bounding = view.CropBox; var transInverse = bounding.Transform.Inverse; var transPts = pts.Select(transInverse.OfPoint).ToList(); //ingore the Z coordindates and find //the max X ,Y and Min X, Y in 3d view. double dMaxX = 0, dMaxY = 0, dMinX = 0, dMinY = 0; //geom.XYZ ptMaxX, ptMaxY, ptMinX,ptMInY; //coorresponding point. bool bFirstPt = true; foreach (var pt1 in transPts) { if (true == bFirstPt) { dMaxX = pt1.X; dMaxY = pt1.Y; dMinX = pt1.X; dMinY = pt1.Y; bFirstPt = false; } else { if (dMaxX < pt1.X) { dMaxX = pt1.X; } if (dMaxY < pt1.Y) { dMaxY = pt1.Y; } if (dMinX > pt1.X) { dMinX = pt1.X; } if (dMinY > pt1.Y) { dMinY = pt1.Y; } } } bounding.Max = new XYZ(dMaxX, dMaxY, bounding.Max.Z); bounding.Min = new XYZ(dMinX, dMinY, bounding.Min.Z); view.CropBox = bounding; } } else { var xyz = extents as BoundingBoxXYZ; if (xyz != null) { view.CropBox = xyz; } } view.CropBoxVisible = false; } else { view.UnhideElements(fec.ToElementIds()); view.CropBoxActive = false; } return(Value.NewContainer(view)); }
/// <summary> /// Adds the specified annotation. /// </summary> /// <param name="annotation">The annotation.</param> public void Add(PdfAnnotation annotation) { annotation.Document = this.Owner; this.Owner.irefTable.Add(annotation); Elements.Add(annotation.Reference); }
/// <summary> /// Adds a new text frame to the header or footer. /// </summary> public void Add(TextFrame textFrame) { Elements.Add(textFrame); }
public override void AddElement(Element element) { Elements.Add(element); }
protected override void OnInitDeciderElements() { Elements.Add("next", new NextButtonElement("bio")); }
protected override void OnInitElements() { Elements.Add("logo", new ImageElement("logo")); }
/// <summary> /// Adds a new table to the text area. /// </summary> public void Add(Table table) { Elements.Add(table); }
public MyGuiControlNews() : base(isActiveControl: true, canHaveFocus: false, allowFocusingElements: true) { m_news = new List <MyNewsEntry>(); m_labelTitle = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "Title" }; m_labelDate = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP) { Name = "Date" }; m_separator = new MyGuiControlSeparatorList() { Name = "Separator", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER }; m_textNewsEntry = new MyGuiControlMultilineText( textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f, drawScrollbar: true) { Name = "NewsEntry", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, }; m_textNewsEntry.OnLinkClicked += OnLinkClicked; m_bottomPanel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_PAGING_BACKGROUND, Name = "BottomPanel", }; m_labelPages = new MyGuiControlLabel( text: new StringBuilder("{0}/{1} ").ToString(), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) { Name = "Pages" }; m_buttonPrev = new MyGuiControlButton( visualStyle: MyGuiControlButtonStyleEnum.ArrowLeft, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, onButtonClick: (b) => UpdateCurrentEntryIndex(-1)) { Name = "Previous" }; m_buttonNext = new MyGuiControlButton( visualStyle: MyGuiControlButtonStyleEnum.ArrowRight, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, onButtonClick: (b) => UpdateCurrentEntryIndex(+1)) { Name = "Next" }; m_textError = new MyGuiControlMultilineText( textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, font: MyFontEnum.Red) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, Name = "Error" }; m_backgroundPanel = new MyGuiControlCompositePanel() { ColorMask = new Vector4(1f, 1f, 1f, 0.69f), BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_BACKGROUND }; m_wheelLoading = new MyGuiControlRotatingWheel(multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels); Elements.Add(m_backgroundPanel); Elements.Add(m_labelTitle); Elements.Add(m_labelDate); Elements.Add(m_separator); Elements.Add(m_textNewsEntry); Elements.Add(m_bottomPanel); Elements.Add(m_labelPages); Elements.Add(m_buttonPrev); Elements.Add(m_buttonNext); Elements.Add(m_textError); Elements.Add(m_wheelLoading); if (false) { m_textNewsEntry.BorderEnabled = true; m_labelPages.BorderEnabled = true; m_bottomPanel.BorderEnabled = true; m_buttonPrev.BorderEnabled = true; m_buttonNext.BorderEnabled = true; m_textError.BorderEnabled = true; m_wheelLoading.BorderEnabled = true; } RefreshState(); UpdatePositionsAndSizes(); RefreshShownEntry(); }
/// <summary> /// Adds a new legend to the text area. /// </summary> public void Add(Legend legend) { Elements.Add(legend); }
/// <summary> /// Ajoute l'élément <paramref name="element"/> au dossier. /// </summary> /// <param name="element">L'élément à ajouter.</param> public void Add(Element element) { Elements.Add(element); }
/// <summary> /// Adds a new PageRefField /// </summary> public void Add(PageRefField pageRefField) { Elements.Add(pageRefField); }
/// <summary> /// Adds a new barcode to the header or footer. /// </summary> public void Add(Barcode barcode) { Elements.Add(barcode); }
/// <summary> /// Adds a new SectionPagesField /// </summary> public void Add(SectionPagesField sectionPagesField) { Elements.Add(sectionPagesField); }
public void Add(TEntity item) { Elements.Add(item); }
/// <summary> /// Adds a new InfoField /// </summary> public void Add(InfoField infoField) { Elements.Add(infoField); }
private Elements GetLinks(bool inward,bool outward) { Elements elements = new Elements(); foreach (Line line in Lines.Values) { //Set the start and end shape if (inward && line.End.DockedElement == Start && !elements.Contains(line.Key)) elements.Add(line.Key,line); if (outward && line.Start.DockedElement == Start && !elements.Contains(line.Key)) elements.Add(line.Key,line); } return elements; }