当前位置: 首页>>代码示例>>C#>>正文


C# Documents.Document类代码示例

本文整理汇总了C#中Sledge.Editor.Documents.Document的典型用法代码示例。如果您正苦于以下问题:C# Document类的具体用法?C# Document怎么用?C# Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Document类属于Sledge.Editor.Documents命名空间,在下文中一共展示了Document类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reverse

        public void Reverse(Document document)
        {
            foreach (var gp in _groupsAndParents)
            {
                var group = new Group(gp.Key) {Colour = Colour.GetRandomGroupColour()};
                var parent = document.Map.WorldSpawn.FindByID(gp.Value);
                group.SetParent(parent);
            }
            foreach (var cp in _childrenAndParents)
            {
                var child = document.Map.WorldSpawn.FindByID(cp.Key);
                var parent = document.Map.WorldSpawn.FindByID(cp.Value);
                child.SetParent(parent);
                child.UpdateBoundingBox();
                child.Colour = parent.Colour.Vary();
            }
            foreach (var gp in _groupsAndParents)
            {
                var group = document.Map.WorldSpawn.FindByID(gp.Key);
                if (group.GetChildren().All(x => x.IsSelected)) document.Selection.Select(group);
            }

            Mediator.Publish(EditorMediator.SelectionChanged);
            Mediator.Publish(EditorMediator.DocumentTreeStructureChanged);
        }
开发者ID:silky,项目名称:sledge,代码行数:25,代码来源:UngroupAction.cs

示例2: RenderDocument

 public void RenderDocument(ViewportBase viewport, Document document)
 {
     if (!document.Map.Cordon || document.Map.CordonBounds.IsEmpty()) return;
     if (ToolManager.ActiveTool != null && ToolManager.ActiveTool.GetHotkeyToolType() == HotkeyTool.Cordon) return;
     if (viewport is Viewport2D) Render2D((Viewport2D)viewport, document);
     if (viewport is Viewport3D) Render3D((Viewport3D)viewport, document);
 }
开发者ID:ChristopherHaws,项目名称:sledge,代码行数:7,代码来源:CordonHelper.cs

示例3: RenderDocument

        public void RenderDocument(ViewportBase viewport, Document document)
        {
            if (document.Pointfile == null) return;
            var pf = document.Pointfile;
            var vp2 = viewport as Viewport2D;
            Func<Coordinate, Coordinate> transform = x => x;
            if (vp2 != null) transform = vp2.Flatten;

            TextureHelper.Unbind();
            GL.LineWidth(3);
            GL.Begin(PrimitiveType.Lines);

            var r = 1f;
            var g = 0.5f;
            var b = 0.5f;
            var change = 0.5f / pf.Lines.Count;

            foreach (var line in pf.Lines)
            {
                var start = transform(line.Start);
                var end = transform(line.End);

                GL.Color3(r, g, b);
                GL.Vertex3(start.DX, start.DY, start.DZ);

                r -= change;
                b += change;

                GL.Color3(r, g, b);
                GL.Vertex3(end.DX, end.DY, end.DZ);
            }

            GL.End();
            GL.LineWidth(1);
        }
开发者ID:074769,项目名称:sledge,代码行数:35,代码来源:PointfileHelper.cs

示例4: Perform

        public void Perform(Document document)
        {
            document.Selection.Select(_objects.Where(x => x.BoundingBox != null));

            Mediator.Publish(EditorMediator.DocumentTreeSelectedObjectsChanged, _objects);
            Mediator.Publish(EditorMediator.SelectionChanged);
        }
开发者ID:074769,项目名称:sledge,代码行数:7,代码来源:Select.cs

示例5: ImmediateRenderer

 public ImmediateRenderer(Document document)
 {
     Document = document;
     _cache = null;
     _selectionTransformMat = Matrix.Identity;
     _selectionTransform = Matrix4.Identity;
 }
开发者ID:074769,项目名称:sledge,代码行数:7,代码来源:ImmediateRenderer.cs

示例6: Perform

        public void Perform(Document document)
        {
            var autohide = document.Map.GetAllVisgroups().First(x => x.Name == "Autohide");
            _added = autohide.ID;
            _selection = new List<MapObject>();
            foreach (var mapObject in _objects)
            {
                var o = mapObject;
                if (!o.AutoVisgroups.Contains(_added))
                {
                    o.AutoVisgroups.Add(_added);
                    o.Visgroups.Add(_added);
                }
                o.IsVisgroupHidden = true;
                if (o.IsSelected)
                {
                    _selection.Add(o);
                    document.Selection.Deselect(o);
                }
            }

            Mediator.Publish(EditorMediator.DocumentTreeStructureChanged);
            Mediator.Publish(EditorMediator.SelectionChanged);
            Mediator.Publish(EditorMediator.VisgroupsChanged);
        }
开发者ID:jpiolho,项目名称:sledge,代码行数:25,代码来源:QuickHideObjects.cs

示例7: Perform

        public void Perform(Document document)
        {
            foreach (var child in _childrenAndParents.Keys.Select(x => document.Map.WorldSpawn.FindByID(x)))
            {
                child.SetParent(document.Map.WorldSpawn);
                child.UpdateBoundingBox();
                child.Colour = Colour.GetRandomBrushColour();
            }

            foreach (var groupId in _groupsAndParents.Keys)
            {
                var group = document.Map.WorldSpawn.FindByID(groupId);
                if (group == null) continue;

                if (group.IsSelected)
                {
                    document.Selection.Deselect(group);
                }

                group.SetParent(null);
            }

            Mediator.Publish(EditorMediator.SelectionChanged);
            Mediator.Publish(EditorMediator.DocumentTreeStructureChanged);
        }
