protected Geometry(GeoJsonType type) : base(type) { if (!DerivedTypeToType.ContainsKey(type)) { throw new ArgumentException($"The type {type} is not a valid geometry type."); } }
protected Geometry(GeoJsonType type, bool is3D, IEnumerable <double> boundingBox = null) : base(type, is3D, boundingBox) { if (!DerivedTypeToType.ContainsKey(type)) { throw new ArgumentException($"The type {type} is not a valid geometry type."); } }
/// <summary> /// Gets the appropriate class type corresponding to the enum /// representing the type /// </summary> /// <param name="type"></param> /// <returns></returns> public new static Type GetType(GeoJsonType type) { if (DerivedTypeToType.ContainsKey(type)) { return(DerivedTypeToType[type]); } else { throw new ArgumentException($"The type {type} is not a valid geometry type."); } }
/// <summary> /// Base constructor that all derived classes must implement /// </summary> /// <param name="type">The type of the GeoJson object</param> protected GeoJson(GeoJsonType type, bool is3D, IEnumerable <double> boundingBox = null) { this.Type = type; this.BoundingBox = boundingBox; this.Is3D = is3D; if (this.BoundingBox != null) { int Length = boundingBox.Count(); if (this.Is3D && Length != 6) { throw new ArgumentOutOfRangeException("boundingBox", "The bounding box must contain 6 elements for a 3D GeoJSON object."); } else if (!this.Is3D && Length != 4) { throw new ArgumentOutOfRangeException("boundingBox", "The bounding box must contain 4 elements for a 2D GeoJSON object."); } } }
/// <summary> /// Initializes a new instance of the specified <paramref name="type"/>. /// </summary> /// <param name="type">The type of the shape.</param> protected GeoJsonGeometry(GeoJsonType type) : base(type) { }
/// <summary> /// Gets the appropriate class type corresponding to the enum /// representing the type /// </summary> /// <param name="type">The GeoJson type of the </param> /// <returns>The .NET type that corresponds to the GeoJson type</returns> public static Type GetType(GeoJsonType type) { return(DerivedTypeToType[type]); }
public MyGeojson(GeoJsonType type, bool is3D, IEnumerable <double> boundingBox, string guid) : base(type, is3D, boundingBox = null) { this.guid = guid; }
/// <summary> /// Initializes a new instance of the specified <paramref name="type"/>. /// </summary> /// <param name="type">The type of the object.</param> protected GeoJsonObject(GeoJsonType type) { Type = type; }
/// <summary> /// Initializes a new instance based on the specified <paramref name="type"/> and <paramref name="json"/>. /// </summary> /// <param name="type">The type of the feature.</param> /// <param name="json">An instance of <see cref="JObject"/> representing the feature.</param> protected GeoJsonFeatureBase(GeoJsonType type, JObject json) : base(type) { Properties = json.GetObject <GeoJsonProperties>("properties"); }
/// <summary> /// Initializes a new instance with the specified <paramref name="type"/>. /// </summary> /// <param name="type">The type of the feature.</param> protected GeoJsonFeatureBase(GeoJsonType type) : base(type) { Properties = new GeoJsonProperties(); }
/// <summary> /// Base constructor that all derived classes must implement /// </summary> /// <param name="type"></param> protected GeoJson(GeoJsonType type) { this.Type = type; this.BoundingBox = null; }