@itwin/measure-tools-react
Version:
Frontend framework and tools for measurements
143 lines • 5.5 kB
TypeScript
import type { Arc3d, LineSegment3d, Path, Point3d, XYProps } from "@itwin/core-geometry";
import type { ColorDefProps, LinePixels } from "@itwin/core-common";
import { ColorDef } from "@itwin/core-common";
import type { GraphicBuilder } from "@itwin/core-frontend";
/** List of well-known graphic styles. */
export declare enum WellKnownGraphicStyleType {
AreaMeasurement = "AreaMeasurement",
AreaMeasurementDynamic = "AreaMeasurementDynamic",
DistanceMeasurement = "DistanceMeasurement",
LocationMeasurement = "LocationMeasurement",
Rise = "Rise",
Run = "Run"
}
/** Defines the placement of an icon relative to its parent. */
export declare enum IconAlignment {
TopLeft = 0,
Top = 1,
TopRight = 2,
Left = 3,
Center = 4,
Right = 5,
BottomLeft = 6,
Bottom = 7,
BottomRight = 8
}
/** Describes a Svg webfont icon that can be drawn with TextMarker */
export interface IconStyleProps {
iconSpec: string;
position?: IconAlignment;
offset?: XYProps;
size?: number;
iconColor?: ColorDefProps;
padding?: number;
bgColor?: ColorDefProps;
bgCornerRadius?: number;
borderWidth?: number;
borderColor?: ColorDefProps;
}
export declare enum TextOffsetType {
Pixels = 0,
Percentage = 1
}
export interface TextOffsetProps {
x: number;
y: number;
type: TextOffsetType;
}
/** Describes a simple symbology to use with TextMarker */
export interface TextStyleProps {
textFont: string;
textLineHeight?: number;
textColor?: ColorDefProps;
boxPadding?: number;
boxCornerRadius?: number;
boxBorderWidth?: number;
boxBorderColor?: ColorDefProps;
boxColor?: ColorDefProps;
icon?: IconStyleProps;
}
/** List of well-known text styles. */
export declare enum WellKnownTextStyleType {
AreaMeasurement = "AreaMeasurement",
DistanceMeasurement = "DistanceMeasurement",
LocationMeasurement = "LocationMeasurement",
Rise = "Rise",
Run = "Run",
HoverBox = "HoverBox"
}
/** Describes the properties of a GraphicStyle. */
export interface GraphicStyleProps {
lineColor: ColorDefProps;
fillColor: ColorDefProps;
lineWidth: number;
linePixels?: LinePixels;
backgroundColor?: ColorDefProps;
backgroundLineWidth?: number;
}
export declare class GraphicStyle implements GraphicStyleProps {
static readonly defaultLineWidthPaddingForBackground = 4;
private _lineColorDef;
private _fillColorDef;
lineWidth: number;
linePixels?: LinePixels;
private _backgroundColorDef?;
backgroundLineWidth?: number;
constructor(props: GraphicStyleProps);
get lineColorDef(): ColorDef;
get lineColor(): ColorDefProps;
set lineColor(v: ColorDefProps);
get fillColorDef(): ColorDef;
get fillColor(): ColorDefProps;
set fillColor(v: ColorDefProps);
get backgroundColorDef(): ColorDef | undefined;
get backgroundColor(): ColorDefProps | undefined;
set backgroundColor(v: ColorDefProps | undefined);
/** Adds a Path to the builder with the provided symbology. */
addStyledPath(builder: GraphicBuilder, path: Path, useBackground: boolean): void;
/** Adds a Point String to the builder with the provided symbology. */
addStyledPointString(builder: GraphicBuilder, points: Point3d[], useBackground: boolean): void;
/** Adds a Line String to the builder with the provided symbology. */
addStyledLineString(builder: GraphicBuilder, points: Point3d[], useBackground: boolean): void;
/** Adds a Line to the builder with the provided symbology. */
addStyledLine(builder: GraphicBuilder, line: LineSegment3d, useBackground: boolean): void;
/** Adds a Shape to the builder with the provided symbology. */
addStyledShape(builder: GraphicBuilder, points: Point3d[], useBackground: boolean): void;
addStyledArc(builder: GraphicBuilder, arc: Arc3d, useBackground: boolean): void;
private applyBackground;
applyStyle(builder: GraphicBuilder): void;
clone(): GraphicStyle;
}
export declare class StyleSet {
private static _styleSets;
private _name;
private _graphicStyles;
private _textStyles;
private _fallbackStyleSetName?;
private _fallbackStyleSet?;
/** Gets or sets the styleset's name */
get name(): string;
set name(name: string);
/** Gets or sets the optional fallback styleset */
get fallbackStyleSetName(): string | undefined;
set fallbackStyleSetName(value: string | undefined);
/** Gets the fallback styleset instance, if it exists. */
get fallbackStyleSet(): StyleSet | undefined;
constructor(name: string);
getGraphicStyle(name: string): GraphicStyle | undefined;
setGraphicStyle(name: string, styleProps: GraphicStyleProps): void;
getTextStyle(name: string): TextStyleProps | undefined;
setTextStyle(name: string, style: TextStyleProps): void;
clone(newName?: string): StyleSet;
/** Returns the default StyleSet */
static get default(): StyleSet;
/** Returns the default "locked" StyleSet for inactive/frozen elements that cannot be moved or manipulated. */
static get defaultLocked(): StyleSet;
/** Returns the StyleSet matching the name, or undefined. */
static get(name: string): StyleSet | undefined;
/** Returns the StyleSet maching the name or the 'default' set. */
static getOrDefault(name: string): StyleSet;
/** Adds a StyleSet. */
static set(styleSet: StyleSet): void;
}
//# sourceMappingURL=GraphicStyle.d.ts.map