forma-embedded-view-sdk
Version:
The Forma Embedded View SDK is a JavaScript library for creating custom extensions in Autodesk Forma Site Design (previously Spacemaker).
65 lines (64 loc) • 2.37 kB
TypeScript
import type { FeatureCollection, LineString, Polygon } from "geojson";
import type { IframeMessenger } from "../iframe-messenger.js";
import type { Transform } from "./render.js";
/**
* Render Geojson in the 3D scene.
*
* @remarks
* Available via {@link auto.Forma | Forma}.{@link index.EmbeddedViewSdk.render | render}.{@link render.RenderApi.geojson | geojson}.
*/
export declare class RenderGeojsonApi {
#private;
constructor(iframeMessenger: IframeMessenger);
/**
* Add a Geojson to the scene.
*
* @returns Unique identifier of the Geojson object in the scene.
*
* @example
* const {id} = await Forma.render.geojson.add({ geojson }),
*/
add(request: {
/** Feature collection of a geojson, Right now, we only support LineString and Polygon */
geojson: FeatureCollection<LineString | Polygon>;
/** Transform to position the element relative to the project reference point. Defaults to identity matrix. */
transform?: Transform | undefined;
}): Promise<{
id: string;
}>;
/**
* Upsert an geojson in the scene. If the geojson does not exist, it will be added.
*
* This method can also be used as an upsert.
*
* @example
* await Forma.render.geojson.update({ id: "myPreviouslyAddedGeojsonId", geojson, isImperial, transform })
*/
update(request: {
/** Scene identifier of the Geojson object to update (or create). */
id: string;
/** Feature collection of a geojson, Right now, we only support LineString and Polygon */
geojson: FeatureCollection<LineString | Polygon>;
/** Transform to position the element relative to the project reference point. Defaults to identity matrix. */
transform?: Transform | undefined;
}): Promise<void>;
/**
* Remove an existing Geojson from the scene.
*
* @example
* await Forma.render.geojson.remove({ id: "myPreviouslyAddedGeojsonId" })
*/
remove(request: {
/** Scene identifier of the Geojson object to remove. */
id: string;
}): Promise<void>;
/**
* Remove all Geojsons added by this API from the scene.
*
* Called automatically when the extension is unloaded
*
* @example
* await Forma.render.geojson.cleanup()
*/
cleanup(): Promise<void>;
}