public static void TextToXml(string pathText, string pathXml) { StreamReader streamReader = new StreamReader(pathText, Encoding.GetEncoding(1251)); List <Setting> list = new List <Setting>(); string strBuff; while ((strBuff = streamReader.ReadLine()) != null) { Setting settingLand = new Setting(); string[] aBuff = strBuff.Split(new char[] { '-' }, 3); if (aBuff.Length < 2) { settingLand.Key = aBuff[0]; settingLand.Name = "*"; settingLand.Description = "*"; } else if (aBuff.Length < 3) { settingLand.Key = aBuff[0]; settingLand.Name = aBuff[1]; settingLand.Description = "*"; } else { settingLand.Key = aBuff[0]; settingLand.Name = aBuff[1]; settingLand.Description = aBuff[2]; } list.Add(settingLand); } ServiceXml.WriteXml <List <Setting> >(list, pathXml); }
public UserInfo_page() { InitializeComponent(); ServiceXml sx = new ServiceXml(); users = sx.getUserss(); }
public static void CreatingCategoryOfLand() { SettingsLand categoryLand = new SettingsLand(); categoryLand.Setting .Add(new SettingLand("100", "Землі сільськогосподарського призначення", "*")); categoryLand.Setting .Add(new SettingLand("200", "Землі житлової та громадської забудови", "*")); categoryLand.Setting .Add(new SettingLand("300", "Землі природно-заповідного та іншого природоохоронного призначення", "*")); categoryLand.Setting .Add(new SettingLand("400", "Землі оздоровчого призначення", "*")); categoryLand.Setting .Add(new SettingLand("500", "Землі рекреаційного призначення", "*")); categoryLand.Setting .Add(new SettingLand("600", "Землі історико-культурного призначення", "*")); categoryLand.Setting .Add(new SettingLand("700", "Землі лісогосподарського призначення", "*")); categoryLand.Setting .Add(new SettingLand("800", "Землі водного фонду", "*")); categoryLand.Setting .Add(new SettingLand("900", "Землі промисловості, транспорту, зв'язку, енергетики, оборони та іншого призначення", "*")); ServiceXml.WriteXml <SettingsLand>(categoryLand, localPath.FindFullPathFromXml("CategoryOfLand")); }
private void AddUser_Click(object sender, RoutedEventArgs e) { string massage; Tdl_User user = new Tdl_User(); user.Id = r.Next(); user.Name = string.Format("{0}_{1}", tbFName.Text, tbLName.Text.Substring(0, 1)); user.Password = r.Next().ToString(); user.DateOfBirsday = (DateTime)dpDob.SelectedDate; user.Gender = (Gender)(ldGender.SelectedIndex); ServiceXml sx = new ServiceXml(); if (!sx.AddUsers(user, out massage)) { ErrorMessage.Foreground = new SolidColorBrush(Colors.Red); ErrorMessage.Content = massage; } else { ErrorMessage.Foreground = new SolidColorBrush(Colors.Green); ErrorMessage.Content = massage; Thread.Sleep(2000); AdminWindow.mf.Source = new Uri("Pages/ListUsers_page.xaml", UriKind.RelativeOrAbsolute); } }
public void CreatingLocalPaths() { LocalPath localPath = new LocalPath(); localPath.Paths.Add(new Setting("key1", "name1", "description1")); localPath.Paths.Add(new Setting("key2", "name2", "description2")); localPath.Paths.Add(new Setting("key3", "name3", "description3")); ServiceXml.WriteXml <LocalPath>(localPath, "p:\\LocalPaths.xml"); }
//private int versionCAD; public ServiceParcel(LandParcel parcel, SettingsFormLand formSettings) { settingsDrawing = ServiceXml.ReadXml <SettingsDrawing>(localPath.FindFullPathFromXml("PathDrawing")); if (settingsDrawing == null) { settingsDrawing = SettingsDrawing.Default; } this.Parcel = parcel; this.SettingsForm = formSettings; }
private void btnLogOn_Click(object sender, RoutedEventArgs e) { ServiceXml service = new ServiceXml("user.xml"); if (service.GetUser(txbLogin.Text, txbPassword.Password)) { AdminWindow aw = new AdminWindow(); aw.Show(); this.Close(); } }
/// <summary> /// Saves the settings. /// </summary> /// <typeparam name="T">Type settings.</typeparam> /// <param name="settings">The settings.</param> /// <param name="pathSettings">The path settings.</param> private void SaveSettings <T>(T settings, string pathSettings) { try { ServiceXml.WriteXml <T>(settings, pathSettings); } catch (Exception exc) { CurrentCAD.Editor.WriteMessage("* Error * SaveSettings<" + settings.GetType().Name + ">"); CurrentCAD.Editor.WriteMessage("* " + exc.ToString()); } }
internal static HatchPolygon GetHatchParcel() { List <HatchPolygon> list = ServiceXml.ReadXml <List <HatchPolygon> >(new LocalPath("LoSa_Land").FindFullPathFromXml("PathHatchPolygon")); HatchPolygon hatchPolygon = list.Find ( delegate(HatchPolygon hatchParcel) { return(hatchParcel.Type == "Parcel"); } ); return(hatchPolygon); }
/* * private void AddTableSettings(SettingTable setting) * { * this.tableSettings.Settings.Add(setting); * LoadTableSettings(); * } */ #endregion TableSettings // for BoxDriwingSettings #region BoxDriwingSettings private void LoadFrameDrawingSettings() { this.frameDrawingSettings = null; this.frameDrawingSettings = LoadSettings <SettingsLand>(localPath.FindFullPathFromXml("PathFrameDrawing")); if (this.frameDrawingSettings == null) { this.frameDrawingSettings = SettingsLand.Default; ServiceXml.WriteXml <SettingsLand>(this.frameDrawingSettings, localPath.FindFullPathFromXml("PathFrameDrawing")); } this.checkedListBoxTypeBoxDrawing.Items.Clear(); foreach (SettingLand setting in this.frameDrawingSettings.Setting) { this.checkedListBoxTypeBoxDrawing.Items.Add(setting.Name); } }
public Setting FindLocalPathFromXml(string key) { LocalPath localPath = ServiceXml.ReadXml <LocalPath>(this.RootDirectory + "\\settings\\LocalPaths.xml"); if (localPath == null) { return(null); } return(localPath.Paths.Find ( delegate(Setting setLand) { return setLand.Key == key; } )); }
internal static HatchPolygon GetHatchLimiting(LandPolygon poligon) { List <HatchPolygon> list = ServiceXml.ReadXml <List <HatchPolygon> >(new LocalPath("LoSa_Land").FindFullPathFromXml("PathHatchPolygon")); string type = poligon.FindInfo("OK").Value; string name = poligon.FindInfo("OX").Value; HatchPolygon hatchPolygon = list.Find ( delegate(HatchPolygon hatchLimiting) { return(hatchLimiting.Type == type && hatchLimiting.Name == name); } ); return(hatchPolygon); }
internal static HatchPolygon GetHatchLand(LandPolygon poligon) { List <HatchPolygon> list = ServiceXml.ReadXml <List <HatchPolygon> >(new LocalPath("LoSa_Land").FindFullPathFromXml("PathHatchPolygon")); HatchPolygon hatchPolygon = null; LandInfo infoCC = poligon.FindInfo("CC"); if (infoCC != null) { string type = infoCC.Value; hatchPolygon = list.Find ( delegate(HatchPolygon hatchLand) { return(hatchLand.Type == type); } ); } return(hatchPolygon); }
public FormEditTables() { tableSettings = ServiceXml.ReadXml <SettingsTable>(localPath.FindLocalPathFromXml("PathTables").Name); InitializeComponent(); }
/// <summary> /// Gets the limiting on use land from XML. /// </summary> /// <returns> /// List LimitingOnUseLand /// </returns> public static List <LimitingOnUseLand> GetLimitingOnUseLandFromXml() { return(ServiceXml.ReadXml <List <LimitingOnUseLand> > (new LocalPath("LoSa_Land").FindLocalPathFromXml("PathLimitingOnUseLand").Name)); }
private void AddFills() { Dictionary <string, HatchPolygon> listMissingHatch = new Dictionary <string, HatchPolygon>(); // // Parcel // if (SettingsForm.DisplayFillParcel) { AcDb.Polyline2d borderParcel = ServiceSimpleElements.CreatePolyline2d(this.Parcel.Points, true); AcDb.ObjectId idBorderParcel = ServiceCAD.InsertObject(borderParcel); AcDb.Hatch borderParcelHatch = ServiceSimpleElements.CreateHatch(idBorderParcel, true); HatchPolygon hatchParcel = HatchPolygon.GetHatchParcel(); if (hatchParcel != null) { borderParcelHatch.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillParcel.Layer); borderParcelHatch.ColorIndex = hatchParcel.ColorIndex; borderParcelHatch.SetHatchPattern(hatchParcel.Pattern.Type, hatchParcel.Pattern.Name); borderParcelHatch.PatternAngle = hatchParcel.Pattern.Angle; borderParcelHatch.PatternSpace = hatchParcel.Pattern.Space; AcDb.ObjectId idborderParcelHatch = ServiceCAD.InsertObject(borderParcelHatch); } else { try { listMissingHatch.Add("Parcel", new HatchPolygon("Parcel", "", 0, PatternHatch.DEFAULT)); CurrentCAD.Editor.WriteMessage("\n<!> Незнайдено штриховка Parcel;"); } catch { } } } // // Lands // AcDb.Polyline2d borderLand; AcDb.ObjectId idLand; AcDb.Hatch hatchLand; AcDb.ObjectId idHatchLand; if (SettingsForm.DisplayFillLand) { foreach (LandPolygon poligon in this.Parcel.Lands) { borderLand = ServiceSimpleElements.CreatePolyline2d(poligon.Points, true); borderLand.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillLand.Layer); idLand = ServiceCAD.InsertObject(borderLand); hatchLand = ServiceSimpleElements.CreateHatch(idLand, false); HatchPolygon hatch = HatchPolygon.GetHatchLand(poligon); if (hatch != null) { hatchLand.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillLand.Layer); hatchLand.ColorIndex = hatch.ColorIndex; hatchLand.SetHatchPattern(hatch.Pattern.Type, hatch.Pattern.Name); hatchLand.PatternAngle = hatch.Pattern.Angle; hatchLand.PatternSpace = hatch.Pattern.Space; idHatchLand = ServiceCAD.InsertObject(hatchLand); } else { string type = "000.00"; try { type = poligon.FindInfo("CC").Value; } catch { string ci = "*"; string cn = "*"; try { LandInfo infoCI = poligon.FindInfo("CI"); ci = infoCI.Value; } catch { } try { LandInfo infoCN = poligon.FindInfo("CN"); cn = infoCN.Value; } catch { } CurrentCAD.Editor.WriteMessage ("\n<!> Незнайдено поле CC угіддя CI = {0}, CN = {1};", ci, cn); } try { listMissingHatch.Add(type, new HatchPolygon(type, "", 0, PatternHatch.DEFAULT)); CurrentCAD.Editor.WriteMessage ("\n<!> Незнайдено CC = {0};", poligon.FindInfo("CC").Value ); } catch { } } } } // // Limiting // if (SettingsForm.DisplayFillLimiting) { foreach (LandPolygon poligon in this.Parcel.Limiting) { borderLand = ServiceSimpleElements.CreatePolyline2d(poligon.Points, true); borderLand.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillLimiting.Layer); idLand = ServiceCAD.InsertObject(borderLand); hatchLand = ServiceSimpleElements.CreateHatch(idLand, false); HatchPolygon hatchLimiting = HatchPolygon.GetHatchLimiting(poligon); if (hatchLimiting != null) { hatchLand.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillLimiting.Layer); hatchLand.ColorIndex = hatchLimiting.ColorIndex; hatchLand.SetHatchPattern(hatchLimiting.Pattern.Type, hatchLimiting.Pattern.Name); hatchLand.PatternAngle = hatchLimiting.Pattern.Angle; hatchLand.PatternSpace = hatchLimiting.Pattern.Space; idHatchLand = ServiceCAD.InsertObject(hatchLand); } else { string type = poligon.FindInfo("OK").Value; string name = poligon.FindInfo("OX").Value; try { listMissingHatch.Add((type + name), new HatchPolygon(type, name, 0, PatternHatch.DEFAULT)); CurrentCAD.Editor.WriteMessage ("\n<!> Незнайдено OK = {0}, OX = {1};", poligon.FindInfo("OK").Value, poligon.FindInfo("OX").Value ); } catch { } } } } if (listMissingHatch.Count > 0) { List <HatchPolygon> listForXml = new List <HatchPolygon>(); foreach (KeyValuePair <string, HatchPolygon> hp in listMissingHatch) { listForXml.Add(hp.Value); } listMissingHatch.Clear(); CurrentCAD.Editor.WriteMessage("\n\n<!> Побудова плана ділянки\n<!> Не визначено штриховку: \n"); CurrentCAD.Editor.WriteMessage(ServiceXml.GetStringXml <List <HatchPolygon> >(listForXml)); CurrentCAD.Editor.WriteMessage("\n<!>\n"); } }
public static void CreatingClassificationPurposLand() { SettingsLand purposLand = new SettingsLand(); #region Section_A purposLand.Setting .Add(new SettingLand( "01.01", "Для ведення товарного сільськогосподарського виробництва", "")); purposLand.Setting .Add(new SettingLand( "01.02", "Для ведення фермерського господарства", "")); purposLand.Setting .Add(new SettingLand( "01.03", "Для ведення особистого селянського господарства", "")); purposLand.Setting .Add(new SettingLand( "01.04", "Для ведення підсобного сільського господарства", "")); purposLand.Setting .Add(new SettingLand( "01.05", "Для індивідуального садівництва", "")); purposLand.Setting .Add(new SettingLand( "01.06", "Для колективного садівництва", "")); purposLand.Setting .Add(new SettingLand( "01.07", "Для городництва", "")); purposLand.Setting .Add(new SettingLand( "01.08", "Для сінокосіння і випасання худоби", "")); purposLand.Setting .Add(new SettingLand( "01.09", "Для дослідних і навчальних цілей", "")); purposLand.Setting .Add(new SettingLand( "01.10", "Для пропаганди передового досвіду ведення сільського господарства", "")); purposLand.Setting .Add(new SettingLand( "01.11", "Для надання послуг у сільському господарстві", "")); purposLand.Setting .Add(new SettingLand( "01.12", "Для розміщення інфраструктури оптових ринків сільськогосподарської продукції", "")); purposLand.Setting .Add(new SettingLand( "01.13", "Для іншого сільськогосподарського призначення", "")); purposLand.Setting .Add(new SettingLand( "01.014", "Для цілей підрозділів 01.01-01.13 та для збереження та використання земель природно-заповідного фонду", "")); #endregion Section_A ServiceXml.WriteXml <SettingsLand>(purposLand, localPath.FindFullPathFromXml("ClassificationPurposLand")); }
/* * private void _AddBoxDriwingSettings(SettingLand setting) * { * this.frameDrawingSettings.Setting.Add(setting); * LoadFrameDrawingSettings(); * } */ #endregion TableSettings // for Settings #region Settings private static T LoadSettings <T>(string pathSettings) { return(ServiceXml.ReadXml <T>(pathSettings)); }
private void miUserInfo_Click(object sender, RoutedEventArgs e) { ServiceXml sx = new ServiceXml(); sx.getUserss(); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці обмежень земельної ділянки. /// </summary> /// <param name="parcel">Ділянка, що є вихідною для таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці обмежень земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableLimiting(LandParcel parcel, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.MText valueMText; AcGe.Point3d insertPoint; AcDb.Line lineRows; LandPolygon polygonLimiting; double steepRow = settingTable.TextHeight * 6; double heightTable = settingTable.GetHeightCapTable() * -1; List <HatchPolygon> listMissingHatch = new List <HatchPolygon>(); for (int index = 0; index < parcel.Limiting.Count; index++) { polygonLimiting = parcel.Limiting.ToArray()[index]; double colWidth = 0; if (index > 0) { lineRows = new AcDb.Line( new AcGe.Point3d(0, heightTable, 0), new AcGe.Point3d(settingTable.GetWidthTable(), heightTable, 0)); objects.Add(lineRows); } heightTable -= steepRow; foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (heightTable + steepRow / 2), 0); valueMText = new AcDb.MText(); valueMText.Width = col.Width * 0.9; valueMText.TextHeight = settingTable.TextHeight; valueMText.LineSpaceDistance = settingTable.TextHeight * 1.5; valueMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; valueMText.Location = insertPoint; if (col.Format.IndexOf("LegendLimiting") > -1) { AcGe.Point2dCollection pointsHatch = new AcGe.Point2dCollection(new AcGe.Point2d[] { new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + steepRow - 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + steepRow - 2) }); AcDb.Polyline2d polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true); AcDb.Hatch hatch = ServiceSimpleElements.CreateHatch(ServiceCAD.InsertObject(polylineLimiting), true); HatchPolygon hatchLimiting = HatchPolygon.GetHatchLimiting(polygonLimiting); if (hatchLimiting != null) { hatch.ColorIndex = hatchLimiting.ColorIndex; hatch.SetHatchPattern(AcDb.HatchPatternType.UserDefined, hatchLimiting.Pattern.Name); hatch.PatternAngle = hatchLimiting.Pattern.Angle; hatch.PatternSpace = hatchLimiting.Pattern.Space; } else { string type = polygonLimiting.FindInfo("OK").Value; string name = polygonLimiting.FindInfo("OX").Value; listMissingHatch.Add(new HatchPolygon(type, name, 0, PatternHatch.DEFAULT)); } objects.Add(hatch); polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true); objects.Add(polylineLimiting); } else if (col.Format.IndexOf("CodeLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OK").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("NameLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OX").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("LegalActsLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OD").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("AreaLimiting") > -1) { double area = Convert.ToDouble(polygonLimiting.FindInfo("AO").Value.Replace(".", ",")); valueMText.Contents = (area / 10000).ToString("0.0000").Replace(",", ".");; objects.Add(valueMText); } } } if (listMissingHatch.Count > 0) { CurrentCAD.Editor.WriteMessage("\n\nПобудова таблиці омеженнь\n Не визначено штриховку: \n"); CurrentCAD.Editor.WriteMessage(ServiceXml.GetStringXml <List <HatchPolygon> >(listMissingHatch)); } return(objects); }