public void AddElement(OECPElement ele) { //todo:加入栈中,实现撤销重做 ele.Layer = this; this.Elements.Add(ele); this.ElementMap.Add(ele.Eid, ele); }
public OECPElement SearchForHighLight(float x, float y, bool setHighLight = true) { if (Elements.Count == 0) { return(OECPElement.Empty()); } bool isLine = Elements[0].Type == OECPElement.ElementType.Line; OECPElement ret = OECPElement.Empty(); foreach (OECPElement ele in Elements) { if (isLine) { return(new OECPElement()); } else { var vtx = (OECPVertex)ele; var tole = vtx.BufferTolerance; if (Math.Abs(vtx.X - x) <= tole && Math.Abs(vtx.Y - y) <= tole) { if (setHighLight) { vtx.IsHighLight = true; } ret = vtx; break; } else { vtx.IsHighLight = false; } } } return(ret); }