本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例5: ImmediateRenderer
public ImmediateRenderer(Document document)
{
Document = document;
_cache = null;
_selectionTransformMat = Matrix.Identity;
_selectionTransform = Matrix4.Identity;
}
示例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);
}
示例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);
}
示例8: Undo
public void Undo(Document document)
{
for (var i = _actions.Count - 1; i >= 0; i--)
{
_actions[i].Reverse(document);
}
}
示例9: SetDocument
public static void SetDocument(Document doc)
{
var active = ActiveTool;
Deactivate();
Tools.ForEach(x => x.SetDocument(doc));
Activate(active);
}
示例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();
}
示例11: Perform
public void Perform(Document document)
{
document.Selection.Deselect(_objects);
Mediator.Publish(EditorMediator.DocumentTreeSelectedObjectsChanged, _objects);
Mediator.Publish(EditorMediator.SelectionChanged);
}
示例12: Reverse
public void Reverse(Document document)
{
document.Selection.Select(_objects);
Mediator.Publish(EditorMediator.DocumentTreeSelectedObjectsChanged, _objects);
Mediator.Publish(EditorMediator.SelectionChanged);
}
示例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);
}
示例14: Reverse
public void Reverse(Document document)
{
for (var i = Actions.Count - 1; i >= 0; i--)
{
Actions[i].Reverse(document);
}
}
示例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);
}