コード例 #1
0
        public object Clone()
        {
            ZoneGridProperties copy = (ZoneGridProperties)this.MemberwiseClone();

            copy._area = (BoundingBox)_area.Clone();
            return(copy);
        }
コード例 #2
0
 public void TestVarious()
 {
     BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
     Assert.AreEqual(20, b1.Left);
     Assert.AreEqual(20, b1.Min.X);
     Assert.AreEqual(40, b1.Right);
     Assert.AreEqual(40, b1.Max.X);
     Assert.AreEqual(30, b1.Bottom);
     Assert.AreEqual(30, b1.Min.Y);
     Assert.AreEqual(55, b1.Top);
     Assert.AreEqual(55, b1.Max.Y);
     Assert.AreEqual(20, b1.Width);
     Assert.AreEqual(25, b1.Height);
     Assert.AreNotSame(b1, b1.Clone());
     Assert.IsTrue(b1.Contains(new Point(30, 40)));
     Assert.IsTrue(b1.Contains(new Point(20, 40)));
     Assert.IsFalse(b1.Contains(new Point(10, 10)));
     Assert.IsFalse(b1.Contains(new Point(50, 60)));
     Assert.IsFalse(b1.Contains(new Point(30, 60)));
     Assert.IsFalse(b1.Contains(new Point(50, 40)));
     Assert.IsFalse(b1.Contains(new Point(30, 15)));
     Assert.IsTrue(b1.Equals(new BoundingBox(20, 30, 40, 55)));
     Assert.AreEqual(new Point(30, 42.5), b1.GetCentroid());
     Assert.AreEqual(1, b1.LongestAxis);
     Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
     Assert.IsFalse(b1.Equals(null));
     Assert.IsFalse(b1.Equals(new Polygon()));
     Assert.AreEqual("20,30 40,55", b1.ToString());
     Assert.AreEqual(b1, new BoundingBox(40, 55, 20, 30));
     Assert.AreEqual(Math.Sqrt(200), b1.Distance(new BoundingBox(50, 65, 60, 75)));
 }
コード例 #3
0
ファイル: BoundingBoxTests.cs プロジェクト: cugkgq/Project
        public void TestVarious()
        {
            BoundingBox b1 = new BoundingBox(20, 30, 40, 55);

            Assert.AreEqual(20, b1.Left);
            Assert.AreEqual(20, b1.Min.X);
            Assert.AreEqual(40, b1.Right);
            Assert.AreEqual(40, b1.Max.X);
            Assert.AreEqual(30, b1.Bottom);
            Assert.AreEqual(30, b1.Min.Y);
            Assert.AreEqual(55, b1.Top);
            Assert.AreEqual(55, b1.Max.Y);
            Assert.AreEqual(20, b1.Width);
            Assert.AreEqual(25, b1.Height);
            Assert.AreNotSame(b1, b1.Clone());
            Assert.IsTrue(b1.Contains(new Point(30, 40)));
            Assert.IsTrue(b1.Contains(new Point(20, 40)));
            Assert.IsFalse(b1.Contains(new Point(10, 10)));
            Assert.IsFalse(b1.Contains(new Point(50, 60)));
            Assert.IsFalse(b1.Contains(new Point(30, 60)));
            Assert.IsFalse(b1.Contains(new Point(50, 40)));
            Assert.IsFalse(b1.Contains(new Point(30, 15)));
            Assert.IsTrue(b1.Equals(new BoundingBox(20, 30, 40, 55)));
            Assert.AreEqual(new Point(30, 42.5), b1.GetCentroid());
            Assert.AreEqual(1, b1.LongestAxis);
            Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
            Assert.IsFalse(b1.Equals(null));
            Assert.IsFalse(b1.Equals(new Polygon()));
            Assert.AreEqual("20,30 40,55", b1.ToString());
            Assert.AreEqual(b1, new BoundingBox(40, 55, 20, 30));
            Assert.AreEqual(Math.Sqrt(200), b1.Distance(new BoundingBox(50, 65, 60, 75)));
        }
