public override MyDxfBoundingBox GetBoundingBox() { MyDxfBoundingBox valueToReturn = new MyDxfBoundingBox(); valueToReturn.XLowerLeft = XStart < XEnd ? XStart : XEnd; valueToReturn.YLowerLeft = YStart < YEnd ? YStart : YEnd; valueToReturn.XUpperRight = XStart < XEnd ? XEnd : XStart; valueToReturn.YUpperRight = YStart < YEnd ? YEnd : YStart; return(valueToReturn); }
public void addDxfDrawingEntry(DXFdrawingEntry in_DxfEntry) { AllDXFdrawingEntries.Add(in_DxfEntry); MyDxfBoundingBox obtainedDxfBoundingBox = in_DxfEntry.GetBoundingBox(); if (AllDXFdrawingEntries.Count > 1) { currentBoundingBox.XLowerLeft = currentBoundingBox.XLowerLeft < obtainedDxfBoundingBox.XLowerLeft ? currentBoundingBox.XLowerLeft : obtainedDxfBoundingBox.XLowerLeft; currentBoundingBox.YLowerLeft = currentBoundingBox.YLowerLeft < obtainedDxfBoundingBox.YLowerLeft ? currentBoundingBox.YLowerLeft : obtainedDxfBoundingBox.YLowerLeft; currentBoundingBox.XUpperRight = currentBoundingBox.XUpperRight > obtainedDxfBoundingBox.XUpperRight ? currentBoundingBox.XUpperRight : obtainedDxfBoundingBox.XUpperRight; currentBoundingBox.YUpperRight = currentBoundingBox.YUpperRight > obtainedDxfBoundingBox.YUpperRight ? currentBoundingBox.YUpperRight : obtainedDxfBoundingBox.YUpperRight; } else { currentBoundingBox = obtainedDxfBoundingBox; } }
public void recalculateBoundingBoxFromScratch() { if ((AllDXFdrawingEntries == null) || (AllDXFdrawingEntries.Count <= 0)) { return; } MyDxfBoundingBox obtainedBoundingBox = AllDXFdrawingEntries[0].GetBoundingBox(); currentBoundingBox.XLowerLeft = obtainedBoundingBox.XLowerLeft; currentBoundingBox.XUpperRight = obtainedBoundingBox.XUpperRight; currentBoundingBox.YLowerLeft = obtainedBoundingBox.YLowerLeft; currentBoundingBox.YUpperRight = obtainedBoundingBox.YUpperRight; for (int i = 1; i < AllDXFdrawingEntries.Count; i++) { obtainedBoundingBox = AllDXFdrawingEntries[i].GetBoundingBox(); currentBoundingBox.XLowerLeft = currentBoundingBox.XLowerLeft < obtainedBoundingBox.XLowerLeft ? currentBoundingBox.XLowerLeft : obtainedBoundingBox.XLowerLeft; currentBoundingBox.YLowerLeft = currentBoundingBox.YLowerLeft < obtainedBoundingBox.YLowerLeft ? currentBoundingBox.YLowerLeft : obtainedBoundingBox.YLowerLeft; currentBoundingBox.XUpperRight = currentBoundingBox.XUpperRight > obtainedBoundingBox.XUpperRight ? currentBoundingBox.XUpperRight : obtainedBoundingBox.XUpperRight; currentBoundingBox.YUpperRight = currentBoundingBox.YUpperRight > obtainedBoundingBox.YUpperRight ? currentBoundingBox.YUpperRight : obtainedBoundingBox.YUpperRight; } }