@itwin/core-common
Version:
iTwin.js components common to frontend and backend
225 lines • 12.7 kB
TypeScript
/** @packageDocumentation
* @module Symbology
*/
import { CompressedId64Set, NonFunctionPropertiesOf, OrderedId64Iterable } from "@itwin/core-bentley";
import { LinePixels } from "./LinePixels";
import { RgbColor, RgbColorProps } from "./RgbColor";
/** JSON representation of a [[ContourStyle]].
* @public
*/
export interface ContourStyleProps {
/** See [[ContourStyle.color]]. */
color?: RgbColorProps;
/** See [[ContourStyle.pixelWidth]]. */
pixelWidth?: number;
/** See [[ContourStyle.pattern]]. */
pattern?: LinePixels;
}
/** A type containing all of the properties of [[ContourStyle]] with none of the methods and with the `readonly` modifiers removed.
* Used by [[ContourStyle.create]] and [[ContourStyle.clone]].
* @public
*/
export type ContourStyleProperties = NonFunctionPropertiesOf<ContourStyle>;
/** The style settings used by either a minor or major contour.
* @see [[Contour.majorStyle]]
* @see [[Contour.minorStyle]]
* @public
*/
export declare class ContourStyle {
/** The color in which to draw the contour lines. Default: black. */
readonly color: RgbColor;
/** The width in screen pixels of the contour lines.
* Useful values range between 1 and 8.5, in increments of 0.5. Other values will be rounded to meet these criteria.
* Default: 1.0.
*/
readonly pixelWidth: number;
/** The pattern for a major or minor contour line. Defaults to [[LinePixels.Solid]]. */
readonly pattern: LinePixels;
/** Returns true if `this` and `other` are logically equivalent. */
equals(other: ContourStyle): boolean;
/** Perform ordered comparison between this and another contour style. */
compare(other: ContourStyle): number;
/** Performs ordered comparison of two contour styles.
* @param lhs First contour style to compare
* @param rhs Second contour style to compare
* @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.
* @public
*/
static compare(lhs: ContourStyle, rhs: ContourStyle): number;
private constructor();
static fromJSON(props?: ContourStyleProps): ContourStyle;
toJSON(): ContourStyleProps;
/** Create a new ContourStyle. Any properties not specified by `props` will be initialized to their default values. */
static create(props?: Partial<ContourStyleProperties>): ContourStyle;
/** Create a copy of this ContourStyle, identical except for any properties specified by `changedProps`.
* Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.
*/
clone(changedProps?: Partial<ContourStyleProperties>): ContourStyle;
}
/** JSON representation of a [[Contour]].
* @public
*/
export interface ContourProps {
/** See [[Contour.majorStyle]]. */
majorStyle?: ContourStyleProps;
/** See [[Contour.minor]]. */
minorStyle?: ContourStyleProps;
/** See [[Contour.minorInterval]]. */
minorInterval?: number;
/** See [[Contour.majorIntervalCount]]. */
majorIntervalCount?: number;
/** See [[Contour.showGeometry]] */
showGeometry?: boolean;
}
/** A type containing all of the properties of [[Contour]] with none of the methods and with the `readonly` modifiers removed.
* Used by [[Contour.create]] and [[Contour.clone]].
* @public
*/
export type ContourProperties = NonFunctionPropertiesOf<Contour>;
/** Describes how to generate and style contour lines for geometry within a single [[ContourGroup]].
* Contours provide a way to visualize elevation within a 3d scene by drawing lines at fixed intervals along the z-axis.
* There are actually 2 kinds of contour lines: major and minor. Each kind can be styled independently.
* A contour line is generated every [[minorInterval]] meters. Every `nth` line will be a *major* contour, where `n` = [[majorIntervalCount]]; the intervening lines will
* all be *minor* contours.
* For example, with a [[majorIntervalCount]] of `1`, every contour will be major; of `2`, every other contour will be major; and of `3`, there will be two minor contours in between
* each major contour.
*
* @public
*/
export declare class Contour {
/** Settings that describe how a major contour is styled. Defaults to an instantation of [[ContourStyle]] using `pixelWidth` of 2 and default values for the other properties. */
readonly majorStyle: ContourStyle;
/** Settings that describe how a minor contour is styled. Defaults to an instantation of [[ContourStyle]] using default values for the properties. */
readonly minorStyle: ContourStyle;
/** The interval for the minor contour occurrence in meters; these can be specified as fractional. Defaults to 1. If a value <= 0 is specified, this will be treated as 1 meter. */
readonly minorInterval: number;
/** The count of minor contour intervals that define a major interval (integer > 0). A value of 1 means no minor contours will be shown, only major contours. Defaults to 5. If a value < 1 is specified, this will be treated as 1. If a non-integer value is specified, it will be treated as if it were rounded to the nearest integer. */
readonly majorIntervalCount: number;
/** If true, show underlying geometry along with the associated contours. If false, only show the contours, not the underlying geometry. Defaults to true. */
readonly showGeometry: boolean;
static readonly defaults: Contour;
/** Returns true if `this` is logically equivalent to `other`. */
equals(other: Contour): boolean;
/** Performs ordered comparison between this and another contour. */
compare(other: Contour): number;
/** Performs ordered comparison of two contours.
* @param lhs First contour to compare
* @param rhs Second contour to compare
* @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.
*/
static compare(lhs: Contour, rhs: Contour): number;
private constructor();
static fromJSON(props?: ContourProps): Contour;
toJSON(): ContourProps;
/** Create a new Contour. Any properties not specified by `props` will be initialized to their default values. */
static create(props?: Partial<ContourProperties>): Contour;
/** Create a copy of this Contour, identical except for any properties specified by `changedProps`.
* Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.
*/
clone(changedProps?: Partial<ContourProperties>): Contour;
}
/** JSON representation of a [[ContourGroup]].
* @public
*/
export interface ContourGroupProps {
/** See [[ContourGroup.contourDef]]. */
contourDef?: ContourProps;
/** See [[ContourGroup.subCategories]]. */
subCategories?: CompressedId64Set;
/** See [[ContourGroup.name]]. */
name?: string;
}
/** A type containing all of the properties of [[ContourGroup]] with none of the methods and with the `readonly` modifiers removed.
* Used by [[ContourGroup.create]] and [[ContourGroup.clone]].
* @public
*/
export type ContourGroupProperties = NonFunctionPropertiesOf<ContourGroup>;
/** Defines a group of objects to which to apply [[Contour]] lines in a particular style.
* The [[ContourDisplay]] settings can contain multiple groups.
* Each group is described by a set of [SubCategory]($backend)'s; all geometry belonging to any of those subcategories belongs to the group.
* An empty set of subcategories indicates that this is a default group, implicitly containing all subcategories that are not explicitly included in another group.
* Each group has an optional, non-user-facing name that applications can use to assign semantics to particular groups.
* @public
*/
export declare class ContourGroup {
private _subCategories;
/** Describes the appearance of all of the contours applied to geometry belonging to this group. */
readonly contourDef: Contour;
/** An optional, non-user-facing name that applications can use to assign semantics to particular groups.
* Default: an empty string.
*/
readonly name: string;
/** The set of subcategories belonging to this group, or an empty set if this is a default group. If more than one empty set exists in the [[ContourDisplay]] object's `groups` array, the last entry in that array is used for rendering the default styling.
* @see [[isDefaultGroup]] to test if this is a default group.
*/
get subCategories(): OrderedId64Iterable;
/** Returns true if [[subCategories]] is an empty set, indicating that any subcategory not included in any other [[ContourGroup]] is implicitly
* included in this group.
*/
get isDefaultGroup(): boolean;
/** Returns true if `this` and `other` contain the exact same set of subcategories. */
subCategoriesEqual(other: ContourGroup): boolean;
/** Perform ordered comparison between this and another contour group. */
compare(other: ContourGroup): number;
/** Returns true if `this` and `other` are logically equivalent, having the same styling, name, and set of subcategories. */
equals(other: ContourGroup | undefined): boolean;
private constructor();
static fromJSON(props?: ContourGroupProps): ContourGroup;
toJSON(): ContourGroupProps;
/** Create a new ContourGroup. Any properties not specified by `props` will be initialized to their default values. */
static create(props?: Partial<ContourGroupProperties>): ContourGroup;
/** Create a copy of this ContourGroup, identical except for any properties specified by `changedProps`.
* Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.
*/
clone(changedProps?: Partial<ContourGroupProperties>): ContourGroup;
}
/** JSON representation of [[ContourDisplay]] settings.
* @public
*/
export interface ContourDisplayProps {
/** See [[ContourDisplay.groups]]. */
groups?: ContourGroupProps[];
/** See [[ContourDisplay.displayContours]]. */
displayContours?: boolean;
}
/** A type containing all of the properties of [[ContourDisplay]] with none of the methods and with the `readonly` modifiers removed.
* Used by [[ContourDisplay.create]] and [[ContourDisplay.clone]].
* @public
*/
export type ContourDisplayProperties = NonFunctionPropertiesOf<ContourDisplay>;
/** Settings that specify how to apply [contour lines]($docs/learning/display/ContourDisplay.md) to groups of geometry
* within a 3d scene.
* @see [[DisplayStyle3dSettings.contours]] to associate contour settings with a display style.
* @public
*/
export declare class ContourDisplay {
/** A list of the groups, each describing their own specific contour display settings. Defaults to an empty array.
* @note The display system supports no more than [[ContourDisplay.maxContourGroups]]. Entries in this array exceeding that maximum will
* have no effect on the display of contour lines.
*/
readonly groups: ContourGroup[];
/** Whether to display the contour lines described by these settings. Default: false.
* @see [[withDisplayContours]] to change this flag.
*/
readonly displayContours: boolean;
/** The maximum number of contour groups that the system will allow. Any contour groups added to the [[groups]] array beyond this number will be ignored
* for display purposes.
*/
static readonly maxContourGroups = 5;
/** Perform ordered comparison between this and another `ContourDisplay`. */
compare(other: ContourDisplay): number;
/** Returns true if `this` and `other` are logically equivalent, having the same groups and styling. */
equals(other: ContourDisplay): boolean;
private constructor();
static fromJSON(props?: ContourDisplayProps): ContourDisplay;
toJSON(): ContourDisplayProps;
/** Create a new ContourDisplay. Any properties not specified by `props` will be initialized to their default values. */
static create(props?: Partial<ContourDisplayProperties>): ContourDisplay;
/** Create a copy of these settings, changing the `displayContours` flag as specified. */
withDisplayContours(displayContours: boolean): ContourDisplay;
/** Create a copy of this ContourDisplay, identical except for any properties specified by `changedProps`.
* Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.
*/
clone(changedProps?: Partial<ContourDisplayProperties>): ContourDisplay;
}
//# sourceMappingURL=ContourDisplay.d.ts.map