Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        public override MyDxfBoundingBox GetBoundingBox()
        {
            MyDxfBoundingBox valueToReturn    = new MyDxfBoundingBox();
            List <int>       obtainedQuarters = getAngleQuarters();
            double           x1 = XCenter + Radius * Math.Cos(StartAngleRad);
            double           y1 = YCenter + Radius * Math.Sin(StartAngleRad);
            double           x2 = XCenter + Radius * Math.Cos(EndAngleRad);
            double           y2 = YCenter + Radius * Math.Sin(EndAngleRad);

            if (obtainedQuarters[0] == obtainedQuarters[1])
            {
                valueToReturn.XLowerLeft  = (x1 < x2) ? x1 : x2;
                valueToReturn.XUpperRight = (x1 > x2) ? x1 : x2;
                valueToReturn.YLowerLeft  = (y1 < y2) ? y1 : y2;
                valueToReturn.YUpperRight = (y2 < y1) ? y1 : y2;
            }
            else
            {
                if ((obtainedQuarters[0] == 1) && (obtainedQuarters[1] == 2))
                {
                    valueToReturn.XLowerLeft  = x2;
                    valueToReturn.XUpperRight = x1;
                    valueToReturn.YLowerLeft  = (y1 < y2) ? y1 : y2;
                    valueToReturn.YUpperRight = YCenter + Radius;
                }
                else
                {
                    if ((obtainedQuarters[0] == 1) && (obtainedQuarters[1] == 3))
                    {
                        valueToReturn.XLowerLeft  = XCenter - Radius;
                        valueToReturn.XUpperRight = x1;
                        valueToReturn.YLowerLeft  = y2;
                        valueToReturn.YUpperRight = YCenter + Radius;
                    }
                    else
                    {
                        if ((obtainedQuarters[0] == 2) && (obtainedQuarters[1] == 3))
                        {
                            valueToReturn.XLowerLeft  = XCenter - Radius;
                            valueToReturn.XUpperRight = x1 < x2?x2:x1;
                            valueToReturn.YLowerLeft  = y2;
                            valueToReturn.YUpperRight = y1;
                        }
                        else
                        {
                            if ((obtainedQuarters[0] == 3) && (obtainedQuarters[1] == 4))
                            {
                                valueToReturn.XLowerLeft  = x2;
                                valueToReturn.XUpperRight = x1;
                                valueToReturn.YLowerLeft  = YCenter + Radius;
                                valueToReturn.YUpperRight = y1 < y2 ? y2 : y1;
                            }
                            else
                            {
                                if ((obtainedQuarters[0] == 2) && (obtainedQuarters[1] == 4))
                                {
                                    valueToReturn.XLowerLeft  = XCenter - Radius;
                                    valueToReturn.XUpperRight = x2;
                                    valueToReturn.YLowerLeft  = YCenter - Radius;
                                    valueToReturn.YUpperRight = y1;
                                }
                                else
                                {
                                    if ((obtainedQuarters[0] == 1) && (obtainedQuarters[1] == 4))
                                    {
                                        valueToReturn.XLowerLeft  = XCenter - Radius;
                                        valueToReturn.XUpperRight = x1 < x2 ? x2 : x1;
                                        valueToReturn.YLowerLeft  = YCenter - Radius;
                                        valueToReturn.YUpperRight = YCenter + Radius;
                                    }
                                    else
                                    {
                                        ///////////////////////////////
                                        if ((obtainedQuarters[0] == 2) && (obtainedQuarters[1] == 1))
                                        {
                                            valueToReturn.XLowerLeft  = XCenter - Radius;
                                            valueToReturn.XUpperRight = XCenter + Radius;
                                            valueToReturn.YLowerLeft  = YCenter - Radius;
                                            valueToReturn.YUpperRight = y1 > y2?y1:y2;
                                        }
                                        else
                                        {
                                            if ((obtainedQuarters[0] == 4) && (obtainedQuarters[1] == 1))
                                            {
                                                valueToReturn.XLowerLeft  = x1 < x2 ? x1 : x2;
                                                valueToReturn.XUpperRight = XCenter + Radius;
                                                valueToReturn.YLowerLeft  = y1;
                                                valueToReturn.YUpperRight = y2;
                                            }
                                            else
                                            {
                                                if ((obtainedQuarters[0] == 3) && (obtainedQuarters[1] == 1))
                                                {
                                                    valueToReturn.XLowerLeft  = x1;
                                                    valueToReturn.XUpperRight = XCenter + Radius;
                                                    valueToReturn.YLowerLeft  = YCenter - Radius;
                                                    valueToReturn.YUpperRight = y2;
                                                }
                                                else
                                                {
                                                    if ((obtainedQuarters[0] == 3) && (obtainedQuarters[1] == 2))
                                                    {
                                                        valueToReturn.XLowerLeft  = x1 < x2? x1:x2;
                                                        valueToReturn.XUpperRight = XCenter + Radius;
                                                        valueToReturn.YLowerLeft  = y1;
                                                        valueToReturn.YUpperRight = YCenter + Radius;
                                                    }
                                                    else
                                                    {
                                                        if ((obtainedQuarters[0] == 4) && (obtainedQuarters[1] == 3))
                                                        {
                                                            valueToReturn.XLowerLeft  = XCenter - Radius;
                                                            valueToReturn.XUpperRight = XCenter + Radius;
                                                            valueToReturn.YLowerLeft  = y1 < y2?y1:y2;
                                                            valueToReturn.YUpperRight = YCenter + Radius;
                                                        }
                                                        else
                                                        {
                                                            if ((obtainedQuarters[0] == 4) && (obtainedQuarters[1] == 2))
                                                            {
                                                                valueToReturn.XLowerLeft  = x2;
                                                                valueToReturn.XUpperRight = XCenter + Radius;
                                                                valueToReturn.YLowerLeft  = y1;
                                                                valueToReturn.YUpperRight = YCenter + Radius;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(valueToReturn);
        }