public static void Write(IGISAttributes attributes, JsonTextWriter jwriter, string[] nonSerializedFields) { if (attributes == null) { return; } if (jwriter == null) { throw new ArgumentNullException("jwriter", "A valid JSON writer object is required."); } jwriter.WriteStartObject(); IEnumerable <string> names = attributes.GetKeys(); foreach (string name in names) { if (nonSerializedFields != null && Contains(nonSerializedFields, name)) { continue; } jwriter.WriteMember(name); jwriter.WriteString(attributes.GetValue(name).ToString()); } jwriter.WriteEndObject(); }
public static void ReadGISAttributes(IGISAttributes attributes, JsonTextReader jreader) { if (attributes == null) { throw new ArgumentNullException("attributes", "A valid attributes reference is required."); } if (jreader == null) { throw new ArgumentNullException("jreader", "A valid JSON reader object is required."); } if (jreader.MoveToContent() && jreader.TokenClass == JsonTokenClass.Object) { jreader.ReadToken(JsonTokenClass.Object); while (jreader.TokenClass == JsonTokenClass.Member) { string key = jreader.ReadMember(); string value = jreader.ReadString(); attributes.SetValue(key, value); } jreader.ReadToken(JsonTokenClass.EndObject); } }
public static void Write(IGISAttributes attributes, TextWriter writer) { if (attributes == null) { throw new ArgumentNullException("attributes"); } if (writer == null) { throw new ArgumentNullException("writer"); } Write(attributes, XmlWriter.Create(writer)); }
public static void Write(IGISAttributes attributes, TextWriter writer, string[] nonSerializedFields) { if (attributes == null) { return; } if (writer == null) { throw new ArgumentNullException("writer", "A valid text writer object is required."); } JsonTextWriter jwriter = new JsonTextWriter(writer); Write(attributes, jwriter, nonSerializedFields); }
public static void ReadGISAttributes(IGISAttributes attributes, TextReader reader) { if (attributes == null) { throw new ArgumentNullException("attributes", "A valid attributes reference is required."); } if (reader == null) { throw new ArgumentNullException("reader", "A valid reader object is required."); } JsonTextReader jreader = new JsonTextReader(reader); ReadGISAttributes(attributes, jreader); }
public static void Write(IGISAttributes attributes, XmlWriter xwriter) { if (attributes == null) { throw new ArgumentNullException("attributes"); } if (xwriter == null) { throw new ArgumentNullException("xwriter"); } xwriter.WriteStartElement("Attributes"); IEnumerable <string> names = attributes.GetKeys(); foreach (string name in names) { xwriter.WriteStartElement("item"); //write the key xwriter.WriteElementString("key", name); //write the qualified type name of the value //write the value object value = attributes.GetValue(name); if (value == null) { xwriter.WriteElementString("type", null); xwriter.WriteElementString("value", null); } else { TypeConverter typeConverter = TypeDescriptor.GetConverter(value.GetType()); xwriter.WriteElementString("type", value.GetType().AssemblyQualifiedName); xwriter.WriteElementString("value", typeConverter.ConvertToString(value)); } xwriter.WriteEndElement(); } xwriter.WriteEndElement(); }
public GISFeature(IGISAttributes attributes) { _attributes = attributes; }
public GISLineStringFeature(IGISAttributes attributes) : base(attributes) { }
public GeometryCollectionFeature(IGISAttributes attributes) : base(attributes) { }
public static void ReadGISAttributes(IGISAttributes attributes, JsonTextReader jreader) { if (attributes == null) throw new ArgumentNullException("attributes", "A valid attributes reference is required."); if (jreader == null) throw new ArgumentNullException("jreader", "A valid JSON reader object is required."); if (jreader.MoveToContent() && jreader.TokenClass == JsonTokenClass.Object) { jreader.ReadToken(JsonTokenClass.Object); while (jreader.TokenClass == JsonTokenClass.Member) { string key = jreader.ReadMember(); string value = jreader.ReadString(); attributes.SetValue(key, value); } jreader.ReadToken(JsonTokenClass.EndObject); } }
public static void Write(IGISAttributes attributes, TextWriter writer, string[] nonSerializedFields) { if (attributes == null) return; if (writer == null) throw new ArgumentNullException("writer", "A valid text writer object is required."); JsonTextWriter jwriter = new JsonTextWriter(writer); Write(attributes, jwriter, nonSerializedFields); }
public static void Write(IGISAttributes attributes, JsonTextWriter jwriter, string[] nonSerializedFields) { if (attributes == null) return; if (jwriter == null) throw new ArgumentNullException("jwriter", "A valid JSON writer object is required."); jwriter.WriteStartObject(); IEnumerable<string> names = attributes.GetKeys(); foreach (string name in names) { if (nonSerializedFields != null && Contains(nonSerializedFields, name)) continue; jwriter.WriteMember(name); jwriter.WriteString(attributes.GetValue(name).ToString()); } jwriter.WriteEndObject(); }
public static void Write(IGISAttributes attributes, JsonTextWriter jwriter) { Write(attributes, jwriter, null); }
public GISPointFeature(IGISAttributes attributes) : base(attributes) { }
public GISPolygonFeature(IGISAttributes attributes) : base(attributes) { }
public static void Write(IGISAttributes attributes, TextWriter writer) { Write(attributes, writer, null); }
// Creates a SqlCommand for inserting a DataRow public static SqlCommand CreateInsertCommand(string tableName, string shapeFieldName, IEnumerator <DataColumn> columns, IGISAttributes feature) { if (string.IsNullOrEmpty(tableName)) { throw new ArgumentNullException("tableName"); } if (columns == null) { throw new ArgumentNullException("columns"); } if (feature == null) { throw new ArgumentNullException("feature"); } string sql = BuildInsertSQL(tableName, columns, shapeFieldName); SqlCommand command = new SqlCommand(sql); command.CommandType = System.Data.CommandType.Text; columns.Reset(); while (columns.MoveNext()) { DataColumn column = columns.Current; if (!column.AutoIncrement) { string parameterName = "@" + column.ColumnName; if (column.DataType == typeof(SqlGeography)) { SqlGeography geog = feature.GetValue(column.ColumnName) as SqlGeography; InsertGeographyParameter(command, parameterName, column.ColumnName, geog); } else if (column.DataType == typeof(SqlGeometry)) { SqlGeometry geom = feature.GetValue(column.ColumnName) as SqlGeometry; InsertGeometryParameter(command, parameterName, column.ColumnName, geom); } else { object val = feature.GetValue(column.ColumnName); InsertParameter(command, parameterName, column.ColumnName, val, GetSqlDbType(column.DataType)); } } } return(command); }
public static void ReadGISAttributes(IGISAttributes attributes, TextReader reader) { if (attributes == null) throw new ArgumentNullException("attributes", "A valid attributes reference is required."); if (reader == null) throw new ArgumentNullException("reader", "A valid reader object is required."); JsonTextReader jreader = new JsonTextReader(reader); ReadGISAttributes(attributes, jreader); }