Пример #1
0
        public void GetCustomSettingFromFileTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target           = new AppManager();

            target.Map = map;

            string uniqueName = "customsettingname";
            var    expected   = DateTime.Now;

            target.SerializationManager.SetCustomSetting(uniqueName, expected);

            var actual = target.SerializationManager.GetCustomSetting <DateTime>(uniqueName, DateTime.Now.AddDays(1));

            Assert.AreEqual(expected, actual);

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "SerializeTestWithCustomSettings.map.xml");

            target.SerializationManager.SaveProject(path);

            target.SerializationManager.OpenProject(path);
            actual = target.SerializationManager.GetCustomSetting <DateTime>(uniqueName, DateTime.Now.AddDays(1));
            Assert.AreEqual(expected.ToLongDateString(), actual.ToLongDateString());

            File.Delete(path);
        }
Пример #2
0
        internal void DrawRoofPland(DotSpatial.Controls.Map pvMap)
        {
            PvDesktopUtilityFunction util = new PvDesktopUtilityFunction();

            util.DrawLine(RidgeLine.Point1, RidgeLine.Point2, 1, Color.Red, pvMap);
            util.DrawLine(RidgeLine.Point2, EaveLine.Point2, 1, Color.Magenta, pvMap);
            util.DrawLine(EaveLine.Point2, EaveLine.Point1, 1, Color.Magenta, pvMap);
            util.DrawLine(EaveLine.Point1, RidgeLine.Point1, 1, Color.Magenta, pvMap);
        }
Пример #3
0
 private void initForm()
 {
     this.map = new DotSpatial.Controls.Map();
     this.splitContainer2.Panel1.Controls.Add(this.map);
     this.map.Dock = DockStyle.Fill;
     this.legent   = new DotSpatial.Controls.Legend();
     this.splitContainer1.Panel1.Controls.Add(this.legent);
     this.legent.Dock = DockStyle.Fill;
     this.map.Legend  = this.legent;
     //DotSpatial.Controls.MapPolygonLayer polygonLayer = this.map.AddLayer(shpFileName) as DotSpatial.Controls.MapPolygonLayer;
 }
Пример #4
0
        public void GetCustomSettingDefaultTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target = new AppManager();
            target.Map = map;

            string uniqueName = "customsettingname";
            var expected = DateTime.Now;
            var actual = target.SerializationManager.GetCustomSetting<DateTime>(uniqueName, expected);
            // checks that the default value is returned correctly
            Assert.AreEqual(expected, actual);
        }
Пример #5
0
        public void ZoomToMaxExtentTest()
        {
            XmlDeserializer target = new XmlDeserializer();

            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "testproject1.dspx");

            target.Deserialize(map, File.ReadAllText(path));

            map.ZoomToMaxExtent();

            File.Delete(path);
        }
Пример #6
0
        public void GetCustomSettingDefaultTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target           = new AppManager();

            target.Map = map;

            string uniqueName = "customsettingname";
            var    expected   = DateTime.Now;
            var    actual     = target.SerializationManager.GetCustomSetting <DateTime>(uniqueName, expected);

            // checks that the default value is returned correctly
            Assert.AreEqual(expected, actual);
        }
        public void MapFrameIsNotNull_Group()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "test-randomPts.shp");

            IFeatureSet fs = FeatureSet.Open(path);
            MapPointLayer myLayer = new MapPointLayer(fs);

            MapGroup grp = new MapGroup(map, "group1");
            map.Layers.Add(grp);
            grp.Layers.Add(myLayer);

            Assert.IsNotNull(myLayer.MapFrame, "mapFrame of layer in group should not be null.");
        }
Пример #8
0
        public void MapFrameIsNotNull_Group()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "test-randomPts.shp");

            IFeatureSet   fs      = FeatureSet.Open(path);
            MapPointLayer myLayer = new MapPointLayer(fs);

            MapGroup grp = new MapGroup(map, "group1");

            map.Layers.Add(grp);
            grp.Layers.Add(myLayer);

            Assert.IsNotNull(myLayer.MapFrame, "mapFrame of layer in group should not be null.");
        }
Пример #9
0
        public void GetCustomSettingFromMemoryTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target           = new AppManager();

            target.Map = map;

            string uniqueName = "customsettingname";
            var    expected   = DateTime.Now;

            target.SerializationManager.SetCustomSetting(uniqueName, expected);

            var actual = target.SerializationManager.GetCustomSetting <DateTime>(uniqueName, DateTime.Now.AddDays(1));

            Assert.AreEqual(expected, actual);
        }
Пример #10
0
        public void SelectedLayerNullIfLayerRemoved()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string    path    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "test-randomPts.shp");
            IMapLayer myLayer = map.AddLayer(path);

            Assert.IsNotNull(myLayer, "the added map layer should not be null.");

            myLayer.IsSelected = true;
            Assert.AreEqual(map.Layers.SelectedLayer, myLayer, "the selected layer should be equal to myLayer.");

            //now remove all layers
            map.Layers.Clear();

            //selectedLayer should be null
            Assert.IsNull(map.Layers.SelectedLayer, "SelectedLayer should be null after removing all layers");
        }
Пример #11
0
        public void SelectedLayerNullIfLayerRemoved()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "test-randomPts.shp");
            IMapLayer myLayer = map.AddLayer(path);

            Assert.IsNotNull(myLayer, "the added map layer should not be null.");

            myLayer.IsSelected = true;
            Assert.AreEqual(map.Layers.SelectedLayer, myLayer, "the selected layer should be equal to myLayer.");

            //now remove all layers
            map.Layers.Clear();

            //selectedLayer should be null
            Assert.IsNull(map.Layers.SelectedLayer, "SelectedLayer should be null after removing all layers");
        }
Пример #12
0
        public void ZoomToMaxExtentTest()
        {
            XmlDeserializer target = new XmlDeserializer();
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "testproject1.dspx");

            target.Deserialize(map, File.ReadAllText(path));

            map.ZoomToMaxExtent();

            File.Delete(path);
        }
Пример #13
0
        public void GetCustomSettingFromMemoryTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target = new AppManager();
            target.Map = map;

            string uniqueName = "customsettingname";
            var expected = DateTime.Now;
            target.SerializationManager.SetCustomSetting(uniqueName, expected);

            var actual = target.SerializationManager.GetCustomSetting<DateTime>(uniqueName, DateTime.Now.AddDays(1));
            Assert.AreEqual(expected, actual);

        }
Пример #14
0
        public void GetCustomSettingFromFileTest()
        {
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            AppManager target = new AppManager();
            target.Map = map;

            string uniqueName = "customsettingname";
            var expected = DateTime.Now;
            target.SerializationManager.SetCustomSetting(uniqueName, expected);

            var actual = target.SerializationManager.GetCustomSetting<DateTime>(uniqueName, DateTime.Now.AddDays(1));
            Assert.AreEqual(expected, actual);

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "SerializeTestWithCustomSettings.map.xml");

            target.SerializationManager.SaveProject(path);

            target.SerializationManager.OpenProject(path);
            actual = target.SerializationManager.GetCustomSetting<DateTime>(uniqueName, DateTime.Now.AddDays(1));
            Assert.AreEqual(expected.ToLongDateString(), actual.ToLongDateString());

            File.Delete(path);
        }