/* ==============================================================================
* 功能描述:Document
* 创 建 者:Garrett
* 创建日期:2019/12/17 16:18:00
* ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestCad.Model
{
///
/// Document
///
class Document
{
private Document()
{
m_Objects = new List();
Elements =new Dictionary>();
}
public static Document CreateDocument()
{
return new Document();
}
private List m_Objects;
public Dictionary> Elements { get; private set; }
public void AddObject(CADObject cadObject)
{
m_Objects.Add(cadObject);
}
///
///
///
///
public void GroupElements()
{
var group = m_Objects.GroupBy(bim => bim.GetType().Name);
var dic = new Dictionary>();
foreach (var collection in group)
{
dic[collection.Key + "s"] = collection.ToList();
}
Elements = dic;
}
}
}