public CNode(int parentID, PositionOfNode positionOfNode, RECTANGLE parentBound) { // if node is root this.m_id = parentID * 10 + (int)positionOfNode; this.m_tl = null; this.m_tr = null; this.m_bl = null; this.m_br = null; this.m_listObject = new List<OBJECT>(); if (parentID == 0) { this.m_bound = parentBound; } else { if (positionOfNode == PositionOfNode.TopLeft) { this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.TopRight) { this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.BottomLeft) { this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.BottomRight) { this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2); } } }
public CNode(int parentID, PositionOfNode positionOfNode, RECTANGLE parentBound) { // if node is root this.m_id = parentID * 10 + (int)positionOfNode; this.m_tl = null; this.m_tr = null; this.m_bl = null; this.m_br = null; this.m_listObject = new List <OBJECT>(); if (parentID == 0) { this.m_bound = parentBound; } else { if (positionOfNode == PositionOfNode.TopLeft) { this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.TopRight) { this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.BottomLeft) { this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2); } else if (positionOfNode == PositionOfNode.BottomRight) { this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2); } } }