private string GetElementTypeName(PartElement element) { switch (element) { case PartSurface _: return(ModelLocalizations.Label_Surface); case PartBone _: return(ModelLocalizations.Label_Bone); case MaleStudModel _: return(ModelLocalizations.ModelComponentType_MaleStud); case FemaleStudModel _: return(ModelLocalizations.ModelComponentType_FemaleStud); case BrickTubeModel _: return(ModelLocalizations.ModelComponentType_BrickTube); case PartModel _: return(ModelLocalizations.ModelComponentType_Part); case ModelMeshReference _: return(ModelLocalizations.Label_Mesh); case PartConnection _: return(ModelLocalizations.Label_Connection); case PartCollision _: return(ModelLocalizations.Label_Collision); } return(element.GetType().Name); }
public static PartElement Field(this PartElement me, string label, int length, string id = "*") { me?.Fields.Add(new FieldElement { Label = label, Length = length, Id = id }); return(me); }
private void FillSelectionDetails(PartElement selection) { if (SelectedElement != null) { SelectedElement.PropertyChanged -= SelectedElement_PropertyChanged; SelectedElement = null; } using (FlagManager.UseFlag("FillSelectionDetails")) { FillElementProperties(selection); if (ProjectManager.SelectedElements.Count > 1) { FillStudRefDetails(null); } else { FillStudRefDetails(selection as PartCullingModel); } SelectedElement = selection; if (SelectedElement != null) { SelectedElement.PropertyChanged += SelectedElement_PropertyChanged; } } }
public ElementCollectionNode(PartElement element, IElementCollection collection, string text) { Element = element; Collection = collection; NodeID = collection.GetHashCode().ToString(); Text = text; }
public static void Run() { // ExStart:CreateStructureElements // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Grouping Elements PartElement partElement = taggedContent.CreatePartElement(); ArtElement artElement = taggedContent.CreateArtElement(); SectElement sectElement = taggedContent.CreateSectElement(); DivElement divElement = taggedContent.CreateDivElement(); BlockQuoteElement blockQuoteElement = taggedContent.CreateBlockQuoteElement(); CaptionElement captionElement = taggedContent.CreateCaptionElement(); TOCElement tocElement = taggedContent.CreateTOCElement(); TOCIElement tociElement = taggedContent.CreateTOCIElement(); IndexElement indexElement = taggedContent.CreateIndexElement(); NonStructElement nonStructElement = taggedContent.CreateNonStructElement(); PrivateElement privateElement = taggedContent.CreatePrivateElement(); // Create Text Block-Level Structure Elements ParagraphElement paragraphElement = taggedContent.CreateParagraphElement(); HeaderElement headerElement = taggedContent.CreateHeaderElement(); HeaderElement h1Element = taggedContent.CreateHeaderElement(1); // Create Text Inline-Level Structure Elements SpanElement spanElement = taggedContent.CreateSpanElement(); QuoteElement quoteElement = taggedContent.CreateQuoteElement(); NoteElement noteElement = taggedContent.CreateNoteElement(); // Create Illustration Structure Elements FigureElement figureElement = taggedContent.CreateFigureElement(); FormulaElement formulaElement = taggedContent.CreateFormulaElement(); // Methods are under development ListElement listElement = taggedContent.CreateListElement(); TableElement tableElement = taggedContent.CreateTableElement(); ReferenceElement referenceElement = taggedContent.CreateReferenceElement(); BibEntryElement bibEntryElement = taggedContent.CreateBibEntryElement(); CodeElement codeElement = taggedContent.CreateCodeElement(); LinkElement linkElement = taggedContent.CreateLinkElement(); AnnotElement annotElement = taggedContent.CreateAnnotElement(); RubyElement rubyElement = taggedContent.CreateRubyElement(); WarichuElement warichuElement = taggedContent.CreateWarichuElement(); FormElement formElement = taggedContent.CreateFormElement(); // Save Tagged Pdf Document document.Save(dataDir + "StructureElements.pdf"); // ExEnd:CreateStructureElements }
public static PartElement Constant(this PartElement me, string label, int length, string value) { me?.Fields.Add(new ConstantElement { Label = label, Value = value }); return(me); }
public ProjectElementNode(PartElement element) { Element = element; NodeID = element.ID; if (string.IsNullOrEmpty(NodeID)) { NodeID = element.GetHashCode().ToString(); } }
public static PartElement Part(this PartCollection me, string id) { var p = new PartElement { Id = id }; me?.Add(p); return(p); }
public static SwitchElement Switch(this PartElement me, string label, string on) { var sw = new SwitchElement { Label = label, On = on }; me?.Fields.Add(sw); return(sw); }
public static LoopElement Loop(this PartElement me, string label, string from, string to, string step = "1") { var loop = new LoopElement { Label = label, From = from, To = to, Step = step }; me?.Fields.Add(loop); return(loop); }
public static GroupElement Group(this PartElement me, string label) { var group = new GroupElement { Label = label }; me?.Fields.Add(group); return(group); }
private void RefreshElementName(PartElement element) { var elemNode = FindElementNode(element); if (elemNode != null) { elemNode.Text = element.Name; ProjectTreeView.RefreshObject(elemNode); } }
private void DeserializeBaseElement(PartElement element, XElement xml) { if (xml.HasAttribute("ID", out XAttribute idAttr)) { element.ID = idAttr.Value; } if (xml.HasAttribute("Name", out XAttribute nameAttr)) { element.InternalSetName(nameAttr.Value); } }
protected PartElementModel(PartElement element) { Element = element; Element.PropertyChanged += Element_PropertyChanged; ModelExtension = element.GetExtension <ModelElementExtension>(); if (ModelExtension != null) { Visible = ModelExtension.IsVisible; ModelExtension.VisibilityChanged += Extender_VisibilityChanged; } }
private void SelectElementNodeDelayed(PartElement element) { BeginInvoke((Action)(() => { var elementNode = FindElementNode(element); if (elementNode.Parent != null) { ProjectTreeView.Expand(elementNode.Parent); } using (FlagManager.UseFlag("ManualSelect")) ProjectTreeView.SelectObject(elementNode); })); }
public override void FreeObjects() { base.FreeObjects(); if (Element != null) { var modelExtension = GetElementExtension <ModelElementExtension>(); if (modelExtension != null) { modelExtension.VisibilityChanged -= ModelExtension_VisibilityChanged; } Element.ParentChanged -= Element_ParentChanged; Element = null; } }
protected XElement SerializeBaseElement(PartElement element, string elementName) { var elem = new XElement(elementName); if (!string.IsNullOrEmpty(element.ID)) { elem.Add(new XAttribute("ID", element.ID)); } if (!string.IsNullOrEmpty(element.Name)) { elem.Add(new XAttribute("Name", element.Name)); } return(elem); }
public ProjectElementNode(PartElement element) { Element = element; NodeID = element.ID; if (string.IsNullOrEmpty(NodeID)) { NodeID = element.GetHashCode().ToString(); } Element.ParentChanged += Element_ParentChanged; var modelExtension = GetElementExtension <ModelElementExtension>(); if (modelExtension != null) { modelExtension.VisibilityChanged += ModelExtension_VisibilityChanged; } }
protected PartElementModel(PartElement element) { Element = element; Element.PropertyChanged += Element_PropertyChanged; ModelExtension = element.GetExtension <ModelElementExtension>(); if (ModelExtension != null) { Visible = ModelExtension.IsVisible; ModelExtension.VisibileChanged += Extender_VisibileChanged; } Element.ParentChanging += Element_ParentChanging; Element.ParentChanged += Element_ParentChanged; Element_ParentChanged(null, EventArgs.Empty); }
public XElement ToXML() { XElement xOutputDocumentClass = new XElement(Fb2Const.fb2DefaultNamespace + OutputDocumentElementName); xOutputDocumentClass.Add(new XAttribute("name", Name)); if (Create != GenerationInstructionEnum.Unknown) { xOutputDocumentClass.Add(new XAttribute("create", GetXCreate())); } if (Price != null) { xOutputDocumentClass.Add(new XAttribute("price", Price.ToString())); } foreach (ShareInstructionType PartElement in parts) { xOutputDocumentClass.Add(PartElement.ToXML()); } return(xOutputDocumentClass); }
private string GetElementTypeName2(PartElement element) { if (element is PartSurface) { return(ModelLocalizations.Label_Surface); } switch (element) { case PartSurface _: return(ModelLocalizations.Label_Surface); case PartBone _: return(ModelLocalizations.Label_Bone); case MaleStudModel _: return(ModelLocalizations.ModelComponentType_MaleStud); case FemaleStudModel _: return(ModelLocalizations.ModelComponentType_FemaleStud); case BrickTubeModel _: return(ModelLocalizations.ModelComponentType_BrickTube); case PartModel _: return(ModelLocalizations.ModelComponentType_Part); case ModelMeshReference _: return(ModelLocalizations.Label_Mesh); case PartConnection conn: return($"{ModelLocalizations.Label_Connection} <{conn.ConnectorType.ToString()}>"); //return ModelLocalizations.ResourceManager.GetString($"ConnectorType_{conn.ConnectorType}"); case PartCollision coll: string collType = ModelLocalizations.ResourceManager.GetString($"CollisionType_{coll.CollisionType}"); return($"{ModelLocalizations.Label_Collision} ({collType})"); } return(element.GetType().Name); }
public static ProjectElementNode CreateDefault(PartElement element) { var node = new ProjectElementNode(element); if (element is PartSurface surface) { if (surface.SurfaceID == 0) { node.Text = ModelLocalizations.Label_MainSurface; node.ImageKey = "Surface_Main"; } else { node.Text = string.Format(ModelLocalizations.Label_DecorationSurfaceNumber, surface.SurfaceID); node.ImageKey = "Surface_Decoration"; } } else { node.Text = element.Name; if (element is SurfaceComponent component) { node.ImageKey = $"Model_{component.ComponentType}"; } else if (element is PartConnection connection) { node.ImageKey = $"Connection_{connection.ConnectorType}"; } else if (element is PartCollision collision) { node.ImageKey = $"Collision_{collision.CollisionType}"; } else if (element is ModelMeshReference || element is ModelMesh) { node.ImageKey = "Mesh"; } } return(node); }
public BoneElementExtension(PartElement element) : base(element) { }
public ProjectElementNode FindElementNode(PartElement element) { return(GetAllTreeNodes().OfType <ProjectElementNode>() .FirstOrDefault(x => x.Element == element)); }
public PartElementModel GetElementModel(PartElement element) { return(Models.OfType <PartElementModel>().FirstOrDefault(x => x.Element == element)); }
private void FillElementProperties(PartElement element) { ToggleControlsEnabled(element != null, NameTextBox, NameLabel); NameTextBox.Text = element?.Name ?? string.Empty; SubMaterialIndexLabel.Visible = element is PartSurface; SubMaterialIndexBox.Visible = element is PartSurface; CollisionRadiusLabel.Visible = element is PartSphereCollision; CollisionRadiusBox.Visible = element is PartSphereCollision; CollisionSizeLabel.Visible = element is PartBoxCollision; CollisionSizeEditor.Visible = element is PartBoxCollision; if (SelectionTransformEdit.Tag != null) { SelectionTransformEdit.BindPhysicalElement(null); } if (element != null) { SelectionInfoLabel.Text = GetElementTypeName(element); switch (element) { case PartSurface surface: SubMaterialIndexBox.Value = surface.SubMaterialIndex; break; case PartBoxCollision boxCollision: CollisionSizeEditor.Value = boxCollision.Size * 2d; break; case PartSphereCollision sphereCollision: CollisionRadiusBox.Value = sphereCollision.Radius; break; } } else { if (ProjectManager.SelectedElements.Count > 1) { SelectionInfoLabel.Text = MultiSelectionMsg.Text; } else { SelectionInfoLabel.Text = NoSelectionMsg.Text; } } if (element is IPhysicalElement physicalElement) { SelectionTransformEdit.BindPhysicalElement(physicalElement); SelectionTransformEdit.Tag = physicalElement; SelectionTransformEdit.Enabled = true; } else { SelectionTransformEdit.Enabled = false; } }