createWithAltitudeReferenceSystemAndSpatialReferenceId method

Geopoint createWithAltitudeReferenceSystemAndSpatialReferenceId(
  1. BasicGeoposition position,
  2. AltitudeReferenceSystem altitudeReferenceSystem,
  3. int spatialReferenceId
)

Implementation

Geopoint createWithAltitudeReferenceSystemAndSpatialReferenceId(
    BasicGeoposition position,
    AltitudeReferenceSystem altitudeReferenceSystem,
    int spatialReferenceId) {
  final retValuePtr = calloc<COMObject>();

  final hr = ptr.ref.vtable
          .elementAt(8)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(
                          Pointer,
                          BasicGeoposition position,
                          Int32 altitudeReferenceSystem,
                          Uint32 spatialReferenceId,
                          Pointer<COMObject>)>>>()
          .value
          .asFunction<
              int Function(
                  Pointer,
                  BasicGeoposition position,
                  int altitudeReferenceSystem,
                  int spatialReferenceId,
                  Pointer<COMObject>)>()(ptr.ref.lpVtbl, position,
      altitudeReferenceSystem.value, spatialReferenceId, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }

  return Geopoint.fromRawPointer(retValuePtr);
}