packageDocumentation module import { Id64String , JsonUtils } from "@itwin/core-bentley" ; import { ElementMultiAspect , IModelDb } from "@itwin/core-backend" ; import { RelatedElement } from "@itwin/core-common" ; import { DistanceExpressionProps , LinearlyReferencedAtLocationAspectProps , LinearlyReferencedFromToLocationAspectProps , } from "@itwin/linear-referencing-common" ; import { LinearlyReferencedAtPositionRefersToReferent , LinearlyReferencedFromPositionRefersToReferent , LinearlyReferencedToPositionRefersToReferent , } from "./LinearReferencingRelationships" ; beta export class DistanceExpression implements DistanceExpressionProps { public distanceAlongFromStart : number ; public lateralOffsetFromILinearElement ? : number ; public verticalOffsetFromILinearElement ? : number ; public distanceAlongFromReferent ? : number ; constructor ( props ) { this . distanceAlongFromStart = JsonUtils . asDouble ( props . distanceAlongFromStart ) ; this . lateralOffsetFromILinearElement = JsonUtils . asDouble ( props . lateralOffsetFromILinearElement ) ; this . verticalOffsetFromILinearElement = JsonUtils . asDouble ( props . verticalOffsetFromILinearElement ) ; this . distanceAlongFromReferent = JsonUtils . asDouble ( props . distanceAlongFromReferent ) ; } public static fromJSON ( json ) { return new DistanceExpression ( json ) ; } } beta export class LinearlyReferencedLocation extends ElementMultiAspect { internal public static override get className ( ) : string { return "LinearlyReferencedLocation" ; } } beta export class LinearlyReferencedAtLocation extends LinearlyReferencedLocation implements LinearlyReferencedAtLocationAspectProps { internal public static override get className ( ) : string { return "LinearlyReferencedAtLocation" ; } public atPosition : DistanceExpression ; public fromReferent ? : LinearlyReferencedAtPositionRefersToReferent ; constructor ( props , iModel ) { super ( props , iModel ) ; this . atPosition = DistanceExpression . fromJSON ( props . atPosition ) ; this . fromReferent = RelatedElement . fromJSON ( props . fromReferent ) ; } private static toProps ( locatedElementId , at , fromReferentId ? ) { const props = { classFullName : LinearlyReferencedAtLocation . classFullName , element : { id : locatedElementId } , atPosition : at , fromReferent : ( fromReferentId === undefined ) ? undefined : new LinearlyReferencedAtPositionRefersToReferent ( fromReferentId ) } ; return props ; } public static create ( iModel , locatedElementId , at , fromReferentId ? ) { return new LinearlyReferencedAtLocation ( this . toProps ( locatedElementId , at , fromReferentId ) , iModel ) ; } public static insert ( iModel , locatedElementId , at , fromReferentId ? ) { iModel . elements . insertAspect ( this . toProps ( locatedElementId , at , fromReferentId ) ) ; } } beta export class LinearlyReferencedFromToLocation extends LinearlyReferencedLocation implements LinearlyReferencedFromToLocationAspectProps { internal public static override get className ( ) : string { return "LinearlyReferencedFromToLocation" ; } public fromPosition : DistanceExpression ; public fromPositionFromReferent ? : LinearlyReferencedFromPositionRefersToReferent ; public toPosition : DistanceExpression ; public toPositionFromReferent ? : LinearlyReferencedToPositionRefersToReferent ; constructor ( props , iModel ) { super ( props , iModel ) ; this . fromPosition = DistanceExpression . fromJSON ( props . fromPosition ) ; this . toPosition = DistanceExpression . fromJSON ( props . toPosition ) ; this . fromPositionFromReferent = RelatedElement . fromJSON ( props . fromPositionFromReferent ) ; this . toPositionFromReferent = RelatedElement . fromJSON ( props . toPositionFromReferent ) ; } private static toProps ( locatedElementId , from , to , fromReferentId ? , toReferentId ? ) { const props = { classFullName : LinearlyReferencedFromToLocation . classFullName , element : { id : locatedElementId } , fromPosition : from , fromPositionFromReferent : ( fromReferentId === undefined ) ? undefined : new LinearlyReferencedFromPositionRefersToReferent ( fromReferentId ) , toPosition : to , toPositionFromReferent : ( toReferentId === undefined ) ? undefined : new LinearlyReferencedToPositionRefersToReferent ( toReferentId ) } ; return props ; } public static create ( iModel , locatedElementId , from , to , fromReferentId ? , toReferentId ? ) { return new LinearlyReferencedFromToLocation ( this . toProps ( locatedElementId , from , to , fromReferentId , toReferentId ) , iModel ) ; } public static insert ( iModel , locatedElementId , from , to , fromReferentId ? , toReferentId ? ) { iModel . elements . insertAspect ( this . toProps ( locatedElementId , from , to , fromReferentId , toReferentId ) ) ; } }