コード例 #4
0
        protected void CopyBase(MapObject o, IDGenerator generator, bool performClone = false)
        {
            if (performClone && o.ID != ID)
            {
                var parent = o.Parent;
                var setPar = o.Parent != null && o.Parent.Children.ContainsKey(o.ID) && o.Parent.Children[o.ID] == o;
                if (setPar)
                {
                    o.SetParent(null);
                }
                o.ID = ID;
                if (setPar)
                {
                    o.SetParent(parent);
                }
            }
            o.ClassName = ClassName;
            o.Visgroups.AddRange(Visgroups);
            o.AutoVisgroups.AddRange(AutoVisgroups);
            o.Parent           = Parent;
            o.Colour           = Colour;
            o.IsSelected       = IsSelected;
            o.IsCodeHidden     = IsCodeHidden;
            o.IsRenderHidden2D = IsRenderHidden2D;
            o.IsRenderHidden3D = IsRenderHidden3D;
            o.IsVisgroupHidden = IsVisgroupHidden;
            o.BoundingBox      = BoundingBox.Clone();
            o.MetaData         = MetaData.Clone();
            var children = GetChildren().Select(x => performClone ? x.Clone() : x.Copy(generator));

            foreach (var c in children)
            {
                c.SetParent(o);
            }
        }
コード例 #5
0
 public object Clone()
 {
     return(new PageUnit()
     {
         Coordinate = Coordinate,
         TextType = TextType,
         Value = (string)Value.Clone(),
         BoundingBox = (PageUnitBoundingBox)BoundingBox?.Clone(),
         CountourOffset = (PageUnitBoundingBox)CountourOffset?.Clone()
     });
 }
コード例 #6
0
ファイル: Face.cs プロジェクト: NCC-Lykos/Chisel
        public virtual Face Copy(IDGenerator generator)
        {
            var f = new Face(generator.GetNextFaceID())
            {
                Plane       = Plane.Clone(),
                Colour      = Colour,
                IsSelected  = IsSelected,
                IsHidden    = IsHidden,
                Texture     = Texture.Clone(),
                Parent      = Parent,
                BoundingBox = BoundingBox.Clone()
            };

            foreach (var v in Vertices.Select(x => x.Clone()))
            {
                v.Parent = f;
                f.Vertices.Add(v);
            }
            return(f);
        }
コード例 #7
0
        public override DoOrUndo DragMoveAction(Util.WinForms.HitTestResult htr_, VectorT amount)
        {
            var htr = htr_ as HitTestResult;
            var rf  = htr == null ? RF.Move : htr.ResizeFlags;
            BoundingBox <float> old = null;

            return(@do =>
            {
                if (@do)
                {
                    old = _bbox.Clone();
                    Coord x1 = _bbox.X1 + ((rf & RF.Left) != 0 ? amount.X : 0);
                    Coord x2 = _bbox.X2 + ((rf & RF.Right) != 0 ? amount.X : 0);
                    Coord y1 = _bbox.Y1 + ((rf & RF.Top) != 0 ? amount.Y : 0);
                    Coord y2 = _bbox.Y2 + ((rf & RF.Bottom) != 0 ? amount.Y : 0);
                    _bbox = new BoundingBox <float>(x1, y1, x2, y2);
                    _bbox.Normalize();
                }
                else
                {
                    _bbox = old;
                }
            });
        }
コード例 #8
0
        /***************************************************/

        public static BoundingBox Bounds(this BoundingBox boundingBox)
        {
            return(boundingBox.Clone());
        }
コード例 #9
0
 public BoundingBox GetBoundingBox()
 {
     return(boundingBox.Clone());
 }
コード例 #10
0
ファイル: DrawableTile.cs プロジェクト: ssjylsg/VectorTiles
 public new Geometry Clone()
 {
     return(new DrawableTile(Data, boundingBox.Clone()));
 }