public void AddInstance(DesignInstance inst) { PointF[] pts = (inst.IsRotated) ? inst.GetTransformedCenter() : inst.GetTransformedPoints().GetMidpointsAndCenter(); for (int i = 0; i < pts.Length; i++) { BondAttachment ba = BondAttachmentExtensions.GetTargetFromHandleIndex(i); AddPoint(xStops, pts[i].X, new CrossPoint(pts[i].Y, inst.InstanceHash, ba)); AddPoint(yStops, pts[i].Y, new CrossPoint(pts[i].X, inst.InstanceHash, ba)); } }
public void RemoveInstance(DesignInstance inst) { PointF[] pts = (inst.IsRotated) ? inst.GetTransformedCenter() : inst.GetTransformedPoints().GetMidpointsAndCenter(); uint hash = inst.InstanceHash; bool success = true; for (int i = 0; i < pts.Length; i++) { bool successX = RemovePoint(xStops, pts[i].X, pts[i].Y, hash); bool successY = RemovePoint(yStops, pts[i].Y, pts[i].X, hash); if (!successX || !successY) { success = false; break; } } if (!success) { RemoveByIndex(xStops, hash); RemoveByIndex(yStops, hash); } }