public HierarchyCollection<Heading> GetHeadingHierarchy(string html) { var hierarchy = new HierarchyCollection<Heading>(); var headingsStack = new Stack<HierarchyItem<Heading>>(); foreach (var heading in GetHeadings(html)) { var hiearchyItem = new HierarchyItem<Heading>(heading); var addedItem = false; while (headingsStack.Count > 0) { // Keep looking up the heading hierarchy until we find the // first item that is a higher heading type than the current // heading var parentHeading = headingsStack.Peek(); if (parentHeading.Item.HeadingType < heading.HeadingType) { headingsStack.Push(hiearchyItem); parentHeading.Children.Add(hiearchyItem); addedItem = true; break; } headingsStack.Pop(); } if (!addedItem) { headingsStack.Push(hiearchyItem); hierarchy.Add(hiearchyItem); } } return hierarchy; }
private CubeMetadata BuildFakeMetadata() { var metadata = new CubeMetadata(); var p = new Perspective("p"); var mg = new MeasureGroup("mg"); var h1 = new Hierarchy("[h1]", "h1", "df"); var h2 = new Hierarchy("[h2]", "h2", "df"); var hs = new HierarchyCollection(); hs.Add(h1); hs.Add(h2); var d = new Dimension("[d]", "d", hs); mg.LinkedDimensions.Add(d); var m1 = new Measure("[m1]", "m1", "df"); var m2 = new Measure("[m2]", "m2", "df"); mg.Measures.Add(m1); mg.Measures.Add(m2); p.MeasureGroups.Add(mg); metadata.Perspectives.Add(p); return metadata; }
public new HierarchyCollection List(IEnumerable<IFilter> filters) { var hierarchies = new HierarchyCollection(); var rows = Discover(filters); foreach (var row in rows) hierarchies.AddOrIgnore(row.UniqueName, row.Caption, row.DisplayFolder); return hierarchies; }
public string BuildTableOfContents(HierarchyCollection<Heading> headings) { if (headings == null || !headings.Any()) return String.Empty; var tableOfContents = new StringBuilder(); StartTableOfContents(tableOfContents); BuildTableOfContentsLayer(tableOfContents, headings); EndTableOfContents(tableOfContents); return tableOfContents.ToString(); }
public virtual void BuildTableOfContentsLayer(StringBuilder builder, HierarchyCollection<Heading> hierarchyItems) { if (hierarchyItems == null || !hierarchyItems.Any()) return; if (builder == null) throw new ArgumentNullException("builder"); StartHierarchyList(builder); foreach (var hierarchyItem in hierarchyItems) BuildTableOfContentsItem(builder, hierarchyItem); EndHierarchyList(builder); }
public Dimension(string uniqueName, string caption) { UniqueName = uniqueName; Caption = caption; Hierarchies = new HierarchyCollection(); }
public Dimension(string uniqueName, string caption, HierarchyCollection hierarchies) { UniqueName = uniqueName; Caption = caption; Hierarchies = hierarchies; }
public void ClearAllElements() { collection = new HierarchyCollection(); }
private void Visualize(HierarchyCollection collection) { designer1.Document.SelectAllElements(); designer1.Document.DeleteSelectedElements(); designer1.Document.ClearSelection(); ResetZoom(); int FeatureLineY = 50; int LibraryCategoryLineY = 150; int LibraryLineY = 250; int ElementDistance = 150; int count = 1; foreach (ComponentWrapper comp in collection.Librares) { LibraryWrapper LW = PK.Wrapper.FindLibrary(comp.Guid); if ((LW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.LibraryCategories) { LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(comp.Guid); if ((LCW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LCW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryCategoryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.Featuries) { FeatureWrapper FW = PK.Wrapper.FindFeature(comp.Guid); if ((FW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(FW.Name, comp.ComponentType, new Point(count * ElementDistance, FeatureLineY), comp); } count++; } foreach (HierarchyCollection.Link link in collection.Links) { MFRectangleNode StartNode = null; MFRectangleNode EndNode = null; foreach (BaseElement element in designer1.Document.Elements) { if (element.GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)element; if (link.StartComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) StartNode = RectNode; if (link.EndComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) EndNode = RectNode; } } if ((StartNode != null) && (EndNode != null)) { switch (link.Type) { case HierarchyCollection.Link.LINK_TYPE.Dependency: AddLinkElement("Depend", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Red,-10,-10); break; case HierarchyCollection.Link.LINK_TYPE.Realise: AddLinkElement("Realise", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Blue,-10,-10); break; case HierarchyCollection.Link.LINK_TYPE.Stub: AddLinkElement("Stub", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Black,10,10); break; case HierarchyCollection.Link.LINK_TYPE.Associate: AddLinkElement("Associate with", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Green,10,10); break; } } else { } } }
public ComponentReferencesDiagramForm() { InitializeComponent(); collection = new HierarchyCollection(); this.designer1.AutoScroll = true; this.designer1.DrawGrid = false; ClearAllElements(); ResetZoom(); lastZoom = toolStripZoomCB.Text; designer1.MouseWheel += new MouseEventHandler(designer1_MouseWheel); }
private void BindHierarchies(TreeNode dimNode, HierarchyCollection hierarchies) { if (hierarchies == null || hierarchies.Count == 0) return; foreach (var hierarchy in hierarchies) { string name = hierarchy.Name.Replace("$", ""); string caption = hierarchy.Caption.Replace("$", ""); TreeNode tempNode = new TreeNode(caption); tempNode.Name = name; tempNode.Tag = hierarchy; bool visible = hierarchy.Properties["HIERARCHY_IS_VISIBLE"].Value.Value<bool>(true); string key = hierarchy.Levels.Count > 2 ? "Hie" : "SingleHie"; tempNode.SelectedImageKey = tempNode.ImageKey = visible ? key : "" + key; tempNode.ToolTipText = string.Format("Hierarchy Name:[{0}]Caption:[{1}]", name, caption); BindLevels(tempNode, hierarchy.Levels); dimNode.Nodes.Add(tempNode); } dimNode.Collapse(); }
private void Page_Load(object sender, System.EventArgs e) { AdomdConnection conn = new AdomdConnection(ConfigurationSettings.AppSettings["adomdConn"]); conn.Open(); AdomdCommand comm = new AdomdCommand(@"SELECT {{[Age Range_Member].[Age Range].Members}*{[Gender_Employee].[Gender_Employee].Members}} on rows, {{[Measures].[Member Months],[Measures].[Allowed]} * {[Benefit Plan].[Benefit Plan Type].Members}} on columns from [RCBigMainCube]", conn); CellSet cst = comm.ExecuteCellSet(); CubeDef def = conn.Cubes["RCBigMainCube"]; conn.Close(); Dimension dim = def.Dimensions["Age Range_Member"]; StringBuilder str = new StringBuilder(), strTmp = new StringBuilder(); int axisRow = 1, axisCol = 0; int i, j, k; // indexers string tmpPrev, tmpCur; //temp string to hjold previous and current value HierarchyCollection rowHierarchy = cst.Axes[axisRow].Set.Hierarchies, colHierarchy = cst.Axes[axisCol].Set.Hierarchies; TupleCollection rowTuples = cst.Axes[axisRow].Set.Tuples, colTuples = cst.Axes[axisCol].Set.Tuples; int rowHierCnt = rowHierarchy.Count, colHierCnt = colHierarchy.Count, rowTuplCnt = colTuples.Count, colTuplCnt = colTuples.Count; str.Append("<table class=\"tableStyle\" cellspacing=\"0\">"); /********************************************Write the column header*************************************************/ /***************Write col dimensions*****************/ str.Append("<tr nowrap class=\"trStyle\">"); for (j = 0; j < rowHierCnt; j++) { str.Append("<td nowrap class=\"tdStyle\"> </td>"); } for (j = 0; j < colHierCnt; j++) { string dimName = colHierarchy[j].UniqueName; str.Append("<td nowrap class=\"thStyle\"><b>"); if ("Measures".Equals(dimName)) { str.Append(dimName); } else { str.Append(Regex.Match(colTuples[0].Members[j].LevelName, @"(?<=\]\.\[)[^\]]+(?=\]$)").Value); } str.Append("</b></td>"); } str.Append("</tr>"); /***************Write col dimensions*****************/ for (i = 0; i < colHierCnt; i++) { str.Append("<tr nowrap class=\"trStyle\">"); for (j = 0; j < rowHierCnt; j++) { str.Append("<td nowrap class=\"tdStyle\"> </td>"); } tmpPrev = string.Empty; for (k = 0; k < colTuplCnt; k++) { tmpCur = colTuples[k].Members[i].Caption; if (tmpPrev.Equals(tmpCur)) { tmpCur = " "; } else { tmpPrev = tmpCur; } strTmp.Append("<td nowrap class=\"thStyle\"><b>"); strTmp.Append(tmpCur); strTmp.Append("</b></td>"); } str.Append("</tr>"); } str.Append(strTmp.ToString()); /********************************************End of write the column header*************************************************/ for (i = 0; i < rowTuplCnt; i++) { str.Append("<tr nowrap class=\"trStyle\">"); tmpPrev = string.Empty; for (j = 0; j < rowHierCnt; j++) { tmpCur = rowTuples[i].Members[j].Caption; if (tmpPrev.Equals(tmpCur)) { tmpCur = " "; } else { tmpPrev = tmpCur; } str.Append("<td nowrap class=\"thStyle\"><b>"); str.Append(tmpCur); str.Append("</b></td>"); } for (k = 0; k < colTuplCnt; k++) { tmpCur = cst.Cells[k, i].FormattedValue; str.Append("<td nowrap class=\"tdStyle\">"); str.Append((tmpCur.Length == 0)?" " : tmpCur); str.Append("</td>"); } str.Append("</tr>"); } str.Append("<table/>"); Response.Write(str.ToString()); // conn.Close(); }
private void Visualize(HierarchyCollection collection) { designer1.Document.SelectAllElements(); designer1.Document.DeleteSelectedElements(); designer1.Document.ClearSelection(); ResetZoom(); int FeatureLineY = 50; int LibraryCategoryLineY = 150; int LibraryLineY = 250; int ElementDistance = 150; int count = 1; foreach (ComponentWrapper comp in collection.Librares) { LibraryWrapper LW = PK.Wrapper.FindLibrary(comp.Guid); if ((LW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.LibraryCategories) { LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(comp.Guid); if ((LCW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(LCW.Name, comp.ComponentType, new Point(count * ElementDistance, LibraryCategoryLineY), comp); } count++; } count = 1; foreach (ComponentWrapper comp in collection.Featuries) { FeatureWrapper FW = PK.Wrapper.FindFeature(comp.Guid); if ((FW != null) && (!string.IsNullOrEmpty(comp.Guid))) { AddNodeElement(FW.Name, comp.ComponentType, new Point(count * ElementDistance, FeatureLineY), comp); } count++; } foreach (HierarchyCollection.Link link in collection.Links) { MFRectangleNode StartNode = null; MFRectangleNode EndNode = null; foreach (BaseElement element in designer1.Document.Elements) { if (element.GetType() == typeof(MFRectangleNode)) { MFRectangleNode RectNode = (MFRectangleNode)element; if (link.StartComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) { StartNode = RectNode; } if (link.EndComponent.Guid.ToLower() == ((ComponentWrapper)RectNode.Tag).Guid.ToLower()) { EndNode = RectNode; } } } if ((StartNode != null) && (EndNode != null)) { switch (link.Type) { case HierarchyCollection.Link.LINK_TYPE.Dependency: AddLinkElement("Depend", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Red, -10, -10); break; case HierarchyCollection.Link.LINK_TYPE.Realise: AddLinkElement("Realise", StartNode, 4, LineCap.RoundAnchor, EndNode, 4, LineCap.ArrowAnchor, Color.Blue, -10, -10); break; case HierarchyCollection.Link.LINK_TYPE.Stub: AddLinkElement("Stub", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Black, 10, 10); break; case HierarchyCollection.Link.LINK_TYPE.Associate: AddLinkElement("Associate with", StartNode, 5, LineCap.RoundAnchor, EndNode, 5, LineCap.ArrowAnchor, Color.Green, 10, 10); break; } } else { } } }