private static ICoordinateSequence ReadCompressedXY(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var startOrdinateValues = import.GetDoubles(buffer, ref offset, 2); var ret = factory.Create(number, import.HandleOrdinates); var x = startOrdinateValues[0]; var y = startOrdinateValues[1]; ret.SetOrdinate(0, Ordinate.X, precisionModel.MakePrecise(x)); ret.SetOrdinate(0, Ordinate.Y, precisionModel.MakePrecise(y)); if (number == 1) { return(ret); } var ordinateValues = import.GetSingles(buffer, ref offset, (number - 2) * 2); var j = 0; int i; for (i = 1; i < number - 1; i++) { x = x + ordinateValues[j++]; y = y + ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(x)); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(y)); } startOrdinateValues = import.GetDoubles(buffer, ref offset, 2); ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(startOrdinateValues[0])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(startOrdinateValues[1])); return(ret); }
private static ICoordinateSequence ReadCompressedXYZM(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var startOrdinateValues = import.GetDoubles(buffer, ref offset, 4); var ret = factory.Create(number, Ordinates.XYM); var handleZ = (ret.Ordinates & Ordinates.Z) == Ordinates.Z; var handleM = (ret.Ordinates & Ordinates.M) == Ordinates.M; var x = startOrdinateValues[0]; ret.SetOrdinate(0, Ordinate.X, precisionModel.MakePrecise(x)); var y = startOrdinateValues[1]; ret.SetOrdinate(0, Ordinate.Y, precisionModel.MakePrecise(y)); var z = handleZ ? startOrdinateValues[2] : Coordinate.NullOrdinate; ret.SetOrdinate(0, Ordinate.Z, z); var m = handleM ? startOrdinateValues[3] : Coordinate.NullOrdinate; ret.SetOrdinate(0, Ordinate.M, m); if (number == 1) { return(ret); } var ordinateValues = import.GetSingles(buffer, ref offset, (number - 2) * 4); var j = 0; int i; for (i = 1; i < number - 1; i++) { x += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(x)); y += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(y)); if (handleZ) { z += ordinateValues[j++]; } ret.SetOrdinate(i, Ordinate.Z, z); if (handleM) { m += ordinateValues[j++]; } ret.SetOrdinate(i, Ordinate.M, m); } startOrdinateValues = import.GetDoubles(buffer, ref offset, 4); ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(startOrdinateValues[0])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(startOrdinateValues[1])); z = handleZ ? startOrdinateValues[2] : Coordinate.NullOrdinate; ret.SetOrdinate(i, Ordinate.Z, z); m = handleM ? startOrdinateValues[3] : Coordinate.NullOrdinate; ret.SetOrdinate(i, Ordinate.M, m); return(ret); }
private static ICoordinateSequence ReadXYZM(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var ordinateValues = import.GetDoubles(buffer, ref offset, number * 4); var ret = factory.Create(number, import.HandleOrdinates); var handleZ = (ret.Ordinates & Ordinates.Z) == Ordinates.Z; var handleM = (ret.Ordinates & Ordinates.M) == Ordinates.M; var j = 0; for (var i = 0; i < number; i++) { ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(ordinateValues[j++])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(ordinateValues[j++])); if (handleZ) { ret.SetOrdinate(i, Ordinate.Z, precisionModel.MakePrecise(ordinateValues[j])); } j++; if (handleM) { ret.SetOrdinate(i, Ordinate.M, precisionModel.MakePrecise(ordinateValues[j])); } j++; } return(ret); }
private static ICoordinateSequence ReadXY(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var ordinateValues = import.GetDoubles(buffer, ref offset, number * 2); var ret = factory.Create(number, Ordinates.XY); var j = 0; for (var i = 0; i < number; i++) { ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(ordinateValues[j++])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(ordinateValues[j++])); } return(ret); }
private static ICoordinateSequence ReadCompressedXYZM(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var startOrdinateValues = import.GetDoubles(buffer, ref offset, 4); var ret = factory.Create(number, Ordinates.XYM); var handleZ = (ret.Ordinates & Ordinates.Z) == Ordinates.Z; var handleM = (ret.Ordinates & Ordinates.M) == Ordinates.M; var x = startOrdinateValues[0]; ret.SetOrdinate(0, Ordinate.X, precisionModel.MakePrecise(x)); var y = startOrdinateValues[1]; ret.SetOrdinate(0, Ordinate.Y, precisionModel.MakePrecise(y)); var z = handleZ ? startOrdinateValues[2] : Coordinate.NullOrdinate; ret.SetOrdinate(0, Ordinate.Z, z); var m = handleM ? startOrdinateValues[3] : Coordinate.NullOrdinate; ret.SetOrdinate(0, Ordinate.M, m); if (number == 1) return ret; var ordinateValues = import.GetSingles(buffer, ref offset, (number - 2) * 4); var j = 0; int i; for (i = 1; i < number - 1; i++) { x += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(x)); y += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(y)); if (handleZ) z += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.Z, z); if (handleM) m += ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.M, m); } startOrdinateValues = import.GetDoubles(buffer, ref offset, 4); ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(startOrdinateValues[0])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(startOrdinateValues[1])); z = handleZ ? startOrdinateValues[2] : Coordinate.NullOrdinate; ret.SetOrdinate(i, Ordinate.Z, z); m = handleM ? startOrdinateValues[3] : Coordinate.NullOrdinate; ret.SetOrdinate(i, Ordinate.M, m); return ret; }
private static ICoordinateSequence ReadCompressedXY(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var startOrdinateValues = import.GetDoubles(buffer, ref offset, 2); var ret = factory.Create(number, import.HandleOrdinates); var x = startOrdinateValues[0]; var y = startOrdinateValues[1]; ret.SetOrdinate(0, Ordinate.X, precisionModel.MakePrecise(x)); ret.SetOrdinate(0, Ordinate.Y, precisionModel.MakePrecise(y)); if (number == 1) return ret; var ordinateValues = import.GetSingles(buffer, ref offset, (number - 2) * 2); var j = 0; int i; for (i = 1; i < number - 1; i++) { x = x + ordinateValues[j++]; y = y + ordinateValues[j++]; ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(x)); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(y)); } startOrdinateValues = import.GetDoubles(buffer, ref offset, 2); ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(startOrdinateValues[0])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(startOrdinateValues[1])); return ret; }
private static ICoordinateSequence ReadXYZM(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var ordinateValues = import.GetDoubles(buffer, ref offset, number * 4); var ret = factory.Create(number, import.HandleOrdinates); var handleZ = (ret.Ordinates & Ordinates.Z) == Ordinates.Z; var handleM = (ret.Ordinates & Ordinates.M) == Ordinates.M; var j = 0; for (var i = 0; i < number; i++) { ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(ordinateValues[j++])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(ordinateValues[j++])); if (handleZ) ret.SetOrdinate(i, Ordinate.Z, precisionModel.MakePrecise(ordinateValues[j])); j++; if (handleM) ret.SetOrdinate(i, Ordinate.M, precisionModel.MakePrecise(ordinateValues[j])); j++; } return ret; }
private static ICoordinateSequence ReadXY(byte[] buffer, ref int offset, int number, GaiaImport import, ICoordinateSequenceFactory factory, IPrecisionModel precisionModel) { var ordinateValues = import.GetDoubles(buffer, ref offset, number * 2); var ret = factory.Create(number, Ordinates.XY); var j = 0; for (var i = 0; i < number; i++) { ret.SetOrdinate(i, Ordinate.X, precisionModel.MakePrecise(ordinateValues[j++])); ret.SetOrdinate(i, Ordinate.Y, precisionModel.MakePrecise(ordinateValues[j++])); } return ret; }