Exemple #1
0
        public void Clone_ClonesTheProperties()
        {
            var group = new LayerGroup("group");

            group.CoordinateTransformation = CreateTransformation();
            group.Enabled         = true;
            group.IsQueryEnabled  = true;
            group.MinVisible      = 10;
            group.MaxVisible      = 100;
            group.SRID            = 4326;
            group.Proj4Projection = "dummy";
            group.TargetSRID      = 4327;
            group.Style           = new LabelStyle();

            var clonedGroup = (LayerGroup)group.Clone();

            Assert.That(clonedGroup.CoordinateTransformation, Is.EqualTo(group.CoordinateTransformation), "CoordinateTransformation mismatch");
            Assert.That(clonedGroup.Enabled, Is.EqualTo(group.Enabled), "Enabled mismatch");
            Assert.That(clonedGroup.IsQueryEnabled, Is.EqualTo(group.IsQueryEnabled), "IsQueryEnabled mismatch");
            Assert.That(clonedGroup.MinVisible, Is.EqualTo(group.MinVisible), "MinVisible mismatch");
            Assert.That(clonedGroup.MaxVisible, Is.EqualTo(group.MaxVisible), "MaxVisible mismatch");
            Assert.That(clonedGroup.SRID, Is.EqualTo(group.SRID), "SRID mismatch");
            Assert.That(clonedGroup.Proj4Projection, Is.EqualTo(group.Proj4Projection), "Proj4Projection mismatch");
            Assert.That(clonedGroup.TargetSRID, Is.EqualTo(group.TargetSRID), "TargetSRID mismatch");
            Assert.That(clonedGroup.Style, Is.EqualTo(group.Style), "Style mismatch");
        }
        public void LayerGroup_CloneProp()
        {
            var group = new LayerGroup("group");

            // This is a transformation that cannot be "inverted" in ProjNet
            // Directly setting CoordinateTransformation will update SRID and TargetSRID
            group.CoordinateTransformation        = CreateTransformation();
            group.ReverseCoordinateTransformation = CreateReverseTransformation();
            group.Enabled        = true;
            group.IsQueryEnabled = true;
            group.MinVisible     = 10;
            group.MaxVisible     = 100;
            //group.SRID = 4326; // different to CoordinateTransformation above!!!
            //group.TargetSRID = 4318; // different to CoordinateTransformation above!!!
            group.Proj4Projection = "dummy";
            group.Style           = new LabelStyle();

            var clonedGroup = (LayerGroup)group.Clone();

            Assert.That(clonedGroup.CoordinateTransformation.SourceCS.WKT, Is.EqualTo(group.CoordinateTransformation.SourceCS.WKT), "CoordinateTransformation mismatch");
            Assert.That(clonedGroup.CoordinateTransformation.TargetCS.WKT, Is.EqualTo(group.CoordinateTransformation.TargetCS.WKT), "CoordinateTransformation mismatch");
            Assert.That(clonedGroup.ReverseCoordinateTransformation.SourceCS.WKT, Is.EqualTo(group.ReverseCoordinateTransformation.SourceCS.WKT), "CoordinateTransformation mismatch");
            Assert.That(clonedGroup.ReverseCoordinateTransformation.TargetCS.WKT, Is.EqualTo(group.ReverseCoordinateTransformation.TargetCS.WKT), "CoordinateTransformation mismatch");
            Assert.That(clonedGroup.Enabled, Is.EqualTo(group.Enabled), "Enabled mismatch");
            Assert.That(clonedGroup.IsQueryEnabled, Is.EqualTo(group.IsQueryEnabled), "IsQueryEnabled mismatch");
            Assert.That(clonedGroup.MinVisible, Is.EqualTo(group.MinVisible), "MinVisible mismatch");
            Assert.That(clonedGroup.MaxVisible, Is.EqualTo(group.MaxVisible), "MaxVisible mismatch");
            Assert.That(clonedGroup.SRID, Is.EqualTo(group.SRID), "SRID mismatch");
            Assert.That(clonedGroup.Proj4Projection, Is.EqualTo(group.Proj4Projection), "Proj4Projection mismatch");
            Assert.That(clonedGroup.TargetSRID, Is.EqualTo(group.TargetSRID), "TargetSRID mismatch");
            Assert.That(clonedGroup.Style, Is.EqualTo(group.Style), "Style mismatch");
        }