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).
109 lines (108 loc) • 3.46 kB
TypeScript
import type { FeatureCollection } from "geojson";
import type { IframeMessenger } from "./iframe-messenger.js";
import type { LibraryItem } from "./library.js";
export type Licensing = {
/**
* Whether or not data can be transferred out of Forma Site Design, for example
* by downloading a data file or sending a project to Revit.
*/
exportable: boolean | undefined;
/**
* Attribution requirements that must be followed.
* Empty if there are no requirements.
*/
attributions: {
/**
* We support two types of attribution actions, depending on what happens to the data:
* - display: A watermark (clickable text) to be shown whenever data is displayed.
* - transfer: Text to be shown to users (or put in LICENCE files or similar) whenever data is imported or exported.
*/
action: "display" | "transfer";
content: string;
url: string;
}[];
/**
* Link to the original license for the data.
*/
licenseUrl: string;
/**
* Link to the providers description on how the license should be interpreted.
* For auditing purposes.
*/
providerDescriptionUrl: string;
};
/**
* Upload buildings, roads and property boundaries and add it to the library.
*
* @remarks
* Available via {@link auto.Forma | Forma}.{@link index.EmbeddedViewSdk.geoData | geoData}.
*/
export declare class GeoDataApi {
#private;
/** @hidden */
constructor(iframeMessenger: IframeMessenger);
/**
* Uploads buldings, roads or property boundaries as geojson to forma, does some internal processing and adds the data to the library.
* Currently supports 2.5D buildings, roads and property boundaries.
* 2.5D buildings will need an elevation and height property, which defaults to 0 and 3 meters.
*
* @returns The library item for uploaded data.
*
* @example
const response = await Forma.geoData.upload({
data: {
type: "FeatureCollection",
features: [
{
type: "Feature",
properties: {
height: 10,
elevation: 0
},
geometry: {
type: "Polygon",
coordinates: [
[
[-74.0060, 40.7128],
[-74.0060, 40.7129],
[-74.0059, 40.7129],
[-74.0059, 40.7128],
[-74.0060, 40.7128]
]
]
}
}
]
},
dataType: "buildings",
geoLocation: {
srid: 4326,
refPoint: [0, 0]
}
});
*/
upload(request: {
/**
* Data in GeoJSON format.
*/
data: FeatureCollection;
geoLocation?: {
/**
* The spatial reference identifier (SRID) for the data.
*/
srid: number;
/**
* The reference point of the data in the given SRID.
*/
refPoint: [number, number];
};
/**
* Specifies the type of data.
*/
dataType: "buildings" | "roads" | "property-boundaries";
/**
* Information related to the licensing governing the use and transfer of this element.
*/
licensing?: Licensing;
}): Promise<LibraryItem>;
}