开发者ID:silky,项目名称:sledge,代码行数:25,代码来源:UngroupAction.cs

示例8: Undo

 public void Undo(Document document)
 {
     for (var i = _actions.Count - 1; i >= 0; i--)
     {
         _actions[i].Reverse(document);
     }
 }
开发者ID:silky,项目名称:sledge,代码行数:7,代码来源:HistoryAction.cs

示例9: SetDocument

 public static void SetDocument(Document doc)
 {
     var active = ActiveTool;
     Deactivate();
     Tools.ForEach(x => x.SetDocument(doc));
     Activate(active);
 }
开发者ID:silky,项目名称:sledge,代码行数:7,代码来源:ToolManager.cs

示例10: Reverse

        public void Reverse(Document document)
        {
            var root = document.Map.WorldSpawn;
            foreach (var kv in _reverse)
            {
                var obj = root.FindByID(kv.Key);
                if (obj == null) return;

                // Unclone will reset children, need to reselect them if needed
                var deselect = obj.FindAll().Where(x => x.IsSelected).ToList();
                document.Selection.Deselect(deselect);

                obj.Unclone(kv.Value);

                var select = obj.FindAll().Where(x => deselect.Any(y => x.ID == y.ID));
                document.Selection.Select(select);

                document.Map.UpdateAutoVisgroups(obj, true);
            }

            Mediator.Publish(EditorMediator.DocumentTreeStructureChanged, _reverse.Select(x => document.Map.WorldSpawn.FindByID(x.Key)));
            Mediator.Publish(EditorMediator.SelectionChanged);
            Mediator.Publish(EditorMediator.VisgroupsChanged);

            _reverse.Clear();
        }
开发者ID:silky,项目名称:sledge,代码行数:26,代码来源:ReplaceObjects.cs

示例11: Perform

        public void Perform(Document document)
        {
            document.Selection.Deselect(_objects);

            Mediator.Publish(EditorMediator.DocumentTreeSelectedObjectsChanged, _objects);
            Mediator.Publish(EditorMediator.SelectionChanged);
        }
开发者ID:074769,项目名称:sledge,代码行数:7,代码来源:Deselect.cs

示例12: Reverse

        public void Reverse(Document document)
        {
            document.Selection.Select(_objects);

            Mediator.Publish(EditorMediator.DocumentTreeSelectedObjectsChanged, _objects);
            Mediator.Publish(EditorMediator.SelectionChanged);
        }
开发者ID:074769,项目名称:sledge,代码行数:7,代码来源:Deselect.cs

示例13: Reverse

        public virtual void Reverse(Document document)
        {
            // Edit
            _editObjects.ForEach(x => x.Reverse(document));

            // Create
            _objectsToCreate = document.Map.WorldSpawn.Find(x => _createdIds.Contains(x.ID));
            if (_objectsToCreate.Any(x => x.IsSelected))
            {
                document.Selection.Deselect(_objectsToCreate.Where(x => x.IsSelected));
            }
            _objectsToCreate.ForEach(x => x.SetParent(null));
            _createdIds = null;

            // Delete
            _idsToDelete = _deletedObjects.Select(x => x.Object.ID).ToList();
            foreach (var dr in _deletedObjects.Where(x => x.TopMost))
            {
                dr.Object.SetParent(document.Map.WorldSpawn.FindByID(dr.ParentID));
                document.Map.UpdateAutoVisgroups(dr.Object, true);
            }
            document.Selection.Select(_deletedObjects.Where(x => x.IsSelected).Select(x => x.Object));
            _deletedObjects = null;

            if (_objectsToCreate.Any() || _idsToDelete.Any())
            {
                Mediator.Publish(EditorMediator.DocumentTreeStructureChanged);
            }
            else if (_editObjects.Any())
            {
                Mediator.Publish(EditorMediator.DocumentTreeStructureChanged, _editObjects.Select(x => document.Map.WorldSpawn.FindByID(x.ID)));
            }

            Mediator.Publish(EditorMediator.VisgroupsChanged);
        }
开发者ID:jpiolho,项目名称:sledge,代码行数:35,代码来源:CreateEditDelete.cs

示例14: Reverse

 public void Reverse(Document document)
 {
     for (var i = Actions.Count - 1; i >= 0; i--)
     {
         Actions[i].Reverse(document);
     }
 }
开发者ID:silky,项目名称:sledge,代码行数:7,代码来源:ActionCollection.cs

示例15: Reverse

        public void Reverse(Document document)
        {
            // Deleted
            foreach (var del in _deletedVisgroups)
            {
                document.Map.Visgroups.Add(del);
                _removedObjects[del.ID].ForEach(x => x.Visgroups.Add(del.ID));
            }
            _madeVisible.ForEach(x => x.IsVisgroupHidden = true);
            _removedObjects = null;
            _madeVisible = null;

            // Changed
            _afterchanges = new List<Tuple<int, string, Color>>();
            foreach (var bc in _beforeChanges)
            {
                var vis = document.Map.Visgroups.First(x => x.ID == bc.Item1);
                _afterchanges.Add(Tuple.Create(vis.ID, vis.Name, vis.Colour));
                vis.Name = bc.Item2;
                vis.Colour = bc.Item3;
            }
            _beforeChanges = null;

            // New
            document.Map.Visgroups.RemoveAll(x => _newVisgroups.Any(y => y.ID == x.ID));

            Mediator.Publish(EditorMediator.VisgroupsChanged);
            Mediator.Publish(EditorMediator.DocumentTreeStructureChanged);
        }
开发者ID:jpiolho,项目名称:sledge,代码行数:29,代码来源:CreateEditDeleteVisgroups.cs


注:本文中的Sledge.Editor.Documents.Document类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。