public void OnDrag(PointerEventData eventData) { if (m_ctrlNode != null) { if (m_ctrlNode.type != CtrlNodeType.Mid) { if (m_ctrlNode.m_lineAction.m_line.ConnectLink == false) { m_ctrlNode.m_lineAction.OptimezationLine(); } } else { m_ctrlNode.SetMidChange(); } } else if (m_LineAction != null && m_LineAction.m_line != null) { EleLine line = m_LineAction.m_line as EleLine; if (line.OneConnectLink == true) { m_LineAction.SetMidChange(); } } }
public CircuitNodeLine(CircuitNode Node, EleLine line) { if (Node != null) { this.LabID = Node.LabID; this.Type = Node.Type; this.Line = line; } }
public static bool CheckConnectCircuit(EleLine line) { if (line == null) { return(false); } if (g_HaveConnect.Contains(line) == true) { return(true); } else { g_HaveConnect.Add(line); return(false); } }
/// <summary> /// 连接导线 /// </summary> public void AddLinkLine(EleLine line) { if (line == null) { return; } if (m_linkEleLine.Contains(line) == false) { m_linkEleLine.Add(line); } bool IslinkLine = CheckLinkLine(); ShowLeap(IslinkLine); NDCircuitObject.CreateCirCuit(); }
/// <summary> /// 移除导线 /// </summary> public void RemoveLinkLine(EleLine line) { if (line == null) { return; } if (m_linkEleLine.Contains(line) == true) { m_linkEleLine.Remove(line); } //line.RemoveLinkLeap(this); bool IslinkLine = CheckLinkLine(); ShowLeap(IslinkLine); NDCircuitObject.CreateCirCuit(); }
/// <summary> /// 查找附近的导线接线头 /// </summary> public NDCircuitLeap FindNearLeap() { float distance = ConstantData.m_fHighlightDistance; List <NDCircuitLeap> l = GetAllLeap(); NDCircuitLeap near = null; foreach (NDCircuitLeap v in l) { if (v == null) { continue; } //forbidden the two LineLeap of line link to one circutLeap. link to one eleMent by identical type of CircuitLeapType is also not allowed. EleLine line = m_Parent as EleLine; if (line.StartLineLeap.Link != null) { if (v.m_Parent == line.StartLineLeap.Link.m_Parent && v.m_Type == line.StartLineLeap.Link.m_Type) { continue; } } else if (line.EndLineLeap.Link != null) { if (v.m_Parent == line.EndLineLeap.Link.m_Parent && v.m_Type == line.EndLineLeap.Link.m_Type) { continue; } } float d = CalcDistance(v, this); if (d <= distance) { near = v; distance = d; } } return(near); }
public static void JionCircuit() { List <NDlabObject> lineList = NDlabObject.SearchLabObject(SearchCicuitType.ELELINE, false); foreach (NDlabObject obj in lineList) { if (obj != null && obj is EleLine) { EleLine eleLine = obj as EleLine; if (eleLine.ConnectLink == true) { NDlabObject start = eleLine.StartLineLeap.Link.m_Parent; NDlabObject end = eleLine.EndLineLeap.Link.m_Parent; CircuitElement myCircuit = LabObjectDataFactory.GetCircuit(start.LabObjID); CircuitElement OtherCircuit = LabObjectDataFactory.GetCircuit(end.LabObjID); Circuit.Lead startLead = eleLine.StartLineLeap.Link.m_Type == ElementLeapType.leadIn?myCircuit.leadIn:myCircuit.leadOut; Circuit.Lead endLead = eleLine.EndLineLeap.Link.m_Type == ElementLeapType.leadIn ? OtherCircuit.leadIn : OtherCircuit.leadOut; g_sim.Connect(startLead, endLead); } } } }