From de3f399a995d1d4bae9c3a477af230693dbeffbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Thu, 3 Sep 2026 00:51:51 +0200 Subject: [PATCH] Answer a MEOS base value as the class the model gives it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The object layer types a method by the class the catalog assigns each C type, and the value types had none: a method taking a geometry, a text, a circular buffer or a network point was deferred to the flat surface however ordinary it was. The catalog carries a class for each of them now, so those methods reach the object layer — `Cbuffer.Point()` answers a `Geo`, `TGeo.AtGeom(Geo)` restricts a trip to a polygon, `Text.Upper()` answers a `Text` — and the layer holds 108 classes and 1122 methods against 94 and 646, with 171 deferrals against 246. What a class's instances are a pointer to comes from the catalog as well. The generator held a map of nine C structs, which is what made a class the model gains one the binding cannot reach: it reads `classes..cType` instead, and wraps a pointer in the shallowest class carrying that struct, so a `GSERIALIZED *` is a `Geo` with `Geometry` and `Geography` distinct classes under it. The companion hierarchies are read from the model too, rather than named, so a hierarchy it gains needs no edit here. Four tests read the values back: a text upper-cased and title-cased, a geometry's SRID and text, a circular buffer answering its centre as a geometry, and a temporal geometry restricted by one, which ends where the trip leaves the polygon rather than where the trip ends. The deferrals left name no MEOS class: an `Interval *`, the `uint8_t *` WKB buffers with their `size_t *` length, the double-pointer out-parameters, and the vendored `JsonPath *`, `PCSCHEMA *` and `Match *` structs. --- MEOS.NET.Tests/ValueClassTests.cs | 62 +++ MEOS.NET/Types/Cbuffer.g.cs | 111 ++++++ MEOS.NET/Types/CbufferSet.g.cs | 28 ++ MEOS.NET/Types/Geo.g.cs | 161 ++++++++ MEOS.NET/Types/Geography.g.cs | 63 +++ MEOS.NET/Types/GeomSet.g.cs | 28 ++ MEOS.NET/Types/Geometry.g.cs | 153 ++++++++ MEOS.NET/Types/Jsonb.g.cs | 124 ++++++ MEOS.NET/Types/MEOSFactory.g.cs | 560 ++++++++++++++++++++------- MEOS.NET/Types/Npoint.g.cs | 99 +++++ MEOS.NET/Types/NpointSet.g.cs | 28 ++ MEOS.NET/Types/Nsegment.g.cs | 72 ++++ MEOS.NET/Types/Pcpatch.g.cs | 75 ++++ MEOS.NET/Types/Pcpoint.g.cs | 47 +++ MEOS.NET/Types/Pose.g.cs | 159 ++++++++ MEOS.NET/Types/PoseChain.g.cs | 145 +++++++ MEOS.NET/Types/PoseSet.g.cs | 28 ++ MEOS.NET/Types/Raquet.g.cs | 81 ++++ MEOS.NET/Types/STBox.g.cs | 9 + MEOS.NET/Types/TCbuffer.g.cs | 30 ++ MEOS.NET/Types/TCbufferInst.g.cs | 3 + MEOS.NET/Types/TCbufferSeq.g.cs | 6 + MEOS.NET/Types/TCbufferSeqSet.g.cs | 3 + MEOS.NET/Types/TGeo.g.cs | 36 ++ MEOS.NET/Types/TJsonb.g.cs | 138 +++++++ MEOS.NET/Types/TJsonbInst.g.cs | 3 + MEOS.NET/Types/TJsonbSeq.g.cs | 6 + MEOS.NET/Types/TJsonbSeqSet.g.cs | 3 + MEOS.NET/Types/TNpoint.g.cs | 33 ++ MEOS.NET/Types/TNpointInst.g.cs | 3 + MEOS.NET/Types/TNpointSeq.g.cs | 6 + MEOS.NET/Types/TNpointSeqSet.g.cs | 3 + MEOS.NET/Types/TPCBox.g.cs | 261 +++++++++++++ MEOS.NET/Types/TPoint.g.cs | 21 + MEOS.NET/Types/TPose.g.cs | 33 ++ MEOS.NET/Types/TPoseInst.g.cs | 3 + MEOS.NET/Types/TPoseSeq.g.cs | 6 + MEOS.NET/Types/TPoseSeqSet.g.cs | 3 + MEOS.NET/Types/TRGeometry.g.cs | 36 ++ MEOS.NET/Types/TRGeometryInst.g.cs | 3 + MEOS.NET/Types/TRGeometrySeq.g.cs | 19 + MEOS.NET/Types/TRGeometrySeqSet.g.cs | 19 + MEOS.NET/Types/TText.g.cs | 24 ++ MEOS.NET/Types/TTextInst.g.cs | 3 + MEOS.NET/Types/TTextSeq.g.cs | 6 + MEOS.NET/Types/TTextSeqSet.g.cs | 3 + MEOS.NET/Types/Text.g.cs | 39 ++ MEOS.NET/Types/TextSet.g.cs | 28 ++ MEOS.NET/Types/Value.g.cs | 17 + tools/objectgen.py | 63 +-- 50 files changed, 2734 insertions(+), 159 deletions(-) create mode 100644 MEOS.NET.Tests/ValueClassTests.cs create mode 100644 MEOS.NET/Types/Cbuffer.g.cs create mode 100644 MEOS.NET/Types/Geo.g.cs create mode 100644 MEOS.NET/Types/Geography.g.cs create mode 100644 MEOS.NET/Types/Geometry.g.cs create mode 100644 MEOS.NET/Types/Jsonb.g.cs create mode 100644 MEOS.NET/Types/Npoint.g.cs create mode 100644 MEOS.NET/Types/Nsegment.g.cs create mode 100644 MEOS.NET/Types/Pcpatch.g.cs create mode 100644 MEOS.NET/Types/Pcpoint.g.cs create mode 100644 MEOS.NET/Types/Pose.g.cs create mode 100644 MEOS.NET/Types/PoseChain.g.cs create mode 100644 MEOS.NET/Types/Raquet.g.cs create mode 100644 MEOS.NET/Types/TPCBox.g.cs create mode 100644 MEOS.NET/Types/Text.g.cs create mode 100644 MEOS.NET/Types/Value.g.cs diff --git a/MEOS.NET.Tests/ValueClassTests.cs b/MEOS.NET.Tests/ValueClassTests.cs new file mode 100644 index 0000000..ea62cb5 --- /dev/null +++ b/MEOS.NET.Tests/ValueClassTests.cs @@ -0,0 +1,62 @@ +using MEOS.NET.Types; + +namespace MEOS.NET.Tests +{ + /// + /// A base value MEOS passes by reference is a class of its own, so a method + /// taking or answering one says which value it means rather than handing back + /// a pointer. + /// + [TestClass] + public class ValueClassTests : MeosTest + { + [TestMethod] + public void ATextAnswersTheTextMeosWritesItAs() + { + Text text = Text.In("mobility")!; + + Assert.AreEqual("mobility", text.ToString()); + Assert.AreEqual("MOBILITY", text.Upper()!.ToString()); + Assert.AreEqual("Mobility", text.Initcap()!.ToString()); + } + + [TestMethod] + public void AGeometryIsAGeoAndAnswersItsOwnMeasures() + { + Geo square = Geo.FromText("POLYGON((0 0,0 2,2 2,2 0,0 0))", 4326)!; + + Assert.IsInstanceOfType(square, typeof(Geo)); + Assert.AreEqual(4326, square.SRID()); + StringAssert.StartsWith(square.AsText(6), "POLYGON("); + } + + [TestMethod] + public void ACbufferAnswersItsCentreAsAGeometry() + { + Cbuffer buffer = Cbuffer.In("Cbuffer(Point(1 1),5)")!; + + Assert.AreEqual(5.0, buffer.Radius()); + + Geo? centre = buffer.Point(); + + Assert.IsNotNull(centre); + Assert.AreEqual("POINT(1 1)", centre!.AsText(6)); + } + + [TestMethod] + public void ATemporalGeoIsRestrictedByAGeometry() + { + Temporal trip = TGeomPoint.In( + "[POINT(0 0)@2024-12-06, POINT(4 4)@2024-12-08]")!; + Geo half = Geo.FromText("POLYGON((0 0,0 2,2 2,2 0,0 0))", 0)!; + + Temporal? inside = ((TGeo)trip).AtGeom(half); + + // The trip leaves the square at (2,2), halfway along, so what the + // restriction answers ends there rather than at the trip's own end. + Assert.IsNotNull(inside); + StringAssert.Contains(inside!.ToString(), "2024-12-07"); + Assert.IsFalse(inside.ToString().Contains("2024-12-08")); + } + } +} diff --git a/MEOS.NET/Types/Cbuffer.g.cs b/MEOS.NET/Types/Cbuffer.g.cs new file mode 100644 index 0000000..c0e1ff3 --- /dev/null +++ b/MEOS.NET/Types/Cbuffer.g.cs @@ -0,0 +1,111 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Cbuffer class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Cbuffer : Value + { + internal Cbuffer(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public string AsEWKT(int maxdd) + => Meos.CbufferAsEwkt(this.Ptr, maxdd); + + public string AsText(int maxdd) + => Meos.CbufferAsText(this.Ptr, maxdd); + + public int Cmp(Cbuffer cb2) + => Meos.CbufferCmp(this.Ptr, cb2.Ptr); + + public Cbuffer? Copy() + => MEOSFactory.WrapCbuffer(Meos.CbufferCopy(this.Ptr)); + + public bool Eq(Cbuffer cb2) + => Meos.CbufferEq(this.Ptr, cb2.Ptr); + + public bool Ge(Cbuffer cb2) + => Meos.CbufferGe(this.Ptr, cb2.Ptr); + + public bool Gt(Cbuffer cb2) + => Meos.CbufferGt(this.Ptr, cb2.Ptr); + + public uint Hash() + => Meos.CbufferHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.CbufferHashExtended(this.Ptr, seed); + + public bool Le(Cbuffer cb2) + => Meos.CbufferLe(this.Ptr, cb2.Ptr); + + public bool Lt(Cbuffer cb2) + => Meos.CbufferLt(this.Ptr, cb2.Ptr); + + public bool Ne(Cbuffer cb2) + => Meos.CbufferNe(this.Ptr, cb2.Ptr); + + public bool Nsame(Cbuffer cb2) + => Meos.CbufferNsame(this.Ptr, cb2.Ptr); + + public string Out(int maxdd) + => Meos.CbufferOut(this.Ptr, maxdd); + + public Geo? Point() + => MEOSFactory.WrapGeo(Meos.CbufferPoint(this.Ptr)); + + public double Radius() + => Meos.CbufferRadius(this.Ptr); + + public Cbuffer? Round(int maxdd) + => MEOSFactory.WrapCbuffer(Meos.CbufferRound(this.Ptr, maxdd)); + + public int SRID() + => Meos.CbufferSrid(this.Ptr); + + public bool Same(Cbuffer cb2) + => Meos.CbufferSame(this.Ptr, cb2.Ptr); + + public Cbuffer? SetSRID(int srid) + => MEOSFactory.WrapCbuffer(Meos.CbufferSetSrid(this.Ptr, srid)); + + public STBox? TimestamptzToStbox(DateTime t) + => MEOSFactory.WrapSTBox(Meos.CbufferTimestamptzToStbox(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Geo? ToGeom() + => MEOSFactory.WrapGeo(Meos.CbufferToGeom(this.Ptr)); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.CbufferToSet(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.CbufferToStbox(this.Ptr)); + + public Cbuffer? Transform(int srid) + => MEOSFactory.WrapCbuffer(Meos.CbufferTransform(this.Ptr, srid)); + + public Cbuffer? TransformPipeline(string pipelinestr, int srid, bool is_forward) + => MEOSFactory.WrapCbuffer(Meos.CbufferTransformPipeline(this.Ptr, pipelinestr, srid, is_forward)); + + public STBox? TstzspanToStbox(Span s) + => MEOSFactory.WrapSTBox(Meos.CbufferTstzspanToStbox(this.Ptr, s.Ptr)); + + public static Cbuffer? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapCbuffer(Meos.CbufferFromHexwkb(hexwkb)); + + public static Cbuffer? In(string str) + => MEOSFactory.WrapCbuffer(Meos.CbufferIn(str)); + + public static Cbuffer? Make(Geo point, double radius) + => MEOSFactory.WrapCbuffer(Meos.CbufferMake(point.Ptr, radius)); + + } +} diff --git a/MEOS.NET/Types/CbufferSet.g.cs b/MEOS.NET/Types/CbufferSet.g.cs index 755bbbe..d24c9ee 100644 --- a/MEOS.NET/Types/CbufferSet.g.cs +++ b/MEOS.NET/Types/CbufferSet.g.cs @@ -17,11 +17,39 @@ internal CbufferSet(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(15); + public Cbuffer? EndValue() + => MEOSFactory.WrapCbuffer(Meos.CbuffersetEndValue(this.Ptr)); + public string Out(int maxdd) => Meos.CbuffersetOut(this.Ptr, maxdd); + public Cbuffer? StartValue() + => MEOSFactory.WrapCbuffer(Meos.CbuffersetStartValue(this.Ptr)); + + public Cbuffer?[] Values() + => MEOSFactory.WrapCbufferArray(Meos.CbuffersetValues(this.Ptr)); + public static Set? In(string str) => MEOSFactory.WrapSet(Meos.CbuffersetIn(str)); + public static Set? Make(Cbuffer[] values) + { + IntPtr[] _valuesValues = new IntPtr[values.Length]; + for (int i = 0; i < values.Length; i++) + { + _valuesValues[i] = values[i].Ptr; + } + + GCHandle _values = GCHandle.Alloc(_valuesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapSet(Meos.CbuffersetMake(_values.AddrOfPinnedObject(), values.Length)); + } + finally + { + _values.Free(); + } + } + } } diff --git a/MEOS.NET/Types/Geo.g.cs b/MEOS.NET/Types/Geo.g.cs new file mode 100644 index 0000000..6e2f856 --- /dev/null +++ b/MEOS.NET/Types/Geo.g.cs @@ -0,0 +1,161 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// PostGIS-derived values, both of them a GSERIALIZED. Parent of Geometry and Geography exactly as TGeo parents TGeometry and TGeography, so a signature naming the C type alone is typed by the parent and the two spellings stay distinct classes. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Geo : Value + { + internal Geo(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(); + + public string AsEWKT(int precision) + => Meos.GeoAsEwkt(this.Ptr, precision); + + public string AsGEOJSON(int option, int precision, string srs) + => Meos.GeoAsGeojson(this.Ptr, option, precision, srs); + + public string AsHexewkb(string endian) + => Meos.GeoAsHexewkb(this.Ptr, endian); + + public string AsText(int precision) + => Meos.GeoAsText(this.Ptr, precision); + + public Geo? Copy() + => MEOSFactory.WrapGeo(Meos.GeoCopy(this.Ptr)); + + public int Equals(Geo gs2) + => Meos.GeoEquals(this.Ptr, gs2.Ptr); + + public Geo? GeoN(int n) + => MEOSFactory.WrapGeo(Meos.GeoGeoN(this.Ptr, n)); + + public bool IsEmpty() + => Meos.GeoIsEmpty(this.Ptr); + + public bool IsUnitary() + => Meos.GeoIsUnitary(this.Ptr); + + public int NumGeos() + => Meos.GeoNumGeos(this.Ptr); + + public int NumPoints() + => Meos.GeoNumPoints(this.Ptr); + + public string Out() + => Meos.GeoOut(this.Ptr); + + public Geo?[] Pointarr() + => MEOSFactory.WrapGeoArray(Meos.GeoPointarr(this.Ptr)); + + public Geo? Points() + => MEOSFactory.WrapGeo(Meos.GeoPoints(this.Ptr)); + + public Geo? Reverse() + => MEOSFactory.WrapGeo(Meos.GeoReverse(this.Ptr)); + + public Geo? Round(int maxdd) + => MEOSFactory.WrapGeo(Meos.GeoRound(this.Ptr, maxdd)); + + public int SRID() + => Meos.GeoSrid(this.Ptr); + + public bool Same(Geo gs2) + => Meos.GeoSame(this.Ptr, gs2.Ptr); + + public Geo? SetSRID(int srid) + => MEOSFactory.WrapGeo(Meos.GeoSetSrid(this.Ptr, srid)); + + public STBox?[] SplitEachNStboxes(int elem_count) + => MEOSFactory.WrapSTBoxArray(Meos.GeoSplitEachNStboxes(this.Ptr, elem_count)); + + public STBox?[] SplitNStboxes(int box_count) + => MEOSFactory.WrapSTBoxArray(Meos.GeoSplitNStboxes(this.Ptr, box_count)); + + public STBox?[] Stboxes() + => MEOSFactory.WrapSTBoxArray(Meos.GeoStboxes(this.Ptr)); + + public STBox? TimestamptzToStbox(DateTime t) + => MEOSFactory.WrapSTBox(Meos.GeoTimestamptzToStbox(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public ulong ToH3indexCell(int resolution) + => Meos.GeoToH3indexCell(this.Ptr, resolution); + + public Set? ToH3indexSet(int resolution) + => MEOSFactory.WrapSet(Meos.GeoToH3indexSet(this.Ptr, resolution)); + + public ulong ToQuadbinCell(int resolution) + => Meos.GeoToQuadbinCell(this.Ptr, resolution); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.GeoToSet(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.GeoToStbox(this.Ptr)); + + public Geo? Transform(int srid_to) + => MEOSFactory.WrapGeo(Meos.GeoTransform(this.Ptr, srid_to)); + + public Geo? TransformPipeline(string pipeline, int srid_to, bool is_forward) + => MEOSFactory.WrapGeo(Meos.GeoTransformPipeline(this.Ptr, pipeline, srid_to, is_forward)); + + public STBox? TstzspanToStbox(Span s) + => MEOSFactory.WrapSTBox(Meos.GeoTstzspanToStbox(this.Ptr, s.Ptr)); + + public static Geo? CollectGarray(Geo[] gsarr) + { + IntPtr[] _gsarrValues = new IntPtr[gsarr.Length]; + for (int i = 0; i < gsarr.Length; i++) + { + _gsarrValues[i] = gsarr[i].Ptr; + } + + GCHandle _gsarr = GCHandle.Alloc(_gsarrValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapGeo(Meos.GeoCollectGarray(_gsarr.AddrOfPinnedObject(), gsarr.Length)); + } + finally + { + _gsarr.Free(); + } + } + + public static Geo? FromGEOJSON(string geojson) + => MEOSFactory.WrapGeo(Meos.GeoFromGeojson(geojson)); + + public static Geo? FromText(string wkt, int srid) + => MEOSFactory.WrapGeo(Meos.GeoFromText(wkt, srid)); + + public static Geo? MakelineGarray(Geo[] gsarr) + { + IntPtr[] _gsarrValues = new IntPtr[gsarr.Length]; + for (int i = 0; i < gsarr.Length; i++) + { + _gsarrValues[i] = gsarr[i].Ptr; + } + + GCHandle _gsarr = GCHandle.Alloc(_gsarrValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapGeo(Meos.GeoMakelineGarray(_gsarr.AddrOfPinnedObject(), gsarr.Length)); + } + finally + { + _gsarr.Free(); + } + } + + public static string? Typename(int type) + => Meos.GeoTypename(type); + + } +} diff --git a/MEOS.NET/Types/Geography.g.cs b/MEOS.NET/Types/Geography.g.cs new file mode 100644 index 0000000..6a6c7a6 --- /dev/null +++ b/MEOS.NET/Types/Geography.g.cs @@ -0,0 +1,63 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Geography class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Geography : Geo + { + internal Geography(IntPtr ptr) : base(ptr) { } + + public double Area(bool use_spheroid) + => Meos.GeogArea(this.Ptr, use_spheroid); + + public Geo? Centroid(bool use_spheroid) + => MEOSFactory.WrapGeo(Meos.GeogCentroid(this.Ptr, use_spheroid)); + + public double Distance(Geo g2) + => Meos.GeogDistance(this.Ptr, g2.Ptr); + + public bool Dwithin(Geo g2, double tolerance, bool use_spheroid) + => Meos.GeogDwithin(this.Ptr, g2.Ptr, tolerance, use_spheroid); + + public double Length(bool use_spheroid) + => Meos.GeogLength(this.Ptr, use_spheroid); + + public double Perimeter(bool use_spheroid) + => Meos.GeogPerimeter(this.Ptr, use_spheroid); + + public Geo? ToGeom() + => MEOSFactory.WrapGeo(Meos.GeogToGeom(this.Ptr)); + + public static Geo? ArrayUnion(Geo[] gsarr) + { + IntPtr[] _gsarrValues = new IntPtr[gsarr.Length]; + for (int i = 0; i < gsarr.Length; i++) + { + _gsarrValues[i] = gsarr[i].Ptr; + } + + GCHandle _gsarr = GCHandle.Alloc(_gsarrValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapGeo(Meos.GeogArrayUnion(_gsarr.AddrOfPinnedObject(), gsarr.Length)); + } + finally + { + _gsarr.Free(); + } + } + + public static Geo? FromHexewkb(string wkt) + => MEOSFactory.WrapGeo(Meos.GeogFromHexewkb(wkt)); + + public static Geo? In(string str, int typmod) + => MEOSFactory.WrapGeo(Meos.GeogIn(str, typmod)); + + } +} diff --git a/MEOS.NET/Types/GeomSet.g.cs b/MEOS.NET/Types/GeomSet.g.cs index f091385..8c02b00 100644 --- a/MEOS.NET/Types/GeomSet.g.cs +++ b/MEOS.NET/Types/GeomSet.g.cs @@ -13,8 +13,36 @@ public class GeomSet : Set { internal GeomSet(IntPtr ptr) : base(ptr) { } + public Geo? EndValue() + => MEOSFactory.WrapGeo(Meos.GeosetEndValue(this.Ptr)); + + public Geo? StartValue() + => MEOSFactory.WrapGeo(Meos.GeosetStartValue(this.Ptr)); + + public Geo?[] Values() + => MEOSFactory.WrapGeoArray(Meos.GeosetValues(this.Ptr)); + public static Set? In(string str) => MEOSFactory.WrapSet(Meos.GeomsetIn(str)); + public static Set? Make(Geo[] values) + { + IntPtr[] _valuesValues = new IntPtr[values.Length]; + for (int i = 0; i < values.Length; i++) + { + _valuesValues[i] = values[i].Ptr; + } + + GCHandle _values = GCHandle.Alloc(_valuesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapSet(Meos.GeosetMake(_values.AddrOfPinnedObject(), values.Length)); + } + finally + { + _values.Free(); + } + } + } } diff --git a/MEOS.NET/Types/Geometry.g.cs b/MEOS.NET/Types/Geometry.g.cs new file mode 100644 index 0000000..36b71c4 --- /dev/null +++ b/MEOS.NET/Types/Geometry.g.cs @@ -0,0 +1,153 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Geometry class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Geometry : Geo + { + internal Geometry(IntPtr ptr) : base(ptr) { } + + public double? Azimuth(Geo gs2) + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.GeomAzimuth(this.Ptr, gs2.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public Geo? Boundary() + => MEOSFactory.WrapGeo(Meos.GeomBoundary(this.Ptr)); + + public Geo? Buffer(double size, string @params) + => MEOSFactory.WrapGeo(Meos.GeomBuffer(this.Ptr, size, @params)); + + public Geo? Centroid() + => MEOSFactory.WrapGeo(Meos.GeomCentroid(this.Ptr)); + + public Geo? ConvexHull() + => MEOSFactory.WrapGeo(Meos.GeomConvexHull(this.Ptr)); + + public bool Covers(Geo gs2) + => Meos.GeomCovers(this.Ptr, gs2.Ptr); + + public Geo? Difference2d(Geo gs2) + => MEOSFactory.WrapGeo(Meos.GeomDifference2d(this.Ptr, gs2.Ptr)); + + public bool Disjoint2d(Geo gs2) + => Meos.GeomDisjoint2d(this.Ptr, gs2.Ptr); + + public double Distance2d(Geo gs2) + => Meos.GeomDistance2d(this.Ptr, gs2.Ptr); + + public double Distance3d(Geo gs2) + => Meos.GeomDistance3d(this.Ptr, gs2.Ptr); + + public bool Dwithin(Geo gs2, double tolerance) + => Meos.GeomDwithin(this.Ptr, gs2.Ptr, tolerance); + + public bool Dwithin2d(Geo gs2, double tolerance) + => Meos.GeomDwithin2d(this.Ptr, gs2.Ptr, tolerance); + + public bool Dwithin3d(Geo gs2, double tolerance) + => Meos.GeomDwithin3d(this.Ptr, gs2.Ptr, tolerance); + + public Geo? Intersection2d(Geo gs2) + => MEOSFactory.WrapGeo(Meos.GeomIntersection2d(this.Ptr, gs2.Ptr)); + + public Geo? Intersection2dColl(Geo gs2) + => MEOSFactory.WrapGeo(Meos.GeomIntersection2dColl(this.Ptr, gs2.Ptr)); + + public bool Intersects2d(Geo gs2) + => Meos.GeomIntersects2d(this.Ptr, gs2.Ptr); + + public bool Intersects3d(Geo gs2) + => Meos.GeomIntersects3d(this.Ptr, gs2.Ptr); + + public bool IsSimple() + => Meos.GeomIsSimple(this.Ptr); + + public double Length() + => Meos.GeomLength(this.Ptr); + + public double MaxDistance2d(Geo gs2) + => Meos.GeomMaxDistance2d(this.Ptr, gs2.Ptr); + + public Geo? OrientedEnvelope() + => MEOSFactory.WrapGeo(Meos.GeomOrientedEnvelope(this.Ptr)); + + public double Perimeter() + => Meos.GeomPerimeter(this.Ptr); + + public string Relate(Geo gs2) + => Meos.GeomRelate(this.Ptr, gs2.Ptr); + + public bool RelatePattern(Geo gs2, string patt) + => Meos.GeomRelatePattern(this.Ptr, gs2.Ptr, patt); + + public Geo? Shortestline2d(Geo gs2) + => MEOSFactory.WrapGeo(Meos.GeomShortestline2d(this.Ptr, gs2.Ptr)); + + public Geo? Shortestline3d(Geo gs2) + => MEOSFactory.WrapGeo(Meos.GeomShortestline3d(this.Ptr, gs2.Ptr)); + + public Cbuffer? ToCbuffer() + => MEOSFactory.WrapCbuffer(Meos.GeomToCbuffer(this.Ptr)); + + public Geo? ToGeog() + => MEOSFactory.WrapGeo(Meos.GeomToGeog(this.Ptr)); + + public Nsegment? ToNsegment() + => MEOSFactory.WrapNsegment(Meos.GeomToNsegment(this.Ptr)); + + public bool Touches(Geo gs2) + => Meos.GeomTouches(this.Ptr, gs2.Ptr); + + public Temporal? TposeToTrgeometry(Temporal temp) + => MEOSFactory.WrapTemporal(Meos.GeometryTposeToTrgeometry(this.Ptr, temp.Ptr)); + + public Geo? UnaryUnion(double prec) + => MEOSFactory.WrapGeo(Meos.GeomUnaryUnion(this.Ptr, prec)); + + public static Geo? ArrayUnion(Geo[] gsarr) + { + IntPtr[] _gsarrValues = new IntPtr[gsarr.Length]; + for (int i = 0; i < gsarr.Length; i++) + { + _gsarrValues[i] = gsarr[i].Ptr; + } + + GCHandle _gsarr = GCHandle.Alloc(_gsarrValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapGeo(Meos.GeomArrayUnion(_gsarr.AddrOfPinnedObject(), gsarr.Length)); + } + finally + { + _gsarr.Free(); + } + } + + public static Geo? FromHexewkb(string wkt) + => MEOSFactory.WrapGeo(Meos.GeomFromHexewkb(wkt)); + + public static Geo? In(string str, int typmod) + => MEOSFactory.WrapGeo(Meos.GeomIn(str, typmod)); + + } +} diff --git a/MEOS.NET/Types/Jsonb.g.cs b/MEOS.NET/Types/Jsonb.g.cs new file mode 100644 index 0000000..3d9bd89 --- /dev/null +++ b/MEOS.NET/Types/Jsonb.g.cs @@ -0,0 +1,124 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// PostgreSQL jsonb, the base type of TJsonb and JsonbSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Jsonb : Value + { + internal Jsonb(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(); + + public Jsonb? ArrayElement(int element) + => MEOSFactory.WrapJsonb(Meos.JsonbArrayElement(this.Ptr, element)); + + public Text? ArrayElementText(int element) + => MEOSFactory.WrapText(Meos.JsonbArrayElementText(this.Ptr, element)); + + public Jsonb?[] ArrayElements() + => MEOSFactory.WrapJsonbArray(Meos.JsonbArrayElements(this.Ptr)); + + public Text?[] ArrayElementsText() + => MEOSFactory.WrapTextArray(Meos.JsonbArrayElementsText(this.Ptr)); + + public int ArrayLength() + => Meos.JsonbArrayLength(this.Ptr); + + public Jsonb? Concat(Jsonb jb2) + => MEOSFactory.WrapJsonb(Meos.JsonbConcat(this.Ptr, jb2.Ptr)); + + public bool Contained(Jsonb jb2) + => Meos.JsonbContained(this.Ptr, jb2.Ptr); + + public Jsonb? Copy() + => MEOSFactory.WrapJsonb(Meos.JsonbCopy(this.Ptr)); + + public Jsonb? Delete(Text key) + => MEOSFactory.WrapJsonb(Meos.JsonbDelete(this.Ptr, key.Ptr)); + + public Jsonb? DeleteIndex(int idx) + => MEOSFactory.WrapJsonb(Meos.JsonbDeleteIndex(this.Ptr, idx)); + + public bool Exists(Text key) + => Meos.JsonbExists(this.Ptr, key.Ptr); + + public uint Hash() + => Meos.JsonbHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.JsonbHashExtended(this.Ptr, seed); + + public Jsonb? ObjectField(Text key) + => MEOSFactory.WrapJsonb(Meos.JsonbObjectField(this.Ptr, key.Ptr)); + + public Text? ObjectFieldText(Text key) + => MEOSFactory.WrapText(Meos.JsonbObjectFieldText(this.Ptr, key.Ptr)); + + public Text?[] ObjectKeys() + => MEOSFactory.WrapTextArray(Meos.JsonbObjectKeys(this.Ptr)); + + public string Out() + => Meos.JsonbOut(this.Ptr); + + public Text? Pretty() + => MEOSFactory.WrapText(Meos.JsonbPretty(this.Ptr)); + + public Jsonb? StripNulls(bool strip_in_arrays) + => MEOSFactory.WrapJsonb(Meos.JsonbStripNulls(this.Ptr, strip_in_arrays)); + + public bool ToBool() + => Meos.JsonbToBool(this.Ptr); + + public string ToCstring() + => Meos.JsonbToCstring(this.Ptr); + + public short ToInt16() + => Meos.JsonbToInt16(this.Ptr); + + public int ToInt32() + => Meos.JsonbToInt32(this.Ptr); + + public long ToInt64() + => Meos.JsonbToInt64(this.Ptr); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.JsonbToSet(this.Ptr)); + + public Text? ToText() + => MEOSFactory.WrapText(Meos.JsonbToText(this.Ptr)); + + public static Jsonb? FromText(Text txt, bool unique_keys) + => MEOSFactory.WrapJsonb(Meos.JsonbFromText(txt.Ptr, unique_keys)); + + public static Jsonb? In(string str) + => MEOSFactory.WrapJsonb(Meos.JsonbIn(str)); + + public static Jsonb? Make(Text[] keys_vals) + { + IntPtr[] _keys_valsValues = new IntPtr[keys_vals.Length]; + for (int i = 0; i < keys_vals.Length; i++) + { + _keys_valsValues[i] = keys_vals[i].Ptr; + } + + GCHandle _keys_vals = GCHandle.Alloc(_keys_valsValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapJsonb(Meos.JsonbMake(_keys_vals.AddrOfPinnedObject(), keys_vals.Length)); + } + finally + { + _keys_vals.Free(); + } + } + + } +} diff --git a/MEOS.NET/Types/MEOSFactory.g.cs b/MEOS.NET/Types/MEOSFactory.g.cs index 0292374..d668437 100644 --- a/MEOS.NET/Types/MEOSFactory.g.cs +++ b/MEOS.NET/Types/MEOSFactory.g.cs @@ -17,6 +17,423 @@ namespace MEOS.NET.Types [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] public static class MEOSFactory { + /// The value at as the Cbuffer + /// class the model gives its runtime type. + public static Cbuffer? WrapCbuffer(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Cbuffer(ptr); + } + + /// Every element of a C array of Cbuffer pointers, wrapped. + public static Cbuffer?[] WrapCbufferArray(IntPtr[] ptrs) + { + Cbuffer?[] wrapped = new Cbuffer?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapCbuffer(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Geo + /// class the model gives its runtime type. + public static Geo? WrapGeo(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Geo(ptr); + } + + /// Every element of a C array of Geo pointers, wrapped. + public static Geo?[] WrapGeoArray(IntPtr[] ptrs) + { + Geo?[] wrapped = new Geo?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapGeo(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Jsonb + /// class the model gives its runtime type. + public static Jsonb? WrapJsonb(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Jsonb(ptr); + } + + /// Every element of a C array of Jsonb pointers, wrapped. + public static Jsonb?[] WrapJsonbArray(IntPtr[] ptrs) + { + Jsonb?[] wrapped = new Jsonb?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapJsonb(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Npoint + /// class the model gives its runtime type. + public static Npoint? WrapNpoint(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Npoint(ptr); + } + + /// Every element of a C array of Npoint pointers, wrapped. + public static Npoint?[] WrapNpointArray(IntPtr[] ptrs) + { + Npoint?[] wrapped = new Npoint?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapNpoint(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Nsegment + /// class the model gives its runtime type. + public static Nsegment? WrapNsegment(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Nsegment(ptr); + } + + /// Every element of a C array of Nsegment pointers, wrapped. + public static Nsegment?[] WrapNsegmentArray(IntPtr[] ptrs) + { + Nsegment?[] wrapped = new Nsegment?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapNsegment(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Pcpatch + /// class the model gives its runtime type. + public static Pcpatch? WrapPcpatch(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Pcpatch(ptr); + } + + /// Every element of a C array of Pcpatch pointers, wrapped. + public static Pcpatch?[] WrapPcpatchArray(IntPtr[] ptrs) + { + Pcpatch?[] wrapped = new Pcpatch?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapPcpatch(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Pcpoint + /// class the model gives its runtime type. + public static Pcpoint? WrapPcpoint(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Pcpoint(ptr); + } + + /// Every element of a C array of Pcpoint pointers, wrapped. + public static Pcpoint?[] WrapPcpointArray(IntPtr[] ptrs) + { + Pcpoint?[] wrapped = new Pcpoint?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapPcpoint(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Pose + /// class the model gives its runtime type. + public static Pose? WrapPose(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Pose(ptr); + } + + /// Every element of a C array of Pose pointers, wrapped. + public static Pose?[] WrapPoseArray(IntPtr[] ptrs) + { + Pose?[] wrapped = new Pose?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapPose(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the PoseChain + /// class the model gives its runtime type. + public static PoseChain? WrapPoseChain(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new PoseChain(ptr); + } + + /// Every element of a C array of PoseChain pointers, wrapped. + public static PoseChain?[] WrapPoseChainArray(IntPtr[] ptrs) + { + PoseChain?[] wrapped = new PoseChain?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapPoseChain(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Raquet + /// class the model gives its runtime type. + public static Raquet? WrapRaquet(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new Raquet(ptr); + } + + /// Every element of a C array of Raquet pointers, wrapped. + public static Raquet?[] WrapRaquetArray(IntPtr[] ptrs) + { + Raquet?[] wrapped = new Raquet?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapRaquet(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the STBox + /// class the model gives its runtime type. + public static STBox? WrapSTBox(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new STBox(ptr); + } + + /// Every element of a C array of STBox pointers, wrapped. + public static STBox?[] WrapSTBoxArray(IntPtr[] ptrs) + { + STBox?[] wrapped = new STBox?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSTBox(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Set + /// class the model gives its runtime type. + public static Set? WrapSet(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // Set.settype, at byte 4 + return Marshal.ReadByte(ptr, 4) switch + { + 5 => new DateSet(ptr), // T_DATESET + 12 => new FloatSet(ptr), // T_FLOATSET + 18 => new IntSet(ptr), // T_INTSET + 22 => new BigIntSet(ptr), // T_BIGINTSET + 32 => new TextSet(ptr), // T_TEXTSET + 38 => new TsTzSet(ptr), // T_TSTZSET + 43 => new GeomSet(ptr), // T_GEOMSET + 45 => new GeogSet(ptr), // T_GEOGSET + 49 => new NpointSet(ptr), // T_NPOINTSET + 55 => new PoseSet(ptr), // T_POSESET + 58 => new CbufferSet(ptr), // T_CBUFFERSET + _ => new Set(ptr), + }; + } + + /// Every element of a C array of Set pointers, wrapped. + public static Set?[] WrapSetArray(IntPtr[] ptrs) + { + Set?[] wrapped = new Set?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSet(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Span + /// class the model gives its runtime type. + public static Span? WrapSpan(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // Span.spantype, at byte 0 + return Marshal.ReadByte(ptr, 0) switch + { + 6 => new DateSpan(ptr), // T_DATESPAN + 13 => new FloatSpan(ptr), // T_FLOATSPAN + 19 => new IntSpan(ptr), // T_INTSPAN + 23 => new BigIntSpan(ptr), // T_BIGINTSPAN + 39 => new TsTzSpan(ptr), // T_TSTZSPAN + _ => new Span(ptr), + }; + } + + /// Every element of a C array of Span pointers, wrapped. + public static Span?[] WrapSpanArray(IntPtr[] ptrs) + { + Span?[] wrapped = new Span?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSpan(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the SpanSet + /// class the model gives its runtime type. + public static SpanSet? WrapSpanSet(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // SpanSet.spansettype, at byte 4 + return Marshal.ReadByte(ptr, 4) switch + { + 7 => new DateSpanSet(ptr), // T_DATESPANSET + 14 => new FloatSpanSet(ptr), // T_FLOATSPANSET + 20 => new IntSpanSet(ptr), // T_INTSPANSET + 24 => new BigIntSpanSet(ptr), // T_BIGINTSPANSET + 40 => new TsTzSpanSet(ptr), // T_TSTZSPANSET + _ => new SpanSet(ptr), + }; + } + + /// Every element of a C array of SpanSet pointers, wrapped. + public static SpanSet?[] WrapSpanSetArray(IntPtr[] ptrs) + { + SpanSet?[] wrapped = new SpanSet?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSpanSet(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the TBox + /// class the model gives its runtime type. + public static TBox? WrapTBox(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new TBox(ptr); + } + + /// Every element of a C array of TBox pointers, wrapped. + public static TBox?[] WrapTBoxArray(IntPtr[] ptrs) + { + TBox?[] wrapped = new TBox?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapTBox(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the TPCBox + /// class the model gives its runtime type. + public static TPCBox? WrapTPCBox(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new TPCBox(ptr); + } + + /// Every element of a C array of TPCBox pointers, wrapped. + public static TPCBox?[] WrapTPCBoxArray(IntPtr[] ptrs) + { + TPCBox?[] wrapped = new TPCBox?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapTPCBox(ptrs[i]); + } + + return wrapped; + } + /// The value at as the Temporal /// class the model gives its runtime type. public static Temporal? WrapTemporal(IntPtr ptr) @@ -213,154 +630,25 @@ private static TText WrapTTextSubtype(IntPtr ptr) _ => new TText(ptr), }; - /// The value at as the Set - /// class the model gives its runtime type. - public static Set? WrapSet(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - { - return null; - } - - // Set.settype, at byte 4 - return Marshal.ReadByte(ptr, 4) switch - { - 5 => new DateSet(ptr), // T_DATESET - 12 => new FloatSet(ptr), // T_FLOATSET - 18 => new IntSet(ptr), // T_INTSET - 22 => new BigIntSet(ptr), // T_BIGINTSET - 32 => new TextSet(ptr), // T_TEXTSET - 38 => new TsTzSet(ptr), // T_TSTZSET - 43 => new GeomSet(ptr), // T_GEOMSET - 45 => new GeogSet(ptr), // T_GEOGSET - 49 => new NpointSet(ptr), // T_NPOINTSET - 55 => new PoseSet(ptr), // T_POSESET - 58 => new CbufferSet(ptr), // T_CBUFFERSET - _ => new Set(ptr), - }; - } - - /// Every element of a C array of Set pointers, wrapped. - public static Set?[] WrapSetArray(IntPtr[] ptrs) - { - Set?[] wrapped = new Set?[ptrs.Length]; - for (int i = 0; i < ptrs.Length; i++) - { - wrapped[i] = WrapSet(ptrs[i]); - } - - return wrapped; - } - - /// The value at as the Span + /// The value at as the Text /// class the model gives its runtime type. - public static Span? WrapSpan(IntPtr ptr) + public static Text? WrapText(IntPtr ptr) { if (ptr == IntPtr.Zero) { return null; } - // Span.spantype, at byte 0 - return Marshal.ReadByte(ptr, 0) switch - { - 6 => new DateSpan(ptr), // T_DATESPAN - 13 => new FloatSpan(ptr), // T_FLOATSPAN - 19 => new IntSpan(ptr), // T_INTSPAN - 23 => new BigIntSpan(ptr), // T_BIGINTSPAN - 39 => new TsTzSpan(ptr), // T_TSTZSPAN - _ => new Span(ptr), - }; + return new Text(ptr); } - /// Every element of a C array of Span pointers, wrapped. - public static Span?[] WrapSpanArray(IntPtr[] ptrs) + /// Every element of a C array of Text pointers, wrapped. + public static Text?[] WrapTextArray(IntPtr[] ptrs) { - Span?[] wrapped = new Span?[ptrs.Length]; + Text?[] wrapped = new Text?[ptrs.Length]; for (int i = 0; i < ptrs.Length; i++) { - wrapped[i] = WrapSpan(ptrs[i]); - } - - return wrapped; - } - - /// The value at as the SpanSet - /// class the model gives its runtime type. - public static SpanSet? WrapSpanSet(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - { - return null; - } - - // SpanSet.spansettype, at byte 4 - return Marshal.ReadByte(ptr, 4) switch - { - 7 => new DateSpanSet(ptr), // T_DATESPANSET - 14 => new FloatSpanSet(ptr), // T_FLOATSPANSET - 20 => new IntSpanSet(ptr), // T_INTSPANSET - 24 => new BigIntSpanSet(ptr), // T_BIGINTSPANSET - 40 => new TsTzSpanSet(ptr), // T_TSTZSPANSET - _ => new SpanSet(ptr), - }; - } - - /// Every element of a C array of SpanSet pointers, wrapped. - public static SpanSet?[] WrapSpanSetArray(IntPtr[] ptrs) - { - SpanSet?[] wrapped = new SpanSet?[ptrs.Length]; - for (int i = 0; i < ptrs.Length; i++) - { - wrapped[i] = WrapSpanSet(ptrs[i]); - } - - return wrapped; - } - - /// The value at as the TBox - /// class the model gives its runtime type. - public static TBox? WrapTBox(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - { - return null; - } - - return new TBox(ptr); - } - - /// Every element of a C array of TBox pointers, wrapped. - public static TBox?[] WrapTBoxArray(IntPtr[] ptrs) - { - TBox?[] wrapped = new TBox?[ptrs.Length]; - for (int i = 0; i < ptrs.Length; i++) - { - wrapped[i] = WrapTBox(ptrs[i]); - } - - return wrapped; - } - - /// The value at as the STBox - /// class the model gives its runtime type. - public static STBox? WrapSTBox(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - { - return null; - } - - return new STBox(ptr); - } - - /// Every element of a C array of STBox pointers, wrapped. - public static STBox?[] WrapSTBoxArray(IntPtr[] ptrs) - { - STBox?[] wrapped = new STBox?[ptrs.Length]; - for (int i = 0; i < ptrs.Length; i++) - { - wrapped[i] = WrapSTBox(ptrs[i]); + wrapped[i] = WrapText(ptrs[i]); } return wrapped; diff --git a/MEOS.NET/Types/Npoint.g.cs b/MEOS.NET/Types/Npoint.g.cs new file mode 100644 index 0000000..0368ed7 --- /dev/null +++ b/MEOS.NET/Types/Npoint.g.cs @@ -0,0 +1,99 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Npoint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Npoint : Value + { + internal Npoint(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public string AsEWKT(int maxdd) + => Meos.NpointAsEwkt(this.Ptr, maxdd); + + public string AsText(int maxdd) + => Meos.NpointAsText(this.Ptr, maxdd); + + public int Cmp(Npoint np2) + => Meos.NpointCmp(this.Ptr, np2.Ptr); + + public bool Eq(Npoint np2) + => Meos.NpointEq(this.Ptr, np2.Ptr); + + public bool Ge(Npoint np2) + => Meos.NpointGe(this.Ptr, np2.Ptr); + + public bool Gt(Npoint np2) + => Meos.NpointGt(this.Ptr, np2.Ptr); + + public uint Hash() + => Meos.NpointHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.NpointHashExtended(this.Ptr, seed); + + public bool Le(Npoint np2) + => Meos.NpointLe(this.Ptr, np2.Ptr); + + public bool Lt(Npoint np2) + => Meos.NpointLt(this.Ptr, np2.Ptr); + + public bool Ne(Npoint np2) + => Meos.NpointNe(this.Ptr, np2.Ptr); + + public string Out(int maxdd) + => Meos.NpointOut(this.Ptr, maxdd); + + public double Position() + => Meos.NpointPosition(this.Ptr); + + public Npoint? Round(int maxdd) + => MEOSFactory.WrapNpoint(Meos.NpointRound(this.Ptr, maxdd)); + + public long Route() + => Meos.NpointRoute(this.Ptr); + + public int SRID() + => Meos.NpointSrid(this.Ptr); + + public bool Same(Npoint np2) + => Meos.NpointSame(this.Ptr, np2.Ptr); + + public STBox? TimestamptzToStbox(DateTime t) + => MEOSFactory.WrapSTBox(Meos.NpointTimestamptzToStbox(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Geo? ToGeompoint() + => MEOSFactory.WrapGeo(Meos.NpointToGeompoint(this.Ptr)); + + public Nsegment? ToNsegment() + => MEOSFactory.WrapNsegment(Meos.NpointToNsegment(this.Ptr)); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.NpointToSet(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.NpointToStbox(this.Ptr)); + + public STBox? TstzspanToStbox(Span s) + => MEOSFactory.WrapSTBox(Meos.NpointTstzspanToStbox(this.Ptr, s.Ptr)); + + public static Npoint? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapNpoint(Meos.NpointFromHexwkb(hexwkb)); + + public static Npoint? In(string str) + => MEOSFactory.WrapNpoint(Meos.NpointIn(str)); + + public static Npoint? Make(long rid, double pos) + => MEOSFactory.WrapNpoint(Meos.NpointMake(rid, pos)); + + } +} diff --git a/MEOS.NET/Types/NpointSet.g.cs b/MEOS.NET/Types/NpointSet.g.cs index 74516e7..2933f81 100644 --- a/MEOS.NET/Types/NpointSet.g.cs +++ b/MEOS.NET/Types/NpointSet.g.cs @@ -17,14 +17,42 @@ internal NpointSet(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(15); + public Npoint? EndValue() + => MEOSFactory.WrapNpoint(Meos.NpointsetEndValue(this.Ptr)); + public string Out(int maxdd) => Meos.NpointsetOut(this.Ptr, maxdd); public Set? Routes() => MEOSFactory.WrapSet(Meos.NpointsetRoutes(this.Ptr)); + public Npoint? StartValue() + => MEOSFactory.WrapNpoint(Meos.NpointsetStartValue(this.Ptr)); + + public Npoint?[] Values() + => MEOSFactory.WrapNpointArray(Meos.NpointsetValues(this.Ptr)); + public static Set? In(string str) => MEOSFactory.WrapSet(Meos.NpointsetIn(str)); + public static Set? Make(Npoint[] values) + { + IntPtr[] _valuesValues = new IntPtr[values.Length]; + for (int i = 0; i < values.Length; i++) + { + _valuesValues[i] = values[i].Ptr; + } + + GCHandle _values = GCHandle.Alloc(_valuesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapSet(Meos.NpointsetMake(_values.AddrOfPinnedObject(), values.Length)); + } + finally + { + _values.Free(); + } + } + } } diff --git a/MEOS.NET/Types/Nsegment.g.cs b/MEOS.NET/Types/Nsegment.g.cs new file mode 100644 index 0000000..3b18892 --- /dev/null +++ b/MEOS.NET/Types/Nsegment.g.cs @@ -0,0 +1,72 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// A segment of a network route. A MeosType no membership predicate admits, so the coverage gate does not demand it; the 20 signatures naming it do. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Nsegment : Value + { + internal Nsegment(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public int Cmp(Nsegment ns2) + => Meos.NsegmentCmp(this.Ptr, ns2.Ptr); + + public double EndPosition() + => Meos.NsegmentEndPosition(this.Ptr); + + public bool Eq(Nsegment ns2) + => Meos.NsegmentEq(this.Ptr, ns2.Ptr); + + public bool Ge(Nsegment ns2) + => Meos.NsegmentGe(this.Ptr, ns2.Ptr); + + public bool Gt(Nsegment ns2) + => Meos.NsegmentGt(this.Ptr, ns2.Ptr); + + public bool Le(Nsegment ns2) + => Meos.NsegmentLe(this.Ptr, ns2.Ptr); + + public bool Lt(Nsegment ns2) + => Meos.NsegmentLt(this.Ptr, ns2.Ptr); + + public bool Ne(Nsegment ns2) + => Meos.NsegmentNe(this.Ptr, ns2.Ptr); + + public string Out(int maxdd) + => Meos.NsegmentOut(this.Ptr, maxdd); + + public Nsegment? Round(int maxdd) + => MEOSFactory.WrapNsegment(Meos.NsegmentRound(this.Ptr, maxdd)); + + public long Route() + => Meos.NsegmentRoute(this.Ptr); + + public int SRID() + => Meos.NsegmentSrid(this.Ptr); + + public double StartPosition() + => Meos.NsegmentStartPosition(this.Ptr); + + public Geo? ToGeom() + => MEOSFactory.WrapGeo(Meos.NsegmentToGeom(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.NsegmentToStbox(this.Ptr)); + + public static Nsegment? In(string str) + => MEOSFactory.WrapNsegment(Meos.NsegmentIn(str)); + + public static Nsegment? Make(long rid, double pos1, double pos2) + => MEOSFactory.WrapNsegment(Meos.NsegmentMake(rid, pos1, pos2)); + + } +} diff --git a/MEOS.NET/Types/Pcpatch.g.cs b/MEOS.NET/Types/Pcpatch.g.cs new file mode 100644 index 0000000..4033f29 --- /dev/null +++ b/MEOS.NET/Types/Pcpatch.g.cs @@ -0,0 +1,75 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Pcpatch class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Pcpatch : Value + { + internal Pcpatch(IntPtr ptr) : base(ptr) { } + + public string AsHEXWKB() + => Meos.PcpatchAsHexwkb(this.Ptr); + + public int Cmp(Pcpatch pa2) + => Meos.PcpatchCmp(this.Ptr, pa2.Ptr); + + public Pcpatch? Copy() + => MEOSFactory.WrapPcpatch(Meos.PcpatchCopy(this.Ptr)); + + public uint GetPcid() + => Meos.PcpatchGetPcid(this.Ptr); + + public uint Hash() + => Meos.PcpatchHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.PcpatchHashExtended(this.Ptr, seed); + + public string HexOut(int maxdd) + => Meos.PcpatchHexOut(this.Ptr, maxdd); + + public uint Npoints() + => Meos.PcpatchNpoints(this.Ptr); + + public Geo? ToGeom() + => MEOSFactory.WrapGeo(Meos.PcpatchToGeom(this.Ptr)); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.PcpatchToSet(this.Ptr)); + + public TPCBox? ToTpcbox(int srid) + => MEOSFactory.WrapTPCBox(Meos.PcpatchToTpcbox(this.Ptr, srid)); + + public static Pcpatch? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapPcpatch(Meos.PcpatchFromHexwkb(hexwkb)); + + public static Pcpatch? HexIn(string str) + => MEOSFactory.WrapPcpatch(Meos.PcpatchHexIn(str)); + + public static Pcpatch? Make(Pcpoint[] points) + { + IntPtr[] _pointsValues = new IntPtr[points.Length]; + for (int i = 0; i < points.Length; i++) + { + _pointsValues[i] = points[i].Ptr; + } + + GCHandle _points = GCHandle.Alloc(_pointsValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapPcpatch(Meos.PcpatchMake(_points.AddrOfPinnedObject(), points.Length)); + } + finally + { + _points.Free(); + } + } + + } +} diff --git a/MEOS.NET/Types/Pcpoint.g.cs b/MEOS.NET/Types/Pcpoint.g.cs new file mode 100644 index 0000000..30763eb --- /dev/null +++ b/MEOS.NET/Types/Pcpoint.g.cs @@ -0,0 +1,47 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Pcpoint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Pcpoint : Value + { + internal Pcpoint(IntPtr ptr) : base(ptr) { } + + public string AsHEXWKB() + => Meos.PcpointAsHexwkb(this.Ptr); + + public int Cmp(Pcpoint pt2) + => Meos.PcpointCmp(this.Ptr, pt2.Ptr); + + public Pcpoint? Copy() + => MEOSFactory.WrapPcpoint(Meos.PcpointCopy(this.Ptr)); + + public uint GetPcid() + => Meos.PcpointGetPcid(this.Ptr); + + public uint Hash() + => Meos.PcpointHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.PcpointHashExtended(this.Ptr, seed); + + public string HexOut(int maxdd) + => Meos.PcpointHexOut(this.Ptr, maxdd); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.PcpointToSet(this.Ptr)); + + public static Pcpoint? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapPcpoint(Meos.PcpointFromHexwkb(hexwkb)); + + public static Pcpoint? HexIn(string str) + => MEOSFactory.WrapPcpoint(Meos.PcpointHexIn(str)); + + } +} diff --git a/MEOS.NET/Types/Pose.g.cs b/MEOS.NET/Types/Pose.g.cs new file mode 100644 index 0000000..9fa42f7 --- /dev/null +++ b/MEOS.NET/Types/Pose.g.cs @@ -0,0 +1,159 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The Pose class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Pose : Value + { + internal Pose(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public double AngularDistance(Pose pose2) + => Meos.PoseAngularDistance(this.Ptr, pose2.Ptr); + + public Geo? ApplyGeo(Geo body) + => MEOSFactory.WrapGeo(Meos.PoseApplyGeo(this.Ptr, body.Ptr)); + + public string AsEWKT(int maxdd) + => Meos.PoseAsEwkt(this.Ptr, maxdd); + + public string AsGeopose(int conformance, int precision) + => Meos.PoseAsGeopose(this.Ptr, conformance, precision); + + public string AsText(int maxdd) + => Meos.PoseAsText(this.Ptr, maxdd); + + public int Cmp(Pose pose2) + => Meos.PoseCmp(this.Ptr, pose2.Ptr); + + public Pose? Compose(Pose frame) + => MEOSFactory.WrapPose(Meos.PoseCompose(this.Ptr, frame.Ptr)); + + public Temporal? ComposeTpose(Temporal frame) + => MEOSFactory.WrapTemporal(Meos.PoseComposeTpose(this.Ptr, frame.Ptr)); + + public Pose? Copy() + => MEOSFactory.WrapPose(Meos.PoseCopy(this.Ptr)); + + public bool Eq(Pose pose2) + => Meos.PoseEq(this.Ptr, pose2.Ptr); + + public bool Ge(Pose pose2) + => Meos.PoseGe(this.Ptr, pose2.Ptr); + + public bool Gt(Pose pose2) + => Meos.PoseGt(this.Ptr, pose2.Ptr); + + public uint Hash() + => Meos.PoseHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.PoseHashExtended(this.Ptr, seed); + + public Pose? Inverse() + => MEOSFactory.WrapPose(Meos.PoseInverse(this.Ptr)); + + public bool Le(Pose pose2) + => Meos.PoseLe(this.Ptr, pose2.Ptr); + + public bool Lt(Pose pose2) + => Meos.PoseLt(this.Ptr, pose2.Ptr); + + public bool Ne(Pose pose2) + => Meos.PoseNe(this.Ptr, pose2.Ptr); + + public Pose? Normalize() + => MEOSFactory.WrapPose(Meos.PoseNormalize(this.Ptr)); + + public bool Nsame(Pose pose2) + => Meos.PoseNsame(this.Ptr, pose2.Ptr); + + public string Out(int maxdd) + => Meos.PoseOut(this.Ptr, maxdd); + + public double Pitch() + => Meos.PosePitch(this.Ptr); + + public double[] Quaternion() + => Meos.PoseQuaternion(this.Ptr); + + public double Roll() + => Meos.PoseRoll(this.Ptr); + + public Pose? Round(int maxdd) + => MEOSFactory.WrapPose(Meos.PoseRound(this.Ptr, maxdd)); + + public int SRID() + => Meos.PoseSrid(this.Ptr); + + public bool Same(Pose pose2) + => Meos.PoseSame(this.Ptr, pose2.Ptr); + + public Pose? SetSRID(int srid) + => MEOSFactory.WrapPose(Meos.PoseSetSrid(this.Ptr, srid)); + + public STBox? TimestamptzToStbox(DateTime t) + => MEOSFactory.WrapSTBox(Meos.PoseTimestamptzToStbox(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Geo? ToPoint() + => MEOSFactory.WrapGeo(Meos.PoseToPoint(this.Ptr)); + + public PoseChain? ToPosechain() + => MEOSFactory.WrapPoseChain(Meos.PoseToPosechain(this.Ptr)); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.PoseToSet(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.PoseToStbox(this.Ptr)); + + public Pose? Transform(int srid) + => MEOSFactory.WrapPose(Meos.PoseTransform(this.Ptr, srid)); + + public Pose? TransformPipeline(string pipelinestr, int srid, bool is_forward) + => MEOSFactory.WrapPose(Meos.PoseTransformPipeline(this.Ptr, pipelinestr, srid, is_forward)); + + public STBox? TstzspanToStbox(Span s) + => MEOSFactory.WrapSTBox(Meos.PoseTstzspanToStbox(this.Ptr, s.Ptr)); + + public double Yaw() + => Meos.PoseYaw(this.Ptr); + + public double[] Ypr() + => Meos.PoseYpr(this.Ptr); + + public static Pose? FromGeopose(string json) + => MEOSFactory.WrapPose(Meos.PoseFromGeopose(json)); + + public static Pose? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapPose(Meos.PoseFromHexwkb(hexwkb)); + + public static Pose? In(string str) + => MEOSFactory.WrapPose(Meos.PoseIn(str)); + + public static Pose? Make2d(double x, double y, double theta, bool geodetic, int srid) + => MEOSFactory.WrapPose(Meos.PoseMake2d(x, y, theta, geodetic, srid)); + + public static Pose? Make3d(double x, double y, double z, double W, double X, double Y, double Z, bool geodetic, int srid) + => MEOSFactory.WrapPose(Meos.PoseMake3d(x, y, z, W, X, Y, Z, geodetic, srid)); + + public static Pose? MakePoint2d(Geo gs, double theta) + => MEOSFactory.WrapPose(Meos.PoseMakePoint2d(gs.Ptr, theta)); + + public static Pose? MakePoint3d(Geo gs, double W, double X, double Y, double Z) + => MEOSFactory.WrapPose(Meos.PoseMakePoint3d(gs.Ptr, W, X, Y, Z)); + + public static Pose? MakePoint3dYpr(Geo gs, double yaw, double pitch, double roll) + => MEOSFactory.WrapPose(Meos.PoseMakePoint3dYpr(gs.Ptr, yaw, pitch, roll)); + + } +} diff --git a/MEOS.NET/Types/PoseChain.g.cs b/MEOS.NET/Types/PoseChain.g.cs new file mode 100644 index 0000000..52ad731 --- /dev/null +++ b/MEOS.NET/Types/PoseChain.g.cs @@ -0,0 +1,145 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// The PoseChain class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class PoseChain : Value + { + internal PoseChain(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public PoseChain? Append(Pose pose) + => MEOSFactory.WrapPoseChain(Meos.PosechainAppend(this.Ptr, pose.Ptr)); + + public string AsEWKT(int maxdd) + => Meos.PosechainAsEwkt(this.Ptr, maxdd); + + public string AsText(int maxdd) + => Meos.PosechainAsText(this.Ptr, maxdd); + + public int Cmp(PoseChain pc2) + => Meos.PosechainCmp(this.Ptr, pc2.Ptr); + + public PoseChain? Copy() + => MEOSFactory.WrapPoseChain(Meos.PosechainCopy(this.Ptr)); + + public Pose? EndPose() + => MEOSFactory.WrapPose(Meos.PosechainEndPose(this.Ptr)); + + public bool Eq(PoseChain pc2) + => Meos.PosechainEq(this.Ptr, pc2.Ptr); + + public bool Ge(PoseChain pc2) + => Meos.PosechainGe(this.Ptr, pc2.Ptr); + + public bool Gt(PoseChain pc2) + => Meos.PosechainGt(this.Ptr, pc2.Ptr); + + public uint Hash() + => Meos.PosechainHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.PosechainHashExtended(this.Ptr, seed); + + public bool Le(PoseChain pc2) + => Meos.PosechainLe(this.Ptr, pc2.Ptr); + + public bool Lt(PoseChain pc2) + => Meos.PosechainLt(this.Ptr, pc2.Ptr); + + public bool Ne(PoseChain pc2) + => Meos.PosechainNe(this.Ptr, pc2.Ptr); + + public bool Nsame(PoseChain pc2) + => Meos.PosechainNsame(this.Ptr, pc2.Ptr); + + public int NumPoses() + => Meos.PosechainNumPoses(this.Ptr); + + public string Out(int maxdd) + => Meos.PosechainOut(this.Ptr, maxdd); + + public Pose? PoseN(int n) + => MEOSFactory.WrapPose(Meos.PosechainPoseN(this.Ptr, n)); + + public Pose?[] Poses() + => MEOSFactory.WrapPoseArray(Meos.PosechainPoses(this.Ptr)); + + public Pose? PrefixPose(int n) + => MEOSFactory.WrapPose(Meos.PosechainPrefixPose(this.Ptr, n)); + + public PoseChain? Round(int maxdd) + => MEOSFactory.WrapPoseChain(Meos.PosechainRound(this.Ptr, maxdd)); + + public int SRID() + => Meos.PosechainSrid(this.Ptr); + + public bool Same(PoseChain pc2) + => Meos.PosechainSame(this.Ptr, pc2.Ptr); + + public PoseChain? SetSRID(int srid) + => MEOSFactory.WrapPoseChain(Meos.PosechainSetSrid(this.Ptr, srid)); + + public Pose? StartPose() + => MEOSFactory.WrapPose(Meos.PosechainStartPose(this.Ptr)); + + public STBox? TimestamptzToStbox(DateTime t) + => MEOSFactory.WrapSTBox(Meos.PosechainTimestamptzToStbox(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Geo? ToPoint() + => MEOSFactory.WrapGeo(Meos.PosechainToPoint(this.Ptr)); + + public Pose? ToPose() + => MEOSFactory.WrapPose(Meos.PosechainToPose(this.Ptr)); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.PosechainToSet(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.PosechainToStbox(this.Ptr)); + + public PoseChain? Transform(int srid_to) + => MEOSFactory.WrapPoseChain(Meos.PosechainTransform(this.Ptr, srid_to)); + + public PoseChain? TransformPipeline(string pipeline, int srid_to, bool is_forward) + => MEOSFactory.WrapPoseChain(Meos.PosechainTransformPipeline(this.Ptr, pipeline, srid_to, is_forward)); + + public STBox? TstzspanToStbox(Span s) + => MEOSFactory.WrapSTBox(Meos.PosechainTstzspanToStbox(this.Ptr, s.Ptr)); + + public static PoseChain? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapPoseChain(Meos.PosechainFromHexwkb(hexwkb)); + + public static PoseChain? In(string str) + => MEOSFactory.WrapPoseChain(Meos.PosechainIn(str)); + + public static PoseChain? Make(Pose[] poses) + { + IntPtr[] _posesValues = new IntPtr[poses.Length]; + for (int i = 0; i < poses.Length; i++) + { + _posesValues[i] = poses[i].Ptr; + } + + GCHandle _poses = GCHandle.Alloc(_posesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapPoseChain(Meos.PosechainMake(_poses.AddrOfPinnedObject(), poses.Length)); + } + finally + { + _poses.Free(); + } + } + + } +} diff --git a/MEOS.NET/Types/PoseSet.g.cs b/MEOS.NET/Types/PoseSet.g.cs index 43edda2..061d72e 100644 --- a/MEOS.NET/Types/PoseSet.g.cs +++ b/MEOS.NET/Types/PoseSet.g.cs @@ -17,11 +17,39 @@ internal PoseSet(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(15); + public Pose? EndValue() + => MEOSFactory.WrapPose(Meos.PosesetEndValue(this.Ptr)); + public string Out(int maxdd) => Meos.PosesetOut(this.Ptr, maxdd); + public Pose? StartValue() + => MEOSFactory.WrapPose(Meos.PosesetStartValue(this.Ptr)); + + public Pose?[] Values() + => MEOSFactory.WrapPoseArray(Meos.PosesetValues(this.Ptr)); + public static Set? In(string str) => MEOSFactory.WrapSet(Meos.PosesetIn(str)); + public static Set? Make(Pose[] values) + { + IntPtr[] _valuesValues = new IntPtr[values.Length]; + for (int i = 0; i < values.Length; i++) + { + _valuesValues[i] = values[i].Ptr; + } + + GCHandle _values = GCHandle.Alloc(_valuesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapSet(Meos.PosesetMake(_values.AddrOfPinnedObject(), values.Length)); + } + finally + { + _values.Free(); + } + } + } } diff --git a/MEOS.NET/Types/Raquet.g.cs b/MEOS.NET/Types/Raquet.g.cs new file mode 100644 index 0000000..e3c3408 --- /dev/null +++ b/MEOS.NET/Types/Raquet.g.cs @@ -0,0 +1,81 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// A raster tile. A MeosType no membership predicate admits, as Nsegment is. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Raquet : Value + { + internal Raquet(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(); + + public int Cmp(Raquet rq2) + => Meos.RaquetCmp(this.Ptr, rq2.Ptr); + + public Raquet? Copy() + => MEOSFactory.WrapRaquet(Meos.RaquetCopy(this.Ptr)); + + public bool Eq(Raquet rq2) + => Meos.RaquetEq(this.Ptr, rq2.Ptr); + + public bool Ge(Raquet rq2) + => Meos.RaquetGe(this.Ptr, rq2.Ptr); + + public bool Gt(Raquet rq2) + => Meos.RaquetGt(this.Ptr, rq2.Ptr); + + public uint Hash() + => Meos.RaquetHash(this.Ptr); + + public ulong HashExtended(ulong seed) + => Meos.RaquetHashExtended(this.Ptr, seed); + + public int Height() + => Meos.RaquetHeight(this.Ptr); + + public bool Le(Raquet rq2) + => Meos.RaquetLe(this.Ptr, rq2.Ptr); + + public bool Lt(Raquet rq2) + => Meos.RaquetLt(this.Ptr, rq2.Ptr); + + public bool Ne(Raquet rq2) + => Meos.RaquetNe(this.Ptr, rq2.Ptr); + + public double Nodata() + => Meos.RaquetNodata(this.Ptr); + + public string Out() + => Meos.RaquetOut(this.Ptr); + + public string Pixtype() + => Meos.RaquetPixtype(this.Ptr); + + public ulong Quadbin() + => Meos.RaquetQuadbin(this.Ptr); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.RaquetToStbox(this.Ptr)); + + public int Width() + => Meos.RaquetWidth(this.Ptr); + + public static Raquet? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapRaquet(Meos.RaquetFromHexwkb(hexwkb)); + + public static Raquet? In(string str) + => MEOSFactory.WrapRaquet(Meos.RaquetIn(str)); + + public static Raquet? Read(string path, ulong quadbin) + => MEOSFactory.WrapRaquet(Meos.RaquetRead(path, quadbin)); + + } +} diff --git a/MEOS.NET/Types/STBox.g.cs b/MEOS.NET/Types/STBox.g.cs index 115bdc3..eedbd49 100644 --- a/MEOS.NET/Types/STBox.g.cs +++ b/MEOS.NET/Types/STBox.g.cs @@ -86,6 +86,9 @@ public int SRID() public STBox? SetSRID(int srid) => MEOSFactory.WrapSTBox(Meos.StboxSetSrid(this.Ptr, srid)); + public STBox?[] SpaceTiles(double xsize, double ysize, double zsize, Geo sorigin, bool border_inc) + => MEOSFactory.WrapSTBoxArray(Meos.StboxSpaceTiles(this.Ptr, xsize, ysize, zsize, sorigin.Ptr, border_inc)); + public double SpatialDistance(STBox box2) => Meos.StboxSpatialDistance(this.Ptr, box2.Ptr); @@ -161,6 +164,9 @@ public double SpatialDistance(STBox box2) } } + public Geo? ToGeo() + => MEOSFactory.WrapGeo(Meos.StboxToGeo(this.Ptr)); + public Span? ToTstzspan() => MEOSFactory.WrapSpan(Meos.StboxToTstzspan(this.Ptr)); @@ -284,6 +290,9 @@ public double Volume() public static STBox? FromHEXWKB(string hexwkb) => MEOSFactory.WrapSTBox(Meos.StboxFromHexwkb(hexwkb)); + public static STBox? GetSpaceTile(Geo point, double xsize, double ysize, double zsize, Geo sorigin) + => MEOSFactory.WrapSTBox(Meos.StboxGetSpaceTile(point.Ptr, xsize, ysize, zsize, sorigin.Ptr)); + public static STBox? In(string str) => MEOSFactory.WrapSTBox(Meos.StboxIn(str)); diff --git a/MEOS.NET/Types/TCbuffer.g.cs b/MEOS.NET/Types/TCbuffer.g.cs index 15fa255..327167a 100644 --- a/MEOS.NET/Types/TCbuffer.g.cs +++ b/MEOS.NET/Types/TCbuffer.g.cs @@ -13,15 +13,33 @@ public class TCbuffer : TSpatial { internal TCbuffer(IntPtr ptr) : base(ptr) { } + public Temporal? AtCbuffer(Cbuffer cb) + => MEOSFactory.WrapTemporal(Meos.TcbufferAtCbuffer(this.Ptr, cb.Ptr)); + + public Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TcbufferAtGeom(this.Ptr, gs.Ptr)); + public Temporal? AtStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TcbufferAtStbox(this.Ptr, box.Ptr, border_inc)); + public Geo? ConvexHull() + => MEOSFactory.WrapGeo(Meos.TcbufferConvexHull(this.Ptr)); + + public Cbuffer? EndValue() + => MEOSFactory.WrapCbuffer(Meos.TcbufferEndValue(this.Ptr)); + public Temporal? Expand(double dist) => MEOSFactory.WrapTemporal(Meos.TcbufferExpand(this.Ptr, dist)); public Temporal? Make(Temporal tfloat) => MEOSFactory.WrapTemporal(Meos.TcbufferMake(this.Ptr, tfloat.Ptr)); + public Temporal? MinusCbuffer(Cbuffer cb) + => MEOSFactory.WrapTemporal(Meos.TcbufferMinusCbuffer(this.Ptr, cb.Ptr)); + + public Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TcbufferMinusGeom(this.Ptr, gs.Ptr)); + public Temporal? MinusStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TcbufferMinusStbox(this.Ptr, box.Ptr, border_inc)); @@ -31,12 +49,24 @@ internal TCbuffer(IntPtr ptr) : base(ptr) { } public Set? Radius() => MEOSFactory.WrapSet(Meos.TcbufferRadius(this.Ptr)); + public Cbuffer? StartValue() + => MEOSFactory.WrapCbuffer(Meos.TcbufferStartValue(this.Ptr)); + public Temporal? ToTfloat() => MEOSFactory.WrapTemporal(Meos.TcbufferToTfloat(this.Ptr)); public Temporal? ToTgeompoint() => MEOSFactory.WrapTemporal(Meos.TcbufferToTgeompoint(this.Ptr)); + public Geo? TraversedArea(bool unary_union) + => MEOSFactory.WrapGeo(Meos.TcbufferTraversedArea(this.Ptr, unary_union)); + + public Cbuffer?[] Values() + => MEOSFactory.WrapCbufferArray(Meos.TcbufferValues(this.Ptr)); + + public static Temporal? FromBaseTemp(Cbuffer cb, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TcbufferFromBaseTemp(cb.Ptr, temp.Ptr)); + public static Temporal? FromMFJSON(string mfjson) => MEOSFactory.WrapTemporal(Meos.TcbufferFromMfjson(mfjson)); diff --git a/MEOS.NET/Types/TCbufferInst.g.cs b/MEOS.NET/Types/TCbufferInst.g.cs index f3e4ed3..37a1fb9 100644 --- a/MEOS.NET/Types/TCbufferInst.g.cs +++ b/MEOS.NET/Types/TCbufferInst.g.cs @@ -13,5 +13,8 @@ public class TCbufferInst : TCbuffer { internal TCbufferInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Cbuffer cb, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TcbufferinstMake(cb.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TCbufferSeq.g.cs b/MEOS.NET/Types/TCbufferSeq.g.cs index 1f7edf1..d07332b 100644 --- a/MEOS.NET/Types/TCbufferSeq.g.cs +++ b/MEOS.NET/Types/TCbufferSeq.g.cs @@ -13,5 +13,11 @@ public class TCbufferSeq : TCbuffer { internal TCbufferSeq(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzset(Cbuffer cb, Set s) + => MEOSFactory.WrapTemporal(Meos.TcbufferseqFromBaseTstzset(cb.Ptr, s.Ptr)); + + public static Temporal? FromBaseTstzspan(Cbuffer cb, Span s, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TcbufferseqFromBaseTstzspan(cb.Ptr, s.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TCbufferSeqSet.g.cs b/MEOS.NET/Types/TCbufferSeqSet.g.cs index bafdc5b..53a947e 100644 --- a/MEOS.NET/Types/TCbufferSeqSet.g.cs +++ b/MEOS.NET/Types/TCbufferSeqSet.g.cs @@ -13,5 +13,8 @@ public class TCbufferSeqSet : TCbuffer { internal TCbufferSeqSet(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzspanset(Cbuffer cb, SpanSet ss, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TcbufferseqsetFromBaseTstzspanset(cb.Ptr, ss.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TGeo.g.cs b/MEOS.NET/Types/TGeo.g.cs index b13a2d6..52ec178 100644 --- a/MEOS.NET/Types/TGeo.g.cs +++ b/MEOS.NET/Types/TGeo.g.cs @@ -13,23 +13,59 @@ public class TGeo : TSpatial { internal TGeo(IntPtr ptr) : base(ptr) { } + public Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TgeoAtGeom(this.Ptr, gs.Ptr)); + public Temporal? AtStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TgeoAtStbox(this.Ptr, box.Ptr, border_inc)); + public Temporal? AtValue(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TgeoAtValue(this.Ptr, gs.Ptr)); + public Temporal? Centroid() => MEOSFactory.WrapTemporal(Meos.TgeoCentroid(this.Ptr)); + public Geo? ConvexHull() + => MEOSFactory.WrapGeo(Meos.TgeoConvexHull(this.Ptr)); + + public Geo? EndValue() + => MEOSFactory.WrapGeo(Meos.TgeoEndValue(this.Ptr)); + + public Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TgeoMinusGeom(this.Ptr, gs.Ptr)); + public Temporal? MinusStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TgeoMinusStbox(this.Ptr, box.Ptr, border_inc)); + public Temporal? MinusValue(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TgeoMinusValue(this.Ptr, gs.Ptr)); + + public Temporal? Scale(Geo scale, Geo sorigin) + => MEOSFactory.WrapTemporal(Meos.TgeoScale(this.Ptr, scale.Ptr, sorigin.Ptr)); + + public STBox?[] SpaceBoxes(double xsize, double ysize, double zsize, Geo sorigin, bool bitmatrix, bool border_inc) + => MEOSFactory.WrapSTBoxArray(Meos.TgeoSpaceBoxes(this.Ptr, xsize, ysize, zsize, sorigin.Ptr, bitmatrix, border_inc)); + public STBox?[] SplitEachNStboxes(int elem_count) => MEOSFactory.WrapSTBoxArray(Meos.TgeoSplitEachNStboxes(this.Ptr, elem_count)); public STBox?[] SplitNStboxes(int box_count) => MEOSFactory.WrapSTBoxArray(Meos.TgeoSplitNStboxes(this.Ptr, box_count)); + public Geo? StartValue() + => MEOSFactory.WrapGeo(Meos.TgeoStartValue(this.Ptr)); + public STBox?[] Stboxes() => MEOSFactory.WrapSTBoxArray(Meos.TgeoStboxes(this.Ptr)); + public Geo? TraversedArea(bool unary_union) + => MEOSFactory.WrapGeo(Meos.TgeoTraversedArea(this.Ptr, unary_union)); + + public Geo?[] Values() + => MEOSFactory.WrapGeoArray(Meos.TgeoValues(this.Ptr)); + + public static Temporal? FromBaseTemp(Geo gs, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TgeoFromBaseTemp(gs.Ptr, temp.Ptr)); + } } diff --git a/MEOS.NET/Types/TJsonb.g.cs b/MEOS.NET/Types/TJsonb.g.cs index 239c88c..bb9d81a 100644 --- a/MEOS.NET/Types/TJsonb.g.cs +++ b/MEOS.NET/Types/TJsonb.g.cs @@ -20,21 +20,159 @@ public override string ToString() public Temporal? ArrayLength() => MEOSFactory.WrapTemporal(Meos.TjsonbArrayLength(this.Ptr)); + public Temporal? AtValue(Jsonb jsb) + => MEOSFactory.WrapTemporal(Meos.TjsonbAtValue(this.Ptr, jsb.Ptr)); + + public Temporal? Delete(Text key) + => MEOSFactory.WrapTemporal(Meos.TjsonbDelete(this.Ptr, key.Ptr)); + + public Temporal? DeleteArray(Text[] keys) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbDeleteArray(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length)); + } + finally + { + _keys.Free(); + } + } + public Temporal? DeleteIndex(int idx) => MEOSFactory.WrapTemporal(Meos.TjsonbDeleteIndex(this.Ptr, idx)); + public Jsonb? EndValue() + => MEOSFactory.WrapJsonb(Meos.TjsonbEndValue(this.Ptr)); + + public Temporal? Exists(Text key) + => MEOSFactory.WrapTemporal(Meos.TjsonbExists(this.Ptr, key.Ptr)); + + public Temporal? ExistsAll(Text[] keys) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbExistsAll(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length)); + } + finally + { + _keys.Free(); + } + } + + public Temporal? ExistsAny(Text[] keys) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbExistsAny(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length)); + } + finally + { + _keys.Free(); + } + } + + public Temporal? ExistsArray(Text[] keys, bool any) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbExistsArray(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length, any)); + } + finally + { + _keys.Free(); + } + } + + public Temporal? Insert(Text[] keys, Jsonb newjb, bool after) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbInsert(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length, newjb.Ptr, after)); + } + finally + { + _keys.Free(); + } + } + + public Temporal? MinusValue(Jsonb jsb) + => MEOSFactory.WrapTemporal(Meos.TjsonbMinusValue(this.Ptr, jsb.Ptr)); + public string Out() => Meos.TjsonbOut(this.Ptr); public Temporal? Pretty() => MEOSFactory.WrapTemporal(Meos.TjsonbPretty(this.Ptr)); + public Temporal? Set(Text[] keys, Jsonb newjb, bool create, Text handle_null, bool lax) + { + IntPtr[] _keysValues = new IntPtr[keys.Length]; + for (int i = 0; i < keys.Length; i++) + { + _keysValues[i] = keys[i].Ptr; + } + + GCHandle _keys = GCHandle.Alloc(_keysValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TjsonbSet(this.Ptr, _keys.AddrOfPinnedObject(), keys.Length, newjb.Ptr, create, handle_null.Ptr, lax)); + } + finally + { + _keys.Free(); + } + } + + public Jsonb? StartValue() + => MEOSFactory.WrapJsonb(Meos.TjsonbStartValue(this.Ptr)); + public Temporal? StripNulls(bool strip_in_arrays) => MEOSFactory.WrapTemporal(Meos.TjsonbStripNulls(this.Ptr, strip_in_arrays)); public Temporal? ToTtext() => MEOSFactory.WrapTemporal(Meos.TjsonbToTtext(this.Ptr)); + public Jsonb?[] Values() + => MEOSFactory.WrapJsonbArray(Meos.TjsonbValues(this.Ptr)); + + public static Temporal? FromBaseTemp(Jsonb jsonb, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TjsonbFromBaseTemp(jsonb.Ptr, temp.Ptr)); + public static Temporal? FromMFJSON(string str) => MEOSFactory.WrapTemporal(Meos.TjsonbFromMfjson(str)); diff --git a/MEOS.NET/Types/TJsonbInst.g.cs b/MEOS.NET/Types/TJsonbInst.g.cs index 89399af..b37d61a 100644 --- a/MEOS.NET/Types/TJsonbInst.g.cs +++ b/MEOS.NET/Types/TJsonbInst.g.cs @@ -13,5 +13,8 @@ public class TJsonbInst : TJsonb { internal TJsonbInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Jsonb jsonb, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TjsonbinstMake(jsonb.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TJsonbSeq.g.cs b/MEOS.NET/Types/TJsonbSeq.g.cs index 1e9271b..efed139 100644 --- a/MEOS.NET/Types/TJsonbSeq.g.cs +++ b/MEOS.NET/Types/TJsonbSeq.g.cs @@ -13,5 +13,11 @@ public class TJsonbSeq : TJsonb { internal TJsonbSeq(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzset(Jsonb jsonb, Set s) + => MEOSFactory.WrapTemporal(Meos.TjsonbseqFromBaseTstzset(jsonb.Ptr, s.Ptr)); + + public static Temporal? FromBaseTstzspan(Jsonb jsonb, Span sp) + => MEOSFactory.WrapTemporal(Meos.TjsonbseqFromBaseTstzspan(jsonb.Ptr, sp.Ptr)); + } } diff --git a/MEOS.NET/Types/TJsonbSeqSet.g.cs b/MEOS.NET/Types/TJsonbSeqSet.g.cs index 0589ea4..308c9d5 100644 --- a/MEOS.NET/Types/TJsonbSeqSet.g.cs +++ b/MEOS.NET/Types/TJsonbSeqSet.g.cs @@ -13,5 +13,8 @@ public class TJsonbSeqSet : TJsonb { internal TJsonbSeqSet(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzspanset(Jsonb jsonb, SpanSet ss) + => MEOSFactory.WrapTemporal(Meos.TjsonbseqsetFromBaseTstzspanset(jsonb.Ptr, ss.Ptr)); + } } diff --git a/MEOS.NET/Types/TNpoint.g.cs b/MEOS.NET/Types/TNpoint.g.cs index c2ed0db..42f82cc 100644 --- a/MEOS.NET/Types/TNpoint.g.cs +++ b/MEOS.NET/Types/TNpoint.g.cs @@ -17,6 +17,12 @@ internal TNpoint(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(15); + public Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TnpointAtGeom(this.Ptr, gs.Ptr)); + + public Temporal? AtNpoint(Npoint np) + => MEOSFactory.WrapTemporal(Meos.TnpointAtNpoint(this.Ptr, np.Ptr)); + public Temporal? AtNpointset(Set s) => MEOSFactory.WrapTemporal(Meos.TnpointAtNpointset(this.Ptr, s.Ptr)); @@ -26,9 +32,18 @@ public override string ToString() public Temporal? CumulativeLength() => MEOSFactory.WrapTemporal(Meos.TnpointCumulativeLength(this.Ptr)); + public Npoint? EndValue() + => MEOSFactory.WrapNpoint(Meos.TnpointEndValue(this.Ptr)); + public double Length() => Meos.TnpointLength(this.Ptr); + public Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TnpointMinusGeom(this.Ptr, gs.Ptr)); + + public Temporal? MinusNpoint(Npoint np) + => MEOSFactory.WrapTemporal(Meos.TnpointMinusNpoint(this.Ptr, np.Ptr)); + public Temporal? MinusNpointset(Set s) => MEOSFactory.WrapTemporal(Meos.TnpointMinusNpointset(this.Ptr, s.Ptr)); @@ -38,6 +53,9 @@ public double Length() public new string Out(int maxdd) => Meos.TnpointOut(this.Ptr, maxdd); + public Nsegment?[] Positions() + => MEOSFactory.WrapNsegmentArray(Meos.TnpointPositions(this.Ptr)); + public long Route() => Meos.TnpointRoute(this.Ptr); @@ -47,9 +65,24 @@ public long Route() public Temporal? Speed() => MEOSFactory.WrapTemporal(Meos.TnpointSpeed(this.Ptr)); + public Npoint? StartValue() + => MEOSFactory.WrapNpoint(Meos.TnpointStartValue(this.Ptr)); + public Temporal? ToTgeompoint() => MEOSFactory.WrapTemporal(Meos.TnpointToTgeompoint(this.Ptr)); + public Geo? Trajectory() + => MEOSFactory.WrapGeo(Meos.TnpointTrajectory(this.Ptr)); + + public Geo? Twcentroid() + => MEOSFactory.WrapGeo(Meos.TnpointTwcentroid(this.Ptr)); + + public Npoint?[] Values() + => MEOSFactory.WrapNpointArray(Meos.TnpointValues(this.Ptr)); + + public static Temporal? FromBaseTemp(Npoint np, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TnpointFromBaseTemp(np.Ptr, temp.Ptr)); + public static Temporal? FromMFJSON(string mfjson) => MEOSFactory.WrapTemporal(Meos.TnpointFromMfjson(mfjson)); diff --git a/MEOS.NET/Types/TNpointInst.g.cs b/MEOS.NET/Types/TNpointInst.g.cs index b167a0b..9b0e705 100644 --- a/MEOS.NET/Types/TNpointInst.g.cs +++ b/MEOS.NET/Types/TNpointInst.g.cs @@ -13,5 +13,8 @@ public class TNpointInst : TNpoint { internal TNpointInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Npoint np, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TnpointinstMake(np.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TNpointSeq.g.cs b/MEOS.NET/Types/TNpointSeq.g.cs index 3b560b0..e1872a9 100644 --- a/MEOS.NET/Types/TNpointSeq.g.cs +++ b/MEOS.NET/Types/TNpointSeq.g.cs @@ -13,5 +13,11 @@ public class TNpointSeq : TNpoint { internal TNpointSeq(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzset(Npoint np, Set s) + => MEOSFactory.WrapTemporal(Meos.TnpointseqFromBaseTstzset(np.Ptr, s.Ptr)); + + public static Temporal? FromBaseTstzspan(Npoint np, Span s, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TnpointseqFromBaseTstzspan(np.Ptr, s.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TNpointSeqSet.g.cs b/MEOS.NET/Types/TNpointSeqSet.g.cs index 3722161..cda15e6 100644 --- a/MEOS.NET/Types/TNpointSeqSet.g.cs +++ b/MEOS.NET/Types/TNpointSeqSet.g.cs @@ -13,5 +13,8 @@ public class TNpointSeqSet : TNpoint { internal TNpointSeqSet(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzspanset(Npoint np, SpanSet ss, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TnpointseqsetFromBaseTstzspanset(np.Ptr, ss.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TPCBox.g.cs b/MEOS.NET/Types/TPCBox.g.cs new file mode 100644 index 0000000..031260d --- /dev/null +++ b/MEOS.NET/Types/TPCBox.g.cs @@ -0,0 +1,261 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// Point-cloud x time box (bbox of TPcpoint and TPcpatch). + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPCBox : Box + { + internal TPCBox(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(15); + + public int Cmp(TPCBox box2) + => Meos.TpcboxCmp(this.Ptr, box2.Ptr); + + public TPCBox? Copy() + => MEOSFactory.WrapTPCBox(Meos.TpcboxCopy(this.Ptr)); + + public bool Eq(TPCBox box2) + => Meos.TpcboxEq(this.Ptr, box2.Ptr); + + public bool Ge(TPCBox box2) + => Meos.TpcboxGe(this.Ptr, box2.Ptr); + + public bool Geodetic() + => Meos.TpcboxGeodetic(this.Ptr); + + public bool Gt(TPCBox box2) + => Meos.TpcboxGt(this.Ptr, box2.Ptr); + + public bool Hast() + => Meos.TpcboxHast(this.Ptr); + + public bool Hasx() + => Meos.TpcboxHasx(this.Ptr); + + public bool Hasz() + => Meos.TpcboxHasz(this.Ptr); + + public bool Le(TPCBox box2) + => Meos.TpcboxLe(this.Ptr, box2.Ptr); + + public bool Lt(TPCBox box2) + => Meos.TpcboxLt(this.Ptr, box2.Ptr); + + public bool Ne(TPCBox box2) + => Meos.TpcboxNe(this.Ptr, box2.Ptr); + + public string Out(int maxdd) + => Meos.TpcboxOut(this.Ptr, maxdd); + + public uint Pcid() + => Meos.TpcboxPcid(this.Ptr); + + public TPCBox? Round(int maxdd) + => MEOSFactory.WrapTPCBox(Meos.TpcboxRound(this.Ptr, maxdd)); + + public int SRID() + => Meos.TpcboxSrid(this.Ptr); + + public TPCBox? SetSRID(int srid) + => MEOSFactory.WrapTPCBox(Meos.TpcboxSetSrid(this.Ptr, srid)); + + public DateTime? Tmax() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxTmax(this.Ptr, _result)) + { + return null; + } + + return MEOSConvert.ToDateTime(Marshal.ReadInt64(_result)); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public bool? TmaxInc() + { + IntPtr _result = Marshal.AllocHGlobal(1); + try + { + if (!Meos.TpcboxTmaxInc(this.Ptr, _result)) + { + return null; + } + + return Marshal.ReadByte(_result) != 0; + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public DateTime? Tmin() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxTmin(this.Ptr, _result)) + { + return null; + } + + return MEOSConvert.ToDateTime(Marshal.ReadInt64(_result)); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public bool? TminInc() + { + IntPtr _result = Marshal.AllocHGlobal(1); + try + { + if (!Meos.TpcboxTminInc(this.Ptr, _result)) + { + return null; + } + + return Marshal.ReadByte(_result) != 0; + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(Meos.TpcboxToStbox(this.Ptr)); + + public double? Xmax() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxXmax(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public double? Xmin() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxXmin(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public double? Ymax() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxYmax(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public double? Ymin() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxYmin(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public double? Zmax() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxZmax(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public double? Zmin() + { + IntPtr _result = Marshal.AllocHGlobal(8); + try + { + if (!Meos.TpcboxZmin(this.Ptr, _result)) + { + return null; + } + + return Marshal.PtrToStructure(_result); + } + finally + { + Marshal.FreeHGlobal(_result); + } + } + + public static TPCBox? In(string str) + => MEOSFactory.WrapTPCBox(Meos.TpcboxIn(str)); + + public static TPCBox? Make(bool hasx, bool hasz, bool hast, bool geodetic, int srid, uint pcid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, Span period) + => MEOSFactory.WrapTPCBox(Meos.TpcboxMake(hasx, hasz, hast, geodetic, srid, pcid, xmin, xmax, ymin, ymax, zmin, zmax, period.Ptr)); + + } +} diff --git a/MEOS.NET/Types/TPoint.g.cs b/MEOS.NET/Types/TPoint.g.cs index 035955c..e95b38a 100644 --- a/MEOS.NET/Types/TPoint.g.cs +++ b/MEOS.NET/Types/TPoint.g.cs @@ -19,6 +19,12 @@ internal TPoint(IntPtr ptr) : base(ptr) { } public Temporal? AtElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TpointAtElevation(this.Ptr, s.Ptr)); + public new Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TpointAtGeom(this.Ptr, gs.Ptr)); + + public new Temporal? AtValue(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TpointAtValue(this.Ptr, gs.Ptr)); + public Temporal? Azimuth() => MEOSFactory.WrapTemporal(Meos.TpointAzimuth(this.Ptr)); @@ -64,8 +70,23 @@ public double Length() public Temporal? MinusElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TpointMinusElevation(this.Ptr, s.Ptr)); + public new Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TpointMinusGeom(this.Ptr, gs.Ptr)); + + public new Temporal? MinusValue(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TpointMinusValue(this.Ptr, gs.Ptr)); + public Temporal? Speed() => MEOSFactory.WrapTemporal(Meos.TpointSpeed(this.Ptr)); + public Geo? Trajectory(bool unary_union) + => MEOSFactory.WrapGeo(Meos.TpointTrajectory(this.Ptr, unary_union)); + + public Geo? Twcentroid() + => MEOSFactory.WrapGeo(Meos.TpointTwcentroid(this.Ptr)); + + public new static Temporal? FromBaseTemp(Geo gs, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TpointFromBaseTemp(gs.Ptr, temp.Ptr)); + } } diff --git a/MEOS.NET/Types/TPose.g.cs b/MEOS.NET/Types/TPose.g.cs index ae53a5e..6509852 100644 --- a/MEOS.NET/Types/TPose.g.cs +++ b/MEOS.NET/Types/TPose.g.cs @@ -16,6 +16,9 @@ internal TPose(IntPtr ptr) : base(ptr) { } public Temporal? AngularSpeed() => MEOSFactory.WrapTemporal(Meos.TposeAngularSpeed(this.Ptr)); + public Temporal? ApplyGeo(Geo body) + => MEOSFactory.WrapTemporal(Meos.TposeApplyGeo(this.Ptr, body.Ptr)); + public string AsGeopose(int conformance, int precision) => Meos.TposeAsGeopose(this.Ptr, conformance, precision); @@ -28,12 +31,24 @@ public string AsGeoposeStreamElement(Temporal inst, int precision) public Temporal? AtElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TposeAtElevation(this.Ptr, s.Ptr)); + public Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TposeAtGeom(this.Ptr, gs.Ptr)); + + public Temporal? AtPose(Pose pose) + => MEOSFactory.WrapTemporal(Meos.TposeAtPose(this.Ptr, pose.Ptr)); + public Temporal? AtStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TposeAtStbox(this.Ptr, box.Ptr, border_inc)); + public Temporal? ComposePose(Pose frame) + => MEOSFactory.WrapTemporal(Meos.TposeComposePose(this.Ptr, frame.Ptr)); + public Temporal? ComposeTpose(Temporal frame) => MEOSFactory.WrapTemporal(Meos.TposeComposeTpose(this.Ptr, frame.Ptr)); + public Pose? EndValue() + => MEOSFactory.WrapPose(Meos.TposeEndValue(this.Ptr)); + public Temporal? Inverse() => MEOSFactory.WrapTemporal(Meos.TposeInverse(this.Ptr)); @@ -43,6 +58,12 @@ public string AsGeoposeStreamElement(Temporal inst, int precision) public Temporal? MinusElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TposeMinusElevation(this.Ptr, s.Ptr)); + public Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TposeMinusGeom(this.Ptr, gs.Ptr)); + + public Temporal? MinusPose(Pose pose) + => MEOSFactory.WrapTemporal(Meos.TposeMinusPose(this.Ptr, pose.Ptr)); + public Temporal? MinusStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TposeMinusStbox(this.Ptr, box.Ptr, border_inc)); @@ -58,12 +79,24 @@ public string AsGeoposeStreamElement(Temporal inst, int precision) public Temporal? Speed() => MEOSFactory.WrapTemporal(Meos.TposeSpeed(this.Ptr)); + public Pose? StartValue() + => MEOSFactory.WrapPose(Meos.TposeStartValue(this.Ptr)); + public Temporal? ToTpoint() => MEOSFactory.WrapTemporal(Meos.TposeToTpoint(this.Ptr)); + public Geo? Trajectory() + => MEOSFactory.WrapGeo(Meos.TposeTrajectory(this.Ptr)); + + public Pose?[] Values() + => MEOSFactory.WrapPoseArray(Meos.TposeValues(this.Ptr)); + public Temporal? Yaw() => MEOSFactory.WrapTemporal(Meos.TposeYaw(this.Ptr)); + public static Temporal? FromBaseTemp(Pose pose, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TposeFromBaseTemp(pose.Ptr, temp.Ptr)); + public static Temporal? FromGeopose(string json) => MEOSFactory.WrapTemporal(Meos.TposeFromGeopose(json)); diff --git a/MEOS.NET/Types/TPoseInst.g.cs b/MEOS.NET/Types/TPoseInst.g.cs index 3c7213e..6795730 100644 --- a/MEOS.NET/Types/TPoseInst.g.cs +++ b/MEOS.NET/Types/TPoseInst.g.cs @@ -13,5 +13,8 @@ public class TPoseInst : TPose { internal TPoseInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Pose pose, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TposeinstMake(pose.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TPoseSeq.g.cs b/MEOS.NET/Types/TPoseSeq.g.cs index 1f70f9a..8495e0d 100644 --- a/MEOS.NET/Types/TPoseSeq.g.cs +++ b/MEOS.NET/Types/TPoseSeq.g.cs @@ -13,5 +13,11 @@ public class TPoseSeq : TPose { internal TPoseSeq(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzset(Pose pose, Set s) + => MEOSFactory.WrapTemporal(Meos.TposeseqFromBaseTstzset(pose.Ptr, s.Ptr)); + + public static Temporal? FromBaseTstzspan(Pose pose, Span s, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TposeseqFromBaseTstzspan(pose.Ptr, s.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TPoseSeqSet.g.cs b/MEOS.NET/Types/TPoseSeqSet.g.cs index cb5b373..9573bb6 100644 --- a/MEOS.NET/Types/TPoseSeqSet.g.cs +++ b/MEOS.NET/Types/TPoseSeqSet.g.cs @@ -13,5 +13,8 @@ public class TPoseSeqSet : TPose { internal TPoseSeqSet(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzspanset(Pose pose, SpanSet ss, InterpType interp) + => MEOSFactory.WrapTemporal(Meos.TposeseqsetFromBaseTstzspanset(pose.Ptr, ss.Ptr, (int) interp)); + } } diff --git a/MEOS.NET/Types/TRGeometry.g.cs b/MEOS.NET/Types/TRGeometry.g.cs index f4c44fa..5e7eef1 100644 --- a/MEOS.NET/Types/TRGeometry.g.cs +++ b/MEOS.NET/Types/TRGeometry.g.cs @@ -44,6 +44,9 @@ public override string ToString() public Temporal? AtElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TrgeometryAtElevation(this.Ptr, s.Ptr)); + public Temporal? AtGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TrgeometryAtGeom(this.Ptr, gs.Ptr)); + public Temporal? AtStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TrgeometryAtStbox(this.Ptr, box.Ptr, border_inc)); @@ -59,15 +62,24 @@ public override string ToString() public new Temporal? AtTstzspanset(SpanSet ss) => MEOSFactory.WrapTemporal(Meos.TrgeometryAtTstzspanset(this.Ptr, ss.Ptr)); + public Temporal? AtValue(Pose pose) + => MEOSFactory.WrapTemporal(Meos.TrgeometryAtValue(this.Ptr, pose.Ptr)); + public new Temporal? AtValues(Set s) => MEOSFactory.WrapTemporal(Meos.TrgeometryAtValues(this.Ptr, s.Ptr)); public new Temporal? BeforeTimestamptz(DateTime t, bool strict) => MEOSFactory.WrapTemporal(Meos.TrgeometryBeforeTimestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict)); + public Temporal? BodyPointTrajectory(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TrgeometryBodyPointTrajectory(this.Ptr, gs.Ptr)); + public Temporal? Centroid() => MEOSFactory.WrapTemporal(Meos.TrgeometryCentroid(this.Ptr)); + public Geo? ConvexHull() + => MEOSFactory.WrapGeo(Meos.TrgeometryConvexHull(this.Ptr)); + public Temporal? CumulativeLength() => MEOSFactory.WrapTemporal(Meos.TrgeometryCumulativeLength(this.Ptr)); @@ -92,9 +104,15 @@ public override string ToString() public new Temporal? EndSequence() => MEOSFactory.WrapTemporal(Meos.TrgeometryEndSequence(this.Ptr)); + public Geo? EndValue() + => MEOSFactory.WrapGeo(Meos.TrgeometryEndValue(this.Ptr)); + public new double FrechetDistance(Temporal temp2) => Meos.TrgeometryFrechetDistance(this.Ptr, temp2.Ptr); + public Geo? Geom() + => MEOSFactory.WrapGeo(Meos.TrgeometryGeom(this.Ptr)); + public new double HausdorffDistance(Temporal temp2) => Meos.TrgeometryHausdorffDistance(this.Ptr, temp2.Ptr); @@ -113,6 +131,9 @@ public double Length() public Temporal? MinusElevation(Span s) => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusElevation(this.Ptr, s.Ptr)); + public Temporal? MinusGeom(Geo gs) + => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusGeom(this.Ptr, gs.Ptr)); + public Temporal? MinusStbox(STBox box, bool border_inc) => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusStbox(this.Ptr, box.Ptr, border_inc)); @@ -128,6 +149,9 @@ public double Length() public new Temporal? MinusTstzspanset(SpanSet ss) => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusTstzspanset(this.Ptr, ss.Ptr)); + public Temporal? MinusValue(Pose pose) + => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusValue(this.Ptr, pose.Ptr)); + public new Temporal? MinusValues(Set s) => MEOSFactory.WrapTemporal(Meos.TrgeometryMinusValues(this.Ptr, s.Ptr)); @@ -158,6 +182,9 @@ public string Out() public new Temporal? SetInterp(InterpType interp) => MEOSFactory.WrapTemporal(Meos.TrgeometrySetInterp(this.Ptr, (int) interp)); + public STBox?[] SpaceBoxes(double xsize, double ysize, double zsize, Geo sorigin, bool bitmatrix, bool border_inc) + => MEOSFactory.WrapSTBoxArray(Meos.TrgeometrySpaceBoxes(this.Ptr, xsize, ysize, zsize, sorigin.Ptr, bitmatrix, border_inc)); + public Temporal? Speed() => MEOSFactory.WrapTemporal(Meos.TrgeometrySpeed(this.Ptr)); @@ -173,6 +200,9 @@ public string Out() public new Temporal? StartSequence() => MEOSFactory.WrapTemporal(Meos.TrgeometryStartSequence(this.Ptr)); + public Geo? StartValue() + => MEOSFactory.WrapGeo(Meos.TrgeometryStartValue(this.Ptr)); + public STBox?[] Stboxes() => MEOSFactory.WrapSTBoxArray(Meos.TrgeometryStboxes(this.Ptr)); @@ -185,6 +215,12 @@ public string Out() public Temporal? ToTpose() => MEOSFactory.WrapTemporal(Meos.TrgeometryToTpose(this.Ptr)); + public Geo? TraversedArea(bool unary_union) + => MEOSFactory.WrapGeo(Meos.TrgeometryTraversedArea(this.Ptr, unary_union)); + + public Geo? Twcentroid() + => MEOSFactory.WrapGeo(Meos.TrgeometryTwcentroid(this.Ptr)); + public Temporal? Yaw() => MEOSFactory.WrapTemporal(Meos.TrgeometryYaw(this.Ptr)); diff --git a/MEOS.NET/Types/TRGeometryInst.g.cs b/MEOS.NET/Types/TRGeometryInst.g.cs index d317814..3c5f48b 100644 --- a/MEOS.NET/Types/TRGeometryInst.g.cs +++ b/MEOS.NET/Types/TRGeometryInst.g.cs @@ -13,5 +13,8 @@ public class TRGeometryInst : TRGeometry { internal TRGeometryInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Geo geom, Pose pose, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TrgeometryinstMake(geom.Ptr, pose.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TRGeometrySeq.g.cs b/MEOS.NET/Types/TRGeometrySeq.g.cs index 864dea3..28e0967 100644 --- a/MEOS.NET/Types/TRGeometrySeq.g.cs +++ b/MEOS.NET/Types/TRGeometrySeq.g.cs @@ -13,5 +13,24 @@ public class TRGeometrySeq : TRGeometry { internal TRGeometrySeq(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Geo geom, Temporal[] instants, bool lower_inc, bool upper_inc, InterpType interp, bool normalize) + { + IntPtr[] _instantsValues = new IntPtr[instants.Length]; + for (int i = 0; i < instants.Length; i++) + { + _instantsValues[i] = instants[i].Ptr; + } + + GCHandle _instants = GCHandle.Alloc(_instantsValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TrgeometryseqMake(geom.Ptr, _instants.AddrOfPinnedObject(), instants.Length, lower_inc, upper_inc, (int) interp, normalize)); + } + finally + { + _instants.Free(); + } + } + } } diff --git a/MEOS.NET/Types/TRGeometrySeqSet.g.cs b/MEOS.NET/Types/TRGeometrySeqSet.g.cs index 7474e78..af028a5 100644 --- a/MEOS.NET/Types/TRGeometrySeqSet.g.cs +++ b/MEOS.NET/Types/TRGeometrySeqSet.g.cs @@ -13,5 +13,24 @@ public class TRGeometrySeqSet : TRGeometry { internal TRGeometrySeqSet(IntPtr ptr) : base(ptr) { } + public Temporal? Make(Temporal[] sequences, bool normalize) + { + IntPtr[] _sequencesValues = new IntPtr[sequences.Length]; + for (int i = 0; i < sequences.Length; i++) + { + _sequencesValues[i] = sequences[i].Ptr; + } + + GCHandle _sequences = GCHandle.Alloc(_sequencesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapTemporal(Meos.TrgeometryseqsetMake(this.Ptr, _sequences.AddrOfPinnedObject(), sequences.Length, normalize)); + } + finally + { + _sequences.Free(); + } + } + } } diff --git a/MEOS.NET/Types/TText.g.cs b/MEOS.NET/Types/TText.g.cs index 54f98f9..d5d9e42 100644 --- a/MEOS.NET/Types/TText.g.cs +++ b/MEOS.NET/Types/TText.g.cs @@ -17,21 +17,45 @@ internal TText(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(); + public Temporal? AtValue(Text txt) + => MEOSFactory.WrapTemporal(Meos.TtextAtValue(this.Ptr, txt.Ptr)); + + public Text? EndValue() + => MEOSFactory.WrapText(Meos.TtextEndValue(this.Ptr)); + public Temporal? Initcap() => MEOSFactory.WrapTemporal(Meos.TtextInitcap(this.Ptr)); public Temporal? Lower() => MEOSFactory.WrapTemporal(Meos.TtextLower(this.Ptr)); + public Text? MaxValue() + => MEOSFactory.WrapText(Meos.TtextMaxValue(this.Ptr)); + + public Text? MinValue() + => MEOSFactory.WrapText(Meos.TtextMinValue(this.Ptr)); + + public Temporal? MinusValue(Text txt) + => MEOSFactory.WrapTemporal(Meos.TtextMinusValue(this.Ptr, txt.Ptr)); + public string Out() => Meos.TtextOut(this.Ptr); + public Text? StartValue() + => MEOSFactory.WrapText(Meos.TtextStartValue(this.Ptr)); + public Temporal? ToTjsonb() => MEOSFactory.WrapTemporal(Meos.TtextToTjsonb(this.Ptr)); public Temporal? Upper() => MEOSFactory.WrapTemporal(Meos.TtextUpper(this.Ptr)); + public Text?[] Values() + => MEOSFactory.WrapTextArray(Meos.TtextValues(this.Ptr)); + + public static Temporal? FromBaseTemp(Text txt, Temporal temp) + => MEOSFactory.WrapTemporal(Meos.TtextFromBaseTemp(txt.Ptr, temp.Ptr)); + public static Temporal? FromMFJSON(string str) => MEOSFactory.WrapTemporal(Meos.TtextFromMfjson(str)); diff --git a/MEOS.NET/Types/TTextInst.g.cs b/MEOS.NET/Types/TTextInst.g.cs index 058b79c..4b7ad1d 100644 --- a/MEOS.NET/Types/TTextInst.g.cs +++ b/MEOS.NET/Types/TTextInst.g.cs @@ -13,5 +13,8 @@ public class TTextInst : TText { internal TTextInst(IntPtr ptr) : base(ptr) { } + public static Temporal? Make(Text txt, DateTime t) + => MEOSFactory.WrapTemporal(Meos.TtextinstMake(txt.Ptr, MEOSConvert.ToTimestampTz(t))); + } } diff --git a/MEOS.NET/Types/TTextSeq.g.cs b/MEOS.NET/Types/TTextSeq.g.cs index 3dd14da..858166f 100644 --- a/MEOS.NET/Types/TTextSeq.g.cs +++ b/MEOS.NET/Types/TTextSeq.g.cs @@ -13,5 +13,11 @@ public class TTextSeq : TText { internal TTextSeq(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzset(Text txt, Set s) + => MEOSFactory.WrapTemporal(Meos.TtextseqFromBaseTstzset(txt.Ptr, s.Ptr)); + + public static Temporal? FromBaseTstzspan(Text txt, Span s) + => MEOSFactory.WrapTemporal(Meos.TtextseqFromBaseTstzspan(txt.Ptr, s.Ptr)); + } } diff --git a/MEOS.NET/Types/TTextSeqSet.g.cs b/MEOS.NET/Types/TTextSeqSet.g.cs index 546f736..ba42d3c 100644 --- a/MEOS.NET/Types/TTextSeqSet.g.cs +++ b/MEOS.NET/Types/TTextSeqSet.g.cs @@ -13,5 +13,8 @@ public class TTextSeqSet : TText { internal TTextSeqSet(IntPtr ptr) : base(ptr) { } + public static Temporal? FromBaseTstzspanset(Text txt, SpanSet ss) + => MEOSFactory.WrapTemporal(Meos.TtextseqsetFromBaseTstzspanset(txt.Ptr, ss.Ptr)); + } } diff --git a/MEOS.NET/Types/Text.g.cs b/MEOS.NET/Types/Text.g.cs new file mode 100644 index 0000000..f579199 --- /dev/null +++ b/MEOS.NET/Types/Text.g.cs @@ -0,0 +1,39 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// PostgreSQL text, the base type of TText and TextSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Text : Value + { + internal Text(IntPtr ptr) : base(ptr) { } + + /// The text MEOS writes this value as. + public override string ToString() + => this.Out(); + + public Text? Initcap() + => MEOSFactory.WrapText(Meos.TextInitcap(this.Ptr)); + + public Text? Lower() + => MEOSFactory.WrapText(Meos.TextLower(this.Ptr)); + + public string Out() + => Meos.TextOut(this.Ptr); + + public Set? ToSet() + => MEOSFactory.WrapSet(Meos.TextToSet(this.Ptr)); + + public Text? Upper() + => MEOSFactory.WrapText(Meos.TextUpper(this.Ptr)); + + public static Text? In(string str) + => MEOSFactory.WrapText(Meos.TextIn(str)); + + } +} diff --git a/MEOS.NET/Types/TextSet.g.cs b/MEOS.NET/Types/TextSet.g.cs index e4c6a32..b47fe42 100644 --- a/MEOS.NET/Types/TextSet.g.cs +++ b/MEOS.NET/Types/TextSet.g.cs @@ -17,6 +17,9 @@ internal TextSet(IntPtr ptr) : base(ptr) { } public override string ToString() => this.Out(); + public Text? EndValue() + => MEOSFactory.WrapText(Meos.TextsetEndValue(this.Ptr)); + public Set? Initcap() => MEOSFactory.WrapSet(Meos.TextsetInitcap(this.Ptr)); @@ -26,11 +29,36 @@ public override string ToString() public string Out() => Meos.TextsetOut(this.Ptr); + public Text? StartValue() + => MEOSFactory.WrapText(Meos.TextsetStartValue(this.Ptr)); + public Set? Upper() => MEOSFactory.WrapSet(Meos.TextsetUpper(this.Ptr)); + public Text?[] Values() + => MEOSFactory.WrapTextArray(Meos.TextsetValues(this.Ptr)); + public static Set? In(string str) => MEOSFactory.WrapSet(Meos.TextsetIn(str)); + public static Set? Make(Text[] values) + { + IntPtr[] _valuesValues = new IntPtr[values.Length]; + for (int i = 0; i < values.Length; i++) + { + _valuesValues[i] = values[i].Ptr; + } + + GCHandle _values = GCHandle.Alloc(_valuesValues, GCHandleType.Pinned); + try + { + return MEOSFactory.WrapSet(Meos.TextsetMake(_values.AddrOfPinnedObject(), values.Length)); + } + finally + { + _values.Free(); + } + } + } } diff --git a/MEOS.NET/Types/Value.g.cs b/MEOS.NET/Types/Value.g.cs new file mode 100644 index 0000000..6b98fec --- /dev/null +++ b/MEOS.NET/Types/Value.g.cs @@ -0,0 +1,17 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; + +namespace MEOS.NET.Types +{ + /// Base values MEOS passes by reference. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Value : MEOSObject + { + internal Value(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/tools/objectgen.py b/tools/objectgen.py index 889a7ed..5b18e0e 100644 --- a/tools/objectgen.py +++ b/tools/objectgen.py @@ -151,13 +151,13 @@ def __init__(self, idl: dict): self.ctype: dict[str, str] = {} self.meostype: dict[str, str] = {} # class -> its MeosType constant self.subtype_of: dict[str, str] = {} # concrete class -> template subtype + self.wrap_root: dict[str, str] = {} # C struct -> the class it wraps as self._build() def _build(self) -> None: lattice = self.om["lattice"] for name, node in lattice.items(): self.parent[name] = node["parent"] - self.ctype[name] = "Temporal" temptypes = node.get("temptypes") or [] if node["kind"] == "leaf" and len(temptypes) == 1: self.meostype[name] = temptypes[0] @@ -167,7 +167,6 @@ def _build(self) -> None: cls = value.get("class") if cls: self.parent[cls] = "Temporal" - self.ctype[cls] = cls # A concrete class is ``: it inherits the leaf's family surface # and its instances are pointers to the template subtype's struct. @@ -176,25 +175,44 @@ def _build(self) -> None: concrete = leaf + suffix if concrete in self.om["classes"]: self.parent[concrete] = leaf - self.ctype[concrete] = subtype self.subtype_of[concrete] = subtype - for family in ("Box", "Collection"): + for family in self.companion_families(): for name, node in self.om["companions"][family]["nodes"].items(): + if name.startswith("_"): + continue self.parent[name] = node["parent"] if node.get("temptype"): self.meostype[name] = node["temptype"] - for name in self.om["companions"]["Collection"]["nodes"]: - self.ctype[name] = self._collection_ctype(name) - self.ctype["TBox"] = "TBox" - self.ctype["STBox"] = "STBox" - - def _collection_ctype(self, name: str) -> str: - node = self.om["companions"]["Collection"]["nodes"][name] - for a in [name] + list(node["ancestors"]): - if a in ROOT_CTYPE: - return ROOT_CTYPE[a] - return "" + + # What a class's instances are a pointer to is the catalog's to say, so + # every class takes the `cType` the model derives from MEOS's own + # signatures. A binding holding that map itself is one a class the model + # gains cannot reach until the map is edited. + for name, spec in self.om["classes"].items(): + if spec.get("cType"): + self.ctype[name] = spec["cType"] + + # A pointer to a C struct is wrapped in the SHALLOWEST class carrying it, + # so a `GSERIALIZED *` is a Geo and its Geometry and Geography leaves stay + # distinct classes under it, exactly as a `Set *` is a Set. + for name, ct in self.ctype.items(): + best = self.wrap_root.get(ct) + if best is None or self._depth(name) < self._depth(best): + self.wrap_root[ct] = name + + def companion_families(self) -> list[str]: + """The companion hierarchies the model carries, in its own order.""" + return [k for k in self.om["companions"] if not k.startswith("_")] + + def _depth(self, cls: str) -> int: + depth, seen = 0, {cls} + parent = self.parent.get(cls) + while parent and parent not in seen: + seen.add(parent) + depth += 1 + parent = self.parent.get(parent) + return depth def classes(self) -> list[str]: """Every class the model defines, superclass before subclass.""" @@ -236,10 +254,7 @@ def class_for_ctype(self, c_type: str) -> str | None: base = base[:-2].strip() if base in TEMPORAL_STRUCTS: return "Temporal" - for cls, ct in ROOT_CTYPE.items(): - if ct == base: - return cls - return None + return self.wrap_root.get(base) class Method: @@ -286,7 +301,7 @@ def map_return(self, f: dict, wrapper_ret: str) -> tuple[str, str] | None: return (wrapper_ret, "$") cls = self.m.class_for_ctype(c) if cls and wrapper_ret == "IntPtr": - return (f"{cls}?", f"MEOSFactory.Wrap{ROOT_CTYPE[cls]}($)") + return (f"{cls}?", f"MEOSFactory.Wrap{cls}($)") if wrapper_ret == "IntPtr[]": # An array of MEOS values reaches the wrapper as an array of pointers, # whether MEOS returns pointers (`T **`) or the values themselves @@ -294,7 +309,7 @@ def map_return(self, f: dict, wrapper_ret: str) -> tuple[str, str] | None: # element into the class each value's header names. elem = self.m.class_for_ctype(c[:-1] if c.endswith(" **") else c) if elem: - return (f"{elem}?[]", f"MEOSFactory.Wrap{ROOT_CTYPE[elem]}Array($)") + return (f"{elem}?[]", f"MEOSFactory.Wrap{elem}Array($)") if wrapper_ret in ("long[]", "int[]", "double[]", "byte[]"): return (wrapper_ret, "$") return None @@ -582,7 +597,7 @@ def doc_for(self, cls: str) -> str: node = self.m.om["lattice"].get(cls) if node and node.get("doc"): return node["doc"] - for family in ("Box", "Collection"): + for family in self.m.companion_families(): node = self.m.om["companions"][family]["nodes"].get(cls) if node and node.get("doc"): return node["doc"] @@ -855,7 +870,9 @@ def factory_file(self) -> str: } # Only the classes a pointer is actually wrapped in: the template subtypes # are Temporal at the surface (see Model.class_for_ctype). - for root in ("Temporal", "Set", "Span", "SpanSet", "TBox", "STBox"): + roots = [r for c, r in sorted(self.m.wrap_root.items()) + if c not in TEMPORAL_STRUCTS or r == "Temporal"] + for root in roots: lines += self._wrap_method(root, discriminator.get(root), subtype_offset, subtype_values) lines += [" }", "}", ""]