/// <summary> /// Converts any <see cref=GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> to the correspondant /// <see cref="SharpMap.Geometries.Geometry"/>. /// </summary> /// <param name="geometry"></param> /// <returns></returns> public static GisSharpBlog.NetTopologySuite.Geometries.Geometry ToNTSGeometry(SharpMap.Geometries.Geometry geometry, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { if (geometry == null) throw new NullReferenceException("geometry"); if (geometry.GetType() == typeof(SharpMap.Geometries.Point)) return ToNTSPoint(geometry as SharpMap.Geometries.Point, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.LineString)) return ToNTSLineString(geometry as SharpMap.Geometries.LineString, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.Polygon)) return ToNTSPolygon(geometry as SharpMap.Geometries.Polygon, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPoint)) return ToNTSMultiPoint(geometry as SharpMap.Geometries.MultiPoint, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiLineString)) return ToNTSMultiLineString(geometry as SharpMap.Geometries.MultiLineString, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPolygon)) return ToNTSMultiPolygon(geometry as SharpMap.Geometries.MultiPolygon, factory); else if (geometry.GetType() == typeof(SharpMap.Geometries.GeometryCollection)) return ToNTSGeometryCollection(geometry as SharpMap.Geometries.GeometryCollection, factory); else throw new NotSupportedException("Type " + geometry.GetType().FullName + " not supported"); }
/// <summary> /// Converts any <see cref="SharpMap.Geometries.Geometry"/> array to the correspondant /// <see cref=GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> array. /// </summary> /// <param name="geometries"></param> /// <param name="factory"></param> /// <returns></returns> public static GisSharpBlog.NetTopologySuite.Geometries.Geometry[] ToNTSGeometry(SharpMap.Geometries.Geometry[] geometries, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.Geometry[] converted = new GisSharpBlog.NetTopologySuite.Geometries.Geometry[geometries.Length]; int index = 0; foreach (SharpMap.Geometries.Geometry geometry in geometries) converted[index++] = GeometryConverter.ToNTSGeometry(geometry, factory); if((geometries.Length != converted.Length)) throw new ApplicationException("Conversion error"); return converted; }
internal static SharpMap.Geometries.Point ToSharpMapPoint(GisSharpBlog.NetTopologySuite.Geometries.Point point) { Debug.Assert(point.Coordinates.Length == 1); return ToSharpMapPoint(point.Coordinate); }
public void save(GisSharpBlog.NetTopologySuite.IO.BEBinaryWriter writer) { writer.Write(m_character_id); writer.Write(m_status); writer.Write(m_unk_02); writer.Write(m_unk_03); writer.Write(m_chara_size); writer.Write(m_team); writer.Write(m_unk_09); writer.Write(m_start_pos); writer.Write(m_unk_0B); writer.Write(m_unk_0C); writer.Write(m_unk_0D); m_easy_stats.save(writer); m_medium_stats.save(writer); m_hard_stats.save(writer); }
/// <summary> /// Creates a new row in the given <see cref="SharpMap.Data.FeatureDataTable"/> <paramref name="dataTable"/> /// using data in <see cref="GisSharpBlog.NetTopologySuite.Features.Feature"/> <paramref name="feature"/>. /// </summary> /// <param name="dataTable">The <see cref="SharpMap.Data.FeatureDataTable"/> to fill.</param> /// <param name="feature">Data to insert in the <see cref="SharpMap.Data.FeatureDataTable"/>.</param> private void CreateNewRow(SharpMap.Data.FeatureDataTable dataTable, GisSharpBlog.NetTopologySuite.Features.Feature feature) { SharpMap.Data.FeatureDataRow dataRow = dataTable.NewRow(); dataRow.Geometry = GeometryConverter.ToSharpMapGeometry(feature.Geometry); foreach (string columnName in feature.Attributes.GetNames()) dataRow[columnName] = feature.Attributes[columnName]; dataTable.AddRow(dataRow); }
/// <summary> /// Initializes a new instance of the <see cref="T:NtsProvider"/> class /// from another <see cref="SharpMap.Data.Providers.IProvider" />. /// </summary> /// <param name="provider"> /// The base <see cref="SharpMap.Data.Providers.IProvider"/> /// from witch initialize the <see cref="NtsProvider"/> instance. /// </param> /// <param name="precisionModel"> /// The <see cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel"/> /// to use for define the precision of the geometry operations. /// </param> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModels"/> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory"/> public NtsProvider(SharpMap.Data.Providers.IProvider provider, GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel precisionModel) : this(precisionModel) { BuildFromProvider(provider); }
internal static SharpMap.Geometries.MultiPolygon ToSharpMapMultiPolygon(GisSharpBlog.NetTopologySuite.Geometries.MultiPolygon multiPolygon) { SharpMap.Geometries.MultiPolygon collection = new SharpMap.Geometries.MultiPolygon(); foreach (GisSharpBlog.NetTopologySuite.Geometries.Polygon polygon in multiPolygon.Geometries) collection.Polygons.Add(ToSharpMapPolygon(polygon)); return collection; }
internal static SharpMap.Geometries.MultiPoint ToSharpMapMultiPoint(GisSharpBlog.NetTopologySuite.Geometries.MultiPoint multiPoint) { SharpMap.Geometries.MultiPoint collection = new SharpMap.Geometries.MultiPoint(); foreach(GisSharpBlog.NetTopologySuite.Geometries.Point point in multiPoint.Geometries) collection.Points.Add(ToSharpMapPoint(point)); return collection; }
internal static GisSharpBlog.NetTopologySuite.Geometries.LinearRing ToNTSLinearRing(SharpMap.Geometries.LinearRing linearRing, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.Coordinate[] coordinates = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate[linearRing.NumPoints]; int index = 0; foreach (SharpMap.Geometries.Point point in linearRing.Vertices) coordinates[index++] = ToNTSCoordinate(point, factory); return factory.CreateLinearRing(coordinates); }
internal static GisSharpBlog.NetTopologySuite.Geometries.Point ToNTSPoint(SharpMap.Geometries.Point point, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { return factory.CreatePoint(ToNTSCoordinate(point, factory)); }
internal static GisSharpBlog.NetTopologySuite.Geometries.Coordinate ToNTSCoordinate(SharpMap.Geometries.Point point, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { return new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(point.X, point.Y); }
/// <summary> /// Converts the <see cref="GisSharpBlog.NetTopologySuite.Geometries.Envelope"/> instance <paramref name="envelope"/> /// into a correspondant <see cref="SharpMap.Geometries.Geometry"/>. /// </summary> /// <param name="envelope"></param> /// <returns></returns> public static SharpMap.Geometries.Geometry ToSharpMapGeometry(GisSharpBlog.NetTopologySuite.Geometries.Envelope envelope) { return ToSharpMapGeometry(new SharpMap.Geometries.BoundingBox(envelope.MinX, envelope.MinY, envelope.MaxX, envelope.MaxY)); }
public void load(GisSharpBlog.NetTopologySuite.IO.BEBinaryReader reader) { m_offense_ratio = reader.ReadUInt16(); m_defense_ratio = reader.ReadUInt16(); m_ai = reader.ReadByte(); m_costume = reader.ReadByte(); m_stock = reader.ReadByte(); m_unk07 = reader.ReadByte(); m_hp = reader.ReadUInt16(); m_start_damage = reader.ReadUInt16(); m_unk0C = reader.ReadByte(); m_unk0D = reader.ReadByte(); }
public void save(GisSharpBlog.NetTopologySuite.IO.BEBinaryWriter writer) { writer.Write(m_offense_ratio); writer.Write(m_defense_ratio); writer.Write(m_ai); writer.Write(m_costume); writer.Write(m_stock); writer.Write(m_unk07); writer.Write(m_hp); writer.Write(m_start_damage); writer.Write(m_unk0C); writer.Write(m_unk0D); }
internal static SharpMap.Geometries.LinearRing ToSharpMapLinearRing(GisSharpBlog.NetTopologySuite.Geometries.LinearRing lineString) { Collection<SharpMap.Geometries.Point> vertices = new Collection<SharpMap.Geometries.Point>(); foreach (GisSharpBlog.NetTopologySuite.Geometries.Coordinate coordinate in lineString.Coordinates) vertices.Add(ToSharpMapPoint(coordinate)); return new SharpMap.Geometries.LinearRing(vertices); }
internal static SharpMap.Geometries.Polygon ToSharpMapPolygon(GisSharpBlog.NetTopologySuite.Geometries.Polygon polygon) { SharpMap.Geometries.LinearRing exteriorRing = ToSharpMapLinearRing((GisSharpBlog.NetTopologySuite.Geometries.LinearRing)polygon.ExteriorRing); Collection<SharpMap.Geometries.LinearRing> interiorRings = new Collection<SharpMap.Geometries.LinearRing>(); foreach (GisSharpBlog.NetTopologySuite.Geometries.LineString interiorRing in polygon.InteriorRings) interiorRings.Add(ToSharpMapLinearRing((GisSharpBlog.NetTopologySuite.Geometries.LinearRing)interiorRing)); return new SharpMap.Geometries.Polygon(exteriorRing, interiorRings); }
internal static GisSharpBlog.NetTopologySuite.Geometries.Polygon ToNTSPolygon(SharpMap.Geometries.Polygon polygon, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.LinearRing shell = ToNTSLinearRing(polygon.ExteriorRing, factory); GisSharpBlog.NetTopologySuite.Geometries.LinearRing[] holes = new GisSharpBlog.NetTopologySuite.Geometries.LinearRing[polygon.InteriorRings.Count]; int index = 0; foreach (SharpMap.Geometries.LinearRing hole in polygon.InteriorRings) holes[index++] = ToNTSLinearRing(hole, factory); return factory.CreatePolygon(shell, holes); }
internal static SharpMap.Geometries.MultiLineString ToSharpMapMultiLineString(GisSharpBlog.NetTopologySuite.Geometries.MultiLineString multiLineString) { SharpMap.Geometries.MultiLineString collection = new SharpMap.Geometries.MultiLineString(); foreach (GisSharpBlog.NetTopologySuite.Geometries.LineString lineString in multiLineString.Geometries) collection.LineStrings.Add(ToSharpMapLineString(lineString)); return collection; }
internal static GisSharpBlog.NetTopologySuite.Geometries.MultiPoint ToNTSMultiPoint(SharpMap.Geometries.MultiPoint multiPoint, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.Point[] points = new GisSharpBlog.NetTopologySuite.Geometries.Point[multiPoint.Points.Count]; int index = 0; foreach (SharpMap.Geometries.Point point in multiPoint.Points) points[index++] = ToNTSPoint(point, factory); return factory.CreateMultiPoint(points); }
internal static SharpMap.Geometries.GeometryCollection ToSharpMapGeometryCollection(GisSharpBlog.NetTopologySuite.Geometries.GeometryCollection geometryCollection) { SharpMap.Geometries.GeometryCollection collection = new SharpMap.Geometries.GeometryCollection(); foreach (GisSharpBlog.NetTopologySuite.Geometries.Geometry geometry in geometryCollection.Geometries) collection.Collection.Add(ToSharpMapGeometry(geometry)); return collection; }
internal static GisSharpBlog.NetTopologySuite.Geometries.MultiLineString ToNTSMultiLineString(SharpMap.Geometries.MultiLineString multiLineString, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.LineString[] lstrings = new GisSharpBlog.NetTopologySuite.Geometries.LineString[multiLineString.LineStrings.Count]; int index = 0; foreach (SharpMap.Geometries.LineString lstring in multiLineString.LineStrings) lstrings[index++] = ToNTSLineString(lstring, factory); return factory.CreateMultiLineString(lstrings); }
internal static GisSharpBlog.NetTopologySuite.Geometries.MultiPolygon ToNTSMultiPolygon(SharpMap.Geometries.MultiPolygon multiPolygon, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.Polygon[] polygons = new GisSharpBlog.NetTopologySuite.Geometries.Polygon[multiPolygon.Polygons.Count]; int index = 0; foreach (SharpMap.Geometries.Polygon polygon in multiPolygon.Polygons) polygons[index++] = ToNTSPolygon(polygon, factory); return factory.CreateMultiPolygon(polygons); }
internal static GisSharpBlog.NetTopologySuite.Geometries.GeometryCollection ToNTSGeometryCollection(SharpMap.Geometries.GeometryCollection geometryCollection, GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory) { GisSharpBlog.NetTopologySuite.Geometries.Geometry[] geometries = new GisSharpBlog.NetTopologySuite.Geometries.Geometry[geometryCollection.Collection.Count]; int index = 0; foreach (SharpMap.Geometries.Geometry geometry in geometryCollection.Collection) geometries[index++] = ToNTSGeometry(geometry, factory); return factory.CreateGeometryCollection(geometries); }
/// <summary> /// Initializes a new instance of the <see cref="T:NtsProvider"/> class /// from another <see cref="SharpMap.Data.Providers.IProvider" />. /// </summary> /// <param name="provider"> /// The base <see cref="SharpMap.Data.Providers.IProvider"/> /// from witch initialize the <see cref="NtsProvider"/> instance. /// </param> /// <param name="operation"> /// The <see cref="GeometryOperationDelegate"/> to apply /// to all geometry elements in the <paramref name="provider"/>. /// </param> /// <param name="precisionModel"> /// The <see cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel"/> /// to use for define the precision of the geometry operations. /// </param> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModels"/> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory"/> public NtsProvider(SharpMap.Data.Providers.IProvider provider, GeometryOperationDelegate operation, GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel precisionModel) : this(provider, precisionModel) { operation(features); }
internal static SharpMap.Geometries.Point ToSharpMapPoint(GisSharpBlog.NetTopologySuite.Geometries.Coordinate coordinate) { return new SharpMap.Geometries.Point(coordinate.X, coordinate.Y); }
/// <summary> /// Initializes a new instance of the <see cref="T:NtsProvider"/> class /// using the given <paramref name="precisionModel"/>. /// </summary> /// <param name="precisionModel"> /// The <see cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel"/> /// to use for define the precision of the geometry operations. /// </param> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.PrecisionModels"/> /// <seealso cref="GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory"/> protected internal NtsProvider(GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel precisionModel) { geometryFactory = new GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory(precisionModel); }
public void load(GisSharpBlog.NetTopologySuite.IO.BEBinaryReader reader) { m_character_id = reader.ReadByte(); m_status = reader.ReadByte(); m_unk_02 = reader.ReadByte(); m_unk_03 = reader.ReadByte(); m_chara_size = reader.ReadSingle(); m_team = reader.ReadByte(); m_unk_09 = reader.ReadByte(); m_start_pos = reader.ReadByte(); m_unk_0B = reader.ReadByte(); m_unk_0C = reader.ReadByte(); m_unk_0D = reader.ReadByte(); m_easy_stats.load(reader); m_medium_stats.load(reader); m_hard_stats.load(reader); }