private void OnVertexImported(NDataSourceImporter importer, NShape shape, INDataRecord dataRecord) { // Create a shape to host in the group based on the value of the "Type" column NShape innerShape = null; switch (dataRecord.GetColumnValue("Type").ToString()) { case "DB": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.Binder); break; case "File": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.SimpleFolder); break; case "Report": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.BlankFile); break; } innerShape.Text = dataRecord.GetColumnValue("Id").ToString(); // Host the created shape in the group NGroup group = (NGroup)shape; group.Shapes.AddChild(innerShape); group.UpdateModelBounds(); }
private void InitDocument(NDrawingDocument document) { document.Width = 650; document.Height = 650; // Create the A group NGroup groupA = CreateGroup("A"); groupA.Location = new NPointF(10, 10); document.ActiveLayer.AddChild(groupA); // Create the B group NGroup groupB = CreateGroup("B"); groupB.Location = new NPointF(10, 350); document.ActiveLayer.AddChild(groupB); // Connect some shapes NGroup subgroupA1 = (NGroup)groupA.Shapes.GetChildAt(0); NShape shapeA1a = (NShape)subgroupA1.Shapes.GetChildAt(0); NGroup subgroupA2 = (NGroup)groupA.Shapes.GetChildAt(1); NShape shapeA2a = (NShape)subgroupA2.Shapes.GetChildAt(0); Connect(shapeA1a, shapeA2a); NGroup subgroupB2 = (NGroup)groupB.Shapes.GetChildAt(1); NShape shapeB2a = (NShape)subgroupB2.Shapes.GetChildAt(0); Connect(shapeA2a, shapeB2a); }
private void CreateGroup(int row, int col, AbilitiesMask protection) { // create a group NGroup group = new NGroup(); group.Protection = new NAbilities(protection); // add two rectangle shapes in it group.Shapes.AddChild(new NRectangleShape(new NRectangleF(0, 0, 1, 1))); group.Shapes.AddChild(new NRectangleShape(new NRectangleF(2, 2, 1, 1))); // update the group model bounds to fit the shapes group.UpdateModelBounds(); // transform the group to fit in the specified bounds group.Bounds = base.GetGridCell(row, col); // create the labels shape element group.CreateShapeElements(ShapeElementsMask.Labels); // create the default label NRotatedBoundsLabel label = new NRotatedBoundsLabel("", group.UniqueId, new Nevron.Diagram.NMargins(0)); group.Labels.AddChild(label); group.Labels.DefaultLabelUniqueId = label.UniqueId; // assign text to the group group.Text = "Protected from: " + protection.ToString(); // add the group to the active layer document.ActiveLayer.AddChild(group); }
protected NRectangleShape[,] GetLifeMap(NStateObject state) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; m_Map = new NRectangleShape[boardCellCountWidth, boardCellCountHeight]; NGroup cellsGroup = diagramState.Document.ActiveLayer.GetChildByName("cellsGroup", 0) as NGroup; NShapeCollection children = cellsGroup.Shapes; if (m_MapShapeIds != null) { m_HasReinitialized = false; for (int x = 0; x < boardCellCountWidth; x++) { for (int y = 0; y < boardCellCountHeight; y++) { m_Map[x, y] = children.GetChildFromUniqueId(m_MapShapeIds[x, y]) as NRectangleShape; } } return(m_Map); } m_MapShapeIds = new Guid[boardCellCountWidth, boardCellCountHeight]; foreach (NRectangleShape cell in children) { string[] tokens = cell.Name.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); int x = int.Parse(tokens[0]); int y = int.Parse(tokens[1]); m_Map[x, y] = cell; m_MapShapeIds[x, y] = cell.UniqueId; } ApplyConfigurationCoordinates(m_Map, initialConfigurationCoordinates); m_HasReinitialized = true; return(m_Map); }
private NGroup CreateElement(string text) { NGroup group = new NGroup(); document.ActiveLayer.AddChild(group); // Create the text shape NTextShape textShape = new NTextShape(text, 0, 0, 1, 1); group.Shapes.AddChild(textShape); textShape.SizeToText(new NMarginsF(10, 2, 10, 2)); // Create the line shape under the text NRectangleF rect = textShape.Bounds; NLineShape lineShape = new NLineShape(rect.X, rect.Bottom, rect.Right, rect.Bottom); group.Shapes.AddChild(lineShape); // Create the ports CreatePorts(group, lineShape); // Set the protections SetProtections(group); group.UpdateModelBounds(); return(group); }
private NGroup CreateStartElement(string text) { NGroup group = new NGroup(); document.ActiveLayer.AddChild(group); // Create the ellipse shape NShape ellipseShape = new NEllipseShape(0, 0, 1, 1); group.Shapes.AddChild(ellipseShape); ellipseShape.Text = text; ellipseShape.SizeToText(new NMarginsF(100, 18, 10, 18)); ellipseShape.Location = new NPointF(0, 0); // Create the check shape NBrainstormingShapesFactory brainstormingFactory = new NBrainstormingShapesFactory(document); NShape checkShape = brainstormingFactory.CreateShape(BrainstormingShapes.Check); checkShape.Bounds = new NRectangleF(26, 12, 24, 23); group.Shapes.AddChild(checkShape); // Create the ports CreatePorts(group, ellipseShape); // Set the protections SetProtections(group); group.UpdateModelBounds(); return(group); }
private NGroup CreateGroup(string name) { NGroup group = new NGroup(); group.Name = name; // Create 2 subgroups NGroup subGroup1 = CreateSubgroup(name + "1"); subGroup1.Location = new NPointF(20, 0); group.Shapes.AddChild(subGroup1); NGroup subGroup2 = CreateSubgroup(name + "2"); subGroup2.Location = new NPointF(260, 0); group.Shapes.AddChild(subGroup2); // Create the decorators CreateDecorators(group, group.Name + " Group"); // Update the model bounds so that the subgroups are inside the specified padding group.Padding = new Nevron.Diagram.NMargins(5, 5, 30, 5); group.UpdateModelBounds(); group.AutoUpdateModelBounds = true; return(group); }
private void CreateGroup(int row, int col, Color color) { string transactionName = color.ToString().Replace("Color [", string.Empty).Replace("]", string.Empty) + " group"; // start transaction document.StartTransaction(transactionName); // create the shapes in the group NPolygonShape polygon = new NPolygonShape(base.GetRandomPoints(base.GetGridCell(row, col), 6)); NClosedCurveShape curve = new NClosedCurveShape(base.GetRandomPoints(base.GetGridCell(row, col + 1), 6), 1); NTextShape text = new NTextShape(transactionName, base.GetGridCell(row, col, 0, 1)); // create the group NGroup group = new NGroup(); group.Shapes.AddChild(polygon); group.Shapes.AddChild(curve); group.Shapes.AddChild(text); group.UpdateModelBounds(); // apply styles to it group.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, color)); group.Style.StrokeStyle = new NStrokeStyle(1, color); group.Style.TextStyle = new NTextStyle(new Font("Arial", 10), color); group.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom; // add the group to the active layer document.ActiveLayer.AddChild(group); // commit the transaction document.HistoryService.Commit(); }
public override NShape CreateShape(int index) { NGroup group = new NGroup(); CreateCenterAndSidesPorts(group); return(group); }
private void UpdateControlsState() { // handle single selected node only if (view.Selection.NodesCount != 1) { groupPropertiesGroup.Enabled = false; shapePropertiesGroup.Enabled = false; return; } // if the selected node is a group -> update group controls NGroup group = (view.Selection.AnchorNode as NGroup); if (group != null) { groupPropertiesGroup.Enabled = true; shapePropertiesGroup.Enabled = false; autoUpdateModelBoundsCheckBox.Checked = group.AutoUpdateModelBounds; resizeAggregatedModelsComboBox.SelectedItem = group.ResizeAggregatedModels; return; } // if the selected node is a simple shape -> update shape controls NShape shape = (view.Selection.AnchorNode as NShape); if (shape != null) { groupPropertiesGroup.Enabled = false; shapePropertiesGroup.Enabled = true; resizeInAggregateComboBox.SelectedItem = shape.ResizeInAggregate; return; } }
private void InitDocument() { Color color1 = Color.FromArgb(25, 0, 0xaa, 0xaa); Color color2 = Color.FromArgb(150, 0, 0, 204); NGroup group = new NGroup(); // create the group frame NRectangleF bounds = base.GetGridCell(0, 0, 2, 3); NRectangleShape frame = new NRectangleShape(bounds); frame.Protection = new NAbilities(AbilitiesMask.Select); frame.Style.FillStyle = new NColorFillStyle(color1); group.Shapes.AddChild(frame); // add some shape to the group group.Shapes.AddChild(new NRectangleShape(base.GetGridCell(0, 2))); group.Shapes.AddChild(new NEllipseShape(base.GetGridCell(0, 3))); group.Shapes.AddChild(new NTextShape("Parent group", GetGridCell(2, 0, 0, 3))); // add the child group in the group group.Shapes.AddChild(CreateChildGroup()); // update the group model bounds group.UpdateModelBounds(); // apply styles to the group group.Style.FillStyle = new NColorFillStyle(color2); group.Style.StrokeStyle = new NStrokeStyle(color2); group.Style.TextStyle = new NTextStyle(new Font("Arial", 10), color2); // add the parent group to the active layer document.ActiveLayer.AddChild(group); }
private NGroup CreateSubgroup(string name) { NGroup subgroup = new NGroup(); subgroup.Name = name; // Create 2 shapes NShape shape1 = CreateShape(name + "a"); shape1.Location = new NPointF(0, 0); subgroup.Shapes.AddChild(shape1); NShape shape2 = CreateShape(name + "b"); shape2.Location = new NPointF(110, 110); subgroup.Shapes.AddChild(shape2); // Create the decorators CreateDecorators(subgroup, subgroup.Name + " Subgroup"); // Update the model bounds so that the shapes are inside the specified padding subgroup.Padding = new Nevron.Diagram.NMargins(5, 5, 30, 5); subgroup.UpdateModelBounds(); return(subgroup); }
protected NGroup CreateChildGroup() { Color color1 = Color.FromArgb(25, 0, 0xbb, 0xbb); Color color2 = Color.FromArgb(150, 0, 204, 0); NGroup group = new NGroup(); // create the group frame NRectangleF bounds = base.GetGridCell(0, 0, 1, 1); NRectangleShape frame = new NRectangleShape(bounds); frame.Protection = new NAbilities(AbilitiesMask.Select); frame.Style.FillStyle = new NColorFillStyle(color1); group.Shapes.AddChild(frame); // create the group shapes group.Shapes.AddChild(new NRectangleShape(base.GetGridCell(0, 0))); group.Shapes.AddChild(new NEllipseShape(base.GetGridCell(0, 1))); group.Shapes.AddChild(new NTextShape("Child group", base.GetGridCell(1, 0, 0, 1))); // update the group model bounds group.UpdateModelBounds(); // apply styles to the group group.Style.FillStyle = new NColorFillStyle(color2); group.Style.StrokeStyle = new NStrokeStyle(1, color2); group.Style.TextStyle = new NTextStyle(new Font("Arial", 10), color2); return(group); }
public ActionResult DeleteConfirmed(int id) { NGroup nGroup = db.NGroups.Find(id); db.NGroups.Remove(nGroup); db.SaveChanges(); return(RedirectToAction("Index")); }
private void ConnectComputers(NShape fromComputer, NShape toComputer, NGroup group) { NLineShape line = new NLineShape(); group.Shapes.AddChild(line); line.FromShape = fromComputer; line.ToShape = toComputer; }
private void ConnectNetworks(NGroup fromNetwork, NGroup toNetwork) { NLineShape line = new NLineShape(); document.ActiveLayer.AddChild(line); line.FromShape = fromNetwork; line.ToShape = toNetwork; }
private void ConnectComputers(NShape fromComputer, NShape toComputer, NGroup group) { NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory(); NShape lineShape = connectorShapes.CreateShape((int)ENConnectorShape.Line); lineShape.GlueBeginToShapeBoxIntersection(fromComputer); lineShape.GlueEndToShapeBoxIntersection(toComputer); group.Shapes.Add(lineShape); }
private void AddShowHideSubtree(NGroup group) { group.CreateShapeElements(ShapeElementsMask.Decorators); NShowHideSubtreeDecorator decorator = new NShowHideSubtreeDecorator(); decorator.Offset = new NSizeF(group.Width - decorator.Size.Width / 2, -group.Height / 2); decorator.Background.Shape = ToggleDecoratorBackgroundShape.Ellipse; group.Decorators.AddChild(decorator); }
private void ConnectNetworks(NGroup fromNetwork, NGroup toNetwork) { NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory(); NShape lineShape = connectorShapes.CreateShape((int)ENConnectorShape.Line); lineShape.GlueBeginToShape(fromNetwork); lineShape.GlueEndToShape(toNetwork); m_DrawingDocument.Content.ActivePage.Items.Add(lineShape); }
protected override void InitDiagram() { base.InitDiagram(); // Create a group NGroup group = new NGroup(); m_DrawingDocument.Content.ActivePage.Items.Add(group); group.PinX = 300; group.PinY = 300; // Create some shapes and add them to the group NBasicShapeFactory factory = new NBasicShapeFactory(); NShape root = factory.CreateShape(ENBasicShape.Rectangle); root.Text = "Root"; group.Shapes.Add(root); NShape shape1 = factory.CreateShape(ENBasicShape.Circle); shape1.Text = "Circle 1"; group.Shapes.Add(shape1); NShape shape2 = factory.CreateShape(ENBasicShape.Circle); shape2.Text = "Circle 2"; group.Shapes.Add(shape2); NShape shape3 = factory.CreateShape(ENBasicShape.Circle); shape3.Text = "Circle 3"; group.Shapes.Add(shape3); // Connect the shapes ConnectShapes(root, shape1); ConnectShapes(root, shape2); ConnectShapes(root, shape3); // Update group bounds group.UpdateBounds(); // Create a layout context and configure the area you want the group to be arranged in. // The layout area is in page coordinates NDrawingLayoutContext layoutContext = new NDrawingLayoutContext(m_DrawingDocument, group); layoutContext.LayoutArea = new NRectangle(100, 100, 200, 200); // Layout the shapes in the group NRadialGraphLayout layout = new NRadialGraphLayout(); layout.Arrange(group.Shapes.ToArray(), layoutContext); // Update the group bounds group.UpdateBounds(); }
private void CreateGroupPorts(NGroup group) { group.CreateShapeElements(ShapeElementsMask.Ports); // create a dynamic port anchored to the center of the shape NRotatedBoundsPort port = new NRotatedBoundsPort(new NContentAlignment(ContentAlignment.TopCenter)); port.Name = "port"; group.Ports.AddChild(port); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; document.GraphicsSettings.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; document.GraphicsSettings.SmoothingMode = SmoothingMode.HighQuality; document.GraphicsSettings.PixelOffsetMode = PixelOffsetMode.HighQuality; // set up visual formatting document.Style.FillStyle = new NColorFillStyle(Color.Linen); document.BackgroundStyle.FrameStyle.Visible = false; // Create the shapes NGroup startElement = CreateStartElement("Alcohol Induced Persisting Dementia"); NGroup element1 = CreateElement("Prevalence: 7% with ETOH Dependence"); NGroup element2 = CreateElement("Presentation"); NGroup element3 = CreateElement("Physical Etiology"); NGroup element21 = CreateElement("Less likely to demonstrate aphasia"); NGroup element22 = CreateElement("Visuospatial Deficits"); NGroup element23 = CreateElement("Executive Dysfunction"); NGroup element24 = CreateElement("Memory impairment"); NGroup element25 = CreateElement("Similar to Dementia due to GMC"); NGroup element31 = CreateElement("liver cirrhosis"); NGroup element32 = CreateElement("Wernicke's Encephalopathy"); NGroup element33 = CreateElement("Trauma (head trauma)"); NGroup element34 = CreateElement("vitamin deficiency (Thiamine)"); NGroup element35 = CreateElement("malnutrition"); NGroup element36 = CreateElement("Frontal lobe atrophy"); // Connect the shapes ConnectElements(startElement, element1); ConnectElements(startElement, element2); ConnectElements(startElement, element3); ConnectElements(element2, element21); ConnectElements(element2, element22); ConnectElements(element2, element23); ConnectElements(element2, element24); ConnectElements(element2, element25); AddShowHideSubtree(element2); ConnectElements(element3, element31); ConnectElements(element3, element32); ConnectElements(element3, element33); ConnectElements(element3, element34); ConnectElements(element3, element35); ConnectElements(element3, element36); AddShowHideSubtree(element3); // Layout the shapes DoLayout(); }
private void ConnectShapes(NShape shape1, NShape shape2) { NGroup group = shape1.OwnerGroup; NRoutableConnector connector = new NRoutableConnector(); connector.UserClass = NDR.StyleSheetNameConnectors; group.Shapes.Add(connector); connector.GlueBeginToShape(shape1); connector.GlueEndToShape(shape2); }
public ActionResult Edit([Bind(Include = "GroupID,GroupName,GroupIcon,classID,subID")] NGroup nGroup) { if (ModelState.IsValid) { db.Entry(nGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.classID = new SelectList(db.Classes, "classID", "ClassName", nGroup.classID); ViewBag.subID = new SelectList(db.Subjects, "SubID", "SubName", nGroup.subID); return(View(nGroup)); }
private NGroup CreateGroup(string name) { NGroup group = new NGroup(); group.Name = name; document.ActiveLayer.AddChild(group); CreateTree(group); CreateGroupPorts(group); group.UpdateModelBounds(); return(group); }
protected NGroup CreateCartesianScaleGroup() { NGroup group = new NGroup(); // rect 1 uses cartesian scaling NRectangleShape rect1 = new NRectangleShape(0, 0, 75, 75); rect1.Rotate(CoordinateSystem.Scene, 45, rect1.PinPoint); rect1.ResizeInAggregate = ResizeInAggregate.CartesianScale; rect1.Text = "Cartesian Scale"; group.Shapes.AddChild(rect1); // rect 2 uses cartesian X scaling and Y reposition NRectangleShape rect2 = new NRectangleShape(150, 0, 75, 75); rect2.Rotate(CoordinateSystem.Scene, 45, rect2.PinPoint); rect2.ResizeInAggregate = ResizeInAggregate.CartesianScaleXRepositionY; rect2.Text = "Cartesian Scale X and Reposition Y"; group.Shapes.AddChild(rect2); // rect 3 uses cartesian Y scaling and X reposition NRectangleShape rect3 = new NRectangleShape(0, 150, 75, 75); rect3.Rotate(CoordinateSystem.Scene, 45, rect3.PinPoint); rect3.ResizeInAggregate = ResizeInAggregate.CartesianScaleYRepositionX; rect3.Text = "Cartesian Scale Y and Reposition X"; group.Shapes.AddChild(rect3); // rect 4 uses cartesian scale and reposition NRectangleShape rect4 = new NRectangleShape(150, 150, 75, 75); rect4.Rotate(CoordinateSystem.Scene, 45, rect4.PinPoint); rect4.ResizeInAggregate = ResizeInAggregate.CartesianScaleAndReposition; rect4.Text = "Cartesian Scale and Reposition"; group.Shapes.AddChild(rect4); // update the group model bounds group.UpdateModelBounds(); // in order to demonstrate the reposition, all shapes // are pinned to the bottom rigth corner of the group NPointF pin = new NPointF(group.Bounds.Right, group.Bounds.Bottom); foreach (NShape shape in group.Shapes) { shape.PinPoint = pin; } // add the group to the active layer document.ActiveLayer.AddChild(group); return(group); }
private void InitDocument() { // create networks NGroup network1 = CreateNetwork(new NPointF(200, 20), "Network 1"); NGroup network2 = CreateNetwork(new NPointF(400, 250), "Network 2"); NGroup network3 = CreateNetwork(new NPointF(20, 250), "Network 3"); NGroup network4 = CreateNetwork(new NPointF(200, 400), "Network 4"); // connect networks ConnectNetworks(network1, network2); ConnectNetworks(network1, network3); ConnectNetworks(network1, network4); }
// GET: NGroups/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NGroup nGroup = db.NGroups.Find(id); if (nGroup == null) { return(HttpNotFound()); } return(View(nGroup)); }
private NRoutableConnector ConnectElements(NGroup from, NGroup to) { NRoutableConnector line = new NRoutableConnector(); document.ActiveLayer.AddChild(line); NPort fromPort = (NPort)from.Ports.GetChildByName("RightPort"); NPort toPort = (NPort)to.Ports.GetChildByName("LeftPort"); line.StartPlug.Connect(fromPort); line.EndPlug.Connect(toPort); return(line); }
protected NNodeList GetAllCells(NStateObject state) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NNodeList list = new NNodeList(); NGroup cellsGroup = diagramState.Document.ActiveLayer.GetChildByName("cellsGroup", 0) as NGroup; foreach (INNode node in cellsGroup.Shapes) { list.Add(node); } return(list); }