public ShiftRegionWindow(SegmentRegion region) { HorizontalAlignment = HorizontalAlignment.Center; VerticalAlignment = VerticalAlignment.Center; Title = $"Shifting region {region.Name}"; _region = region; }
public RegionWindow(SegmentRegion region) { _region = region; Title = $"Editing region {_region.Name} ({_region.ID})"; VerticalAlignment = VerticalAlignment.Center; HorizontalAlignment = HorizontalAlignment.Center; }
public void Select(Rectangle selection, SegmentRegion region, bool modifySelection = false) { if (!modifySelection || region != Region) { Clear(); } Add(selection); if (modifySelection && Count > 1) { Clean(); } Region = region; }
protected override void OnInitialize() { base.OnInitialize(); _surface = this[1]; _lockers = this[2]; _legendsHall = this[9]; _dungeon1 = this[11]; _dungeon2 = this[12]; _dungeon3 = this[13]; _dungeon4 = this[14]; _ydnacLair = new LairSubregion("Ydnac's Lair") { { new Rectangle2D(139, 3, 2, 6, _surface) } }; _surface.Subregions.Add(_ydnacLair); _elderTrollCrypt = new LairSubregion("Troll Crypt") { new Rectangle2D(14, 25, 12, 13, _dungeon2) }; _elderTrollLair = new LairSubregion("Troll Lair") { { new Rectangle2D(15, 34, 4, 6, _dungeon1) } }; _dungeon1.Subregions.Add(_elderTrollCrypt); _dungeon1.Subregions.Add(_elderTrollLair); _dragonCrypt = new LairSubregion("Dragon's Crypt") { { new Rectangle2D(12, 2, 5, 5, _dungeon4) } }; _dragonLair = new LairSubregion("Dragon's Lair") { { new Rectangle2D(12, 2, 16, 5, _dungeon4) } }; _dungeon4.Subregions.Add(_dragonCrypt); _dungeon4.Subregions.Add(_dragonLair); _dungeon1.IsDungeon = _dungeon2.IsDungeon = _dungeon3.IsDungeon = _dungeon4.IsDungeon = true; }
public bool IsSelected(int x, int y, SegmentRegion region) { if (region != Region) { return(false); } foreach (var rectangle in this) { if (rectangle.Contains(x, y)) { return(true); } } return(false); }
/// <summary> /// Initialise /// </summary> private void Init() { segments = new TreeSegmenter<SolverNode>(tree, maxDepth, maxMembers); segments.PerformSegment(); regions = new List<SegmentRegion>(segments.Segments.Count); int height = 0; foreach (TreeSegmenter<SolverNode>.TreeSegment segment in segments.Segments) { SegmentRegion region = new SegmentRegion(); region.owner = this; region.MaxRegionNodeWidth = maxWidth; SizeInt regionSize = new SizeInt(maxWidth*CellSize.Width + 50, (segment.Count/maxWidth +1)*CellSize.Height); region.RenderRegion = new RectangleInt(renderCanvas.TopLeft.Add(0, height), regionSize); region.treeSegment = segment; region.treeSegment.Nodes.Sort(delegate(TreeNode<SolverNode> lhs, TreeNode<SolverNode> rhs) { return rhs.Data.Weighting.CompareTo(lhs.Data.Weighting); }); regions.Add(region); height += regionSize.Height; } }