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); }
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); }
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; }
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 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); }
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."); }
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); }
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"); }
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); }
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); }