public string ToStringSDR <T>() where T : IFormatSDR { string sdrString = string.Empty; var properties = this.GetType().GetProperties(); foreach (PropertyInfo property in properties) { var attributes = property.GetCustomAttributes(typeof(T), false); int numChar = (int)((T)attributes[0]).GetValue(); string propertyValue = (string)property.GetValue(this, null); if (property.Name == "Version") { if (typeof(FormatSDR33).Equals(typeof(T))) { propertyValue = "SDR33 V04-04.02 "; } else if (typeof(FormatSDR20).Equals(typeof(T))) { propertyValue = "SDR20V03-05 "; } } sdrString += DataSDR.Format(propertyValue, numChar); } return(sdrString += "1"); }
public string ToStringSDR <T>() where T : IFormatSDR { string sdrString = string.Empty; var properties = this.GetType().GetProperties(); foreach (PropertyInfo property in properties) { var attributes = property.GetCustomAttributes(typeof(T), false); int numChar = (int)((T)attributes[0]).GetValue(); string propertyValue = (string)property.GetValue(this, null); sdrString += DataSDR.Format(propertyValue, numChar); } return(sdrString); }
public static void ToText(LandParcel parcel, string pathExport, ExportFileFormat formatExport) { string txtData = "#Parcel_" + parcel.FindInfo("SC").Value; if (formatExport == ExportFileFormat.NXYZC) { txtData += "\r\n# NumberPoint; Northing; Easting ; Elevation; Code"; } else if (formatExport == ExportFileFormat.NYXZC) { txtData += "\r\n# NumberPoint; Easting; Northing; Elevation; Code"; } else if (formatExport == ExportFileFormat.CREDO_DAT_TOP) { //txtData += "\r\n# NumberPoint; Code; Northing; Easting; Elevation; ???"; } int index = 0; foreach (AcGe.Point2d point in parcel.Points) { index++; if (formatExport == ExportFileFormat.NXYZC) { txtData += "\r\n" + index.ToString("0000") + "; " + point.Y.ToString("0.000").Replace(",", ".") + "; " + point.X.ToString("0.000").Replace(",", ".") + "; 0.000; точка_межі"; } else if (formatExport == ExportFileFormat.NYXZC) { txtData += "\r\n" + index.ToString("0000") + "; " + point.X.ToString("0.000").Replace(",", ".") + "; " + point.Y.ToString("0.000").Replace(",", ".") + "; 0.000; точка_межі"; } else if (formatExport == ExportFileFormat.CREDO_DAT_TOP) { txtData += "\r\n" + DataSDR.Format(index.ToString(), 8, AlignmentText.ToLeft) + " 001 " + DataSDR.Format(point.Y.ToString("0.000").Replace(",", "."), 12, AlignmentText.ToRight) + " " + DataSDR.Format(point.X.ToString("0.000").Replace(",", "."), 12, AlignmentText.ToRight) + " " + DataSDR.Format(("0.000"), 12, AlignmentText.ToRight) + " " + " 0"; } } SaveFile(txtData, pathExport); }
public string ToStringSDR <T>() where T : IFormatSDR { string sdrString = string.Empty; var properties = this.GetType().GetProperties(); foreach (PropertyInfo property in properties) { var attributes = property.GetCustomAttributes(typeof(T), false); int numChar = (int)((T)attributes[0]).GetValue(); string propertyValue = (string)property.GetValue(this, null); string propertyName = (string)property.Name; if (propertyName == "NamePoint") { sdrString += DataSDR.Format(propertyValue, numChar, AlignmentText.ToRight); } else { sdrString += DataSDR.Format(propertyValue, numChar, AlignmentText.ToLeft); } } return(sdrString); }