private void CreateWellLocation() { Map map = new Map(); Layer layer = new Layer(); //Layer sectionLayer = SectionLayerCreator.CreateSectionLayer(); TXTWellLocations twl = new TXTWellLocations() { TxtFile = "d:/welllocations.txt" }; WellLocationsCreator c = new WellLocationsCreator(); layer.Objects = c.Create(twl); //IObjects objs = c.Create(twl); //foreach (var o in objs) //{ // sectionLayer.Objects.Add(o); //} map.Layers.Add(layer); //3.绑定lc数据源 Binding bd = new Binding("Layers") { Source = map }; mc.SetBinding(ItemsControl.ItemsSourceProperty, bd); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value is TXTWellLocations) { TXTWellLocations wls = value as TXTWellLocations; wls.SaveToTxt(wls.TxtFile); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary> /// 功能:将txt文件路径转化为实体类存储 /// 将数据存储在WellLocationDataSource类中的Objects中 /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <returns></returns> public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value is string) { string filePath = value.ToString();//文件路径 TXTWellLocations welllocations = new TXTWellLocations(); welllocations.ReadFromTxt(filePath); return(welllocations); } return(base.ConvertFrom(context, culture, value)); }
private void AddPalneMap_Click(object sender, RoutedEventArgs e) { Map map = new Map() { Name = "Plane" }; Layer layer = new Layer(); TXTWellLocations twl = new TXTWellLocations() { TxtFile = "d:/welllocations.txt" }; WellLocationsCreator c = new WellLocationsCreator(); layer.Objects = c.Create(twl); map.Layers.Add(layer); Project.Maps.Add(map); }
private void CreateWellLocation(string fileName) { Map map = new Map(); Layer layer = new Layer(); TXTWellLocations twl = new TXTWellLocations() { TxtFile = fileName }; WellLocationsCreator c = new WellLocationsCreator(); layer.Objects = c.Create(twl); map.Layers.Add(layer); //3.绑定lc数据源 Binding bd = new Binding("Layers") { Source = map }; mc.SetBinding(ItemsControl.ItemsSourceProperty, bd); }
/// <summary> /// 概要:创建井位图 /// </summary> private void CreateWellLocation() { //1.引入数据模板 var manager = new DataTemplateManager(); manager.RegDataTemplateByFile <WellLocation>(type, cbTemplate.SelectedValue.ToString()); //2.创建Layer Layer layer = new Layer(); TXTWellLocations twl = new TXTWellLocations() { TxtFile = "d:/welllocations.txt" }; layer.Objects = GraphGeFactory.Single().Create(twl); //3.绑定lc数据源 Binding bd = new Binding("Objects") { Source = layer }; lc.SetBinding(ItemsControl.ItemsSourceProperty, bd); }