Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated 3.x APIs in core-common #7572

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
274667f
Remove isManagedWithIModel
MichaelSwigerAtBentley Jan 16, 2025
2b29b19
Remove override methods
MichaelSwigerAtBentley Jan 16, 2025
80e67e0
Remove getLocalizedStringWithNamespace
MichaelSwigerAtBentley Jan 16, 2025
c0dc76a
Remove TerrainProviderName
MichaelSwigerAtBentley Jan 16, 2025
6e2f826
Remove deprecated props
MichaelSwigerAtBentley Jan 16, 2025
1a9a2c8
Remove BackendTypes
MichaelSwigerAtBentley Jan 16, 2025
7036308
Update NextVersion
MichaelSwigerAtBentley Jan 17, 2025
582f844
Update NextVersion
MichaelSwigerAtBentley Jan 17, 2025
76974ed
BackgroundMapSettings Removal
MichaelSwigerAtBentley Jan 17, 2025
3123e2d
Merge branch 'master' of https://github.com/iTwin/itwinjs-core into m…
MichaelSwigerAtBentley Jan 17, 2025
15c7a2a
Remove RenderMaterial.Params
MichaelSwigerAtBentley Jan 17, 2025
8af7cde
Remove RenderTexture.Params
MichaelSwigerAtBentley Jan 17, 2025
a5de240
Remove getViewThumbnail
MichaelSwigerAtBentley Jan 17, 2025
c812de2
Revert "BackgroundMapSettings Removal"
MichaelSwigerAtBentley Jan 17, 2025
c7846d9
Update Barrel File
MichaelSwigerAtBentley Jan 17, 2025
c18fbba
Update override tests
MichaelSwigerAtBentley Jan 17, 2025
6df6e5c
Merge branch 'master' of https://github.com/iTwin/itwinjs-core into m…
MichaelSwigerAtBentley Jan 21, 2025
8c3ff42
Revert "Remove getViewThumbnail"
MichaelSwigerAtBentley Jan 21, 2025
89d1d50
Remove Deprecated Props from ViewStateHydrator
MichaelSwigerAtBentley Jan 21, 2025
3d1e450
Swap Backend for node:stream
MichaelSwigerAtBentley Jan 21, 2025
b689236
Revert "Remove BackendTypes"
MichaelSwigerAtBentley Jan 22, 2025
9dfb919
Swap out RenderTexture.Params
MichaelSwigerAtBentley Jan 22, 2025
f85395b
Revert "Swap Backend for node:stream"
MichaelSwigerAtBentley Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions core/common/src/BackendTypes.ts

This file was deleted.

13 changes: 0 additions & 13 deletions core/common/src/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,4 @@ export class CodeSpec {
else
this.properties.scopeSpec.fGuidRequired = undefined;
}

/** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.
* @deprecated in 3.6 Use scopeReq instead.
*/
public get isManagedWithIModel(): boolean {
return this.properties.spec?.isManagedWithDgnDb ?? true;
}
public set isManagedWithIModel(value: boolean) {
if (!this.properties.spec)
this.properties.spec = {};

this.properties.spec.isManagedWithDgnDb = value;
}
}
36 changes: 0 additions & 36 deletions core/common/src/FeatureSymbology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,42 +817,6 @@ export class FeatureOverrides implements FeatureAppearanceSource {
map.set(idLo, idHi, app);
}

/** Specify overrides for all elements within the specified model.
* @param id The Id of the model.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same model.
* @note These overrides take priority over all other overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to any element within this model, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideModel(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ modelId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry belonging to the specified [SubCategory]($backend).
* @param id The Id of the subcategory.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same subcategory.
* @note These overrides have lower priority than element and model overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to any geometry within this subcategory, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideSubCategory(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ subCategoryId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry originating from the specified element.
* @param id The Id of the element.
* @param app The symbology overrides.
* @param replaceExisting Specifies whether to replace a pre-existing override for the same element.
* @note These overrides take precedence over subcategory overrides, but not over model overrides.
* @note If [[defaultOverrides]] are defined, they will not apply to this element, even if the supplied appearance overrides nothing.
* @deprecated in 3.x. Use [[FeatureOverrides.override]].
*/
public overrideElement(id: Id64String, app: FeatureAppearance, replaceExisting: boolean = true): void {
this.override({ elementId: id, appearance: app, onConflict: replaceExisting ? "replace" : "skip" });
}

/** Specify overrides for all geometry originating from the specified animation node.
* @param id The Id of the animation node.
* @param app The symbology overrides.
Expand Down
9 changes: 0 additions & 9 deletions core/common/src/Localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ export interface Localization {
* @throws Error if no keys resolve to a string.
*/
getLocalizedString(key: string | string[], options?: TranslationOptions): string;
/** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.
* @param namespace - the namespace that identifies the particular localization file that contains the property.
* @param key - the key that matches a property in the JSON localization file.
* @returns The string corresponding to the first key that resolves.
* @throws Error if no keys resolve to a string.
* @deprecated in 3.x. Use `getLocalizedString` instead; providing either a key with a namespace `<namespace>:<key>` or
* including `{ ns: <namespace> }` in the options.
*/
getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TranslationOptions): string;
/** get the English string for a key. */
getEnglishString(namespace: string, key: string | string[], options?: TranslationOptions): string;
/** Replace all instances of `%{key}` within a string with the translations of those keys.
Expand Down
69 changes: 0 additions & 69 deletions core/common/src/RenderMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import { compareStrings, Guid, GuidString } from "@itwin/core-bentley";
import { ColorDef } from "./ColorDef";
import { TextureMapping } from "./TextureMapping";

/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.
Expand Down Expand Up @@ -36,71 +35,3 @@ export abstract class RenderMaterial {
return compareStrings(this._guid, other._guid);
}
}

/** @public */
export namespace RenderMaterial {
function clampToNormalizedRange(value: number): number {
return Math.max(0.0, Math.min(1.0, value));
}

/** @deprecated in 3.x. Use [CreateRenderMaterialArgs]($frontend). */
export class Params {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These params are also still in use, I'm going to try swapping them out for CreateRenderMaterialArgs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RenderTexture.Params is being using in multiple places in core\frontend

I was able to change one of the files, ParseImdlDoucment.ts, but I'm not sure if its implemented correctly as there is some logic around parsing colors.

@aruniverse @ben-polinsky Who would be best to talk to for more info on how to proceed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmconne will be your best starting point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some of the core-frontend usage is being cleaned up in #7591.

Bear in mind that removing deprecated APIs just means making them unavailable to consumers of the public API. While generally we'll want to delete the APIs entirely, if it's too complicated to clean up our internal usage of a particular one, we can instead move it to /src/internal, and export it from cross-package.ts if it's used in other packages within itwinjs-core.

/** If the material originates from a Material element in the [[IModel]], the Id of that element. */
public key?: string;
/** Diffuse color, or undefined if this material does not override the surface's own color. */
public diffuseColor?: ColorDef;
/** Specular color. Defaults to white if undefined. */
public specularColor?: ColorDef;
/** Currently unused. @alpha */
public emissiveColor?: ColorDef;
/** Currently unused. @alpha */
public reflectColor?: ColorDef;
/** Optional pattern mapping applied to the surface. */
public textureMapping?: TextureMapping;
/** Diffuse weight in [0..1] */
public diffuse: number = 0.6;
/** Specular weight in [0..1] */
public specular: number = 0.4;
public specularExponent: number = 13.5;
/** Currently unused. @alpha */
public reflect: number = 0.0;
/** Currently unused. @alpha */
public refract: number = 1.0;
/** Currently unused. @alpha */
public ambient: number = .3;
/** Currently unused. @alpha */
public shadows = true;
private _alpha?: number;

public constructor(key?: string) { this.key = key; }

/** Obtain an immutable instance of a RenderMaterial with all default properties. */
// eslint-disable-next-line @typescript-eslint/no-deprecated
public static readonly defaults = new Params();

/** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;
* or undefined if this material does not override surface transparency.
*/
public get alpha(): number | undefined { return this._alpha; }
public set alpha(alpha: number | undefined) {
this._alpha = undefined !== alpha ? clampToNormalizedRange(alpha) : undefined;
}

/** Create a RenderMaterial params object using specified key and ColorDef values, as well as an optional texture mapping. */
// eslint-disable-next-line @typescript-eslint/no-deprecated
public static fromColors(key?: string, diffuseColor?: ColorDef, specularColor?: ColorDef, emissiveColor?: ColorDef, reflectColor?: ColorDef, textureMap?: TextureMapping): Params {
// eslint-disable-next-line @typescript-eslint/no-deprecated
const materialParams = new Params();
materialParams.key = key;
materialParams.diffuseColor = diffuseColor;
materialParams.specularColor = specularColor;
materialParams.emissiveColor = emissiveColor;
materialParams.reflectColor = reflectColor;
materialParams.textureMapping = textureMap;
return materialParams;
}
}
}

// eslint-disable-next-line @typescript-eslint/no-deprecated
Object.freeze(RenderMaterial.Params.defaults);
27 changes: 0 additions & 27 deletions core/common/src/RenderTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,4 @@ export namespace RenderTexture {
/** A gradient image used for thematic display. */
ThematicGradient,
}

/** Parameters used to construct a [[RenderTexture]].
* @deprecated in 3.x. use RenderSystem.createTexture and CreateTextureArgs.
* @public
*/
export class Params {
/** A string uniquely identifying this texture within the context of an [[IModel]]. Typically this is the element Id of the corresponding [Texture]($backend) element.
* Textures created on the front-end generally have no key.
*/
public readonly key?: string;
/** Indicates the type of texture. */
public readonly type: RenderTexture.Type;
/** Indicates that some object is managing the lifetime of this texture and will take care of calling its dispose function appropriately.
* An unowned texture associated with a [RenderGraphic]($frontend) will be disposed when the RenderGraphic is disposed.
*/
public readonly isOwned: boolean;

public constructor(key?: string, type: RenderTexture.Type = RenderTexture.Type.Normal, isOwned: boolean = false) {
this.key = key;
this.type = type;
this.isOwned = isOwned;
}

public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }
public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }
public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }
}
}
8 changes: 0 additions & 8 deletions core/common/src/TerrainSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@

import { BackgroundMapProps } from "./BackgroundMapSettings";

/** Identifies a [TerrainProvider]($frontend).
* @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].
* @public
* @extensions
* @deprecated in 3.x. Use string instead.
*/
export type TerrainProviderName = string;

/** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.
* These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to "CesiumWorldTerrain".
* You may alternatively use the Id of any ION asset to which you have access.
Expand Down
4 changes: 0 additions & 4 deletions core/common/src/ViewProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export interface SubCategoryResultRow {
export interface HydrateViewStateRequestProps {
acsId?: string;
notLoadedModelSelectorStateModels?: CompressedId64Set;
/** @deprecated in 3.x. If loading categoryIds is necessary, see [IModelConnection.SubCategoriesCache.load]($frontend)*/
notLoadedCategoryIds?: CompressedId64Set;
sheetViewAttachmentIds?: CompressedId64Set;
viewStateLoadProps?: ViewStateLoadProps;
baseModelId?: Id64String;
Expand All @@ -90,8 +88,6 @@ export interface HydrateViewStateResponseProps {
sheetViewViews?: (ViewStateProps | undefined)[];
baseModelProps?: ModelProps;
spatialViewProps?: ViewStateProps;
/** @deprecated in 3.x. If loading categoryIds is necessary, see [IModelConnection.SubCategoriesCache.load]($frontend)*/
categoryIdsResult?: SubCategoryResultRow[];
}

/** Returned from [IModelDb.Views.getViewStateData]($backend).
Expand Down
2 changes: 0 additions & 2 deletions core/common/src/rpc/IModelReadRpcInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ export abstract class IModelReadRpcInterface extends RpcInterface {
public async getViewStateData(_iModelToken: IModelRpcProps, _viewDefinitionId: string, _options?: ViewStateLoadProps): Promise<ViewStateProps> { return this.forward(arguments); }
public async readFontJson(_iModelToken: IModelRpcProps): Promise<FontMapProps> { return this.forward(arguments); } // eslint-disable-line @typescript-eslint/no-deprecated
public async getToolTipMessage(_iModelToken: IModelRpcProps, _elementId: string): Promise<string[]> { return this.forward(arguments); }
/** @deprecated in 3.x use ViewStore apis. */
public async getViewThumbnail(_iModelToken: IModelRpcProps, _viewId: string): Promise<Uint8Array> { return this.forward(arguments); }
pmconne marked this conversation as resolved.
Show resolved Hide resolved
@RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)
public async getDefaultViewId(_iModelToken: IModelRpcProps): Promise<Id64String> { return this.forward(arguments); }
@RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable)
Expand Down
19 changes: 14 additions & 5 deletions docs/changehistory/NextVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ Table of contents:
- [Node.js](#nodejs)
- [Electron](#electron)
- [ECMAScript](#ecmascript)
- [Deprecated API removals](#deprecated-api-removals)
- [@itwin/core-backend](#itwincore-backend-1)
- [@itwin/core-bentley](#itwincore-bentley)
- [@itwin/appui-abstract](#itwinappui-abstract)
- [@itwin/core-electron](#itwincore-electron)
- [Deprecated API removals](#deprecated-api-removals) - [@itwin/core-backend](#itwincore-backend-1) - [@itwin/core-common](#itwincore-common-1) - [@itwin/core-bentley](#itwincore-bentley) - [@itwin/appui-abstract](#itwinappui-abstract) - [@itwin/core-electron](#itwincore-electron)
- [API removals](#api-removals)
- [Packages dropped](#packages-dropped)
- [Change to pull/merge method](#change-to-pullmerge)
Expand Down Expand Up @@ -110,6 +106,19 @@ The following previously-deprecated APIs have been removed:

All three `nativeDb` fields and `IModelHost.platform` have always been `@internal`. Use the `@public` APIs instead. If some functionality is missing from those APIs, [let us know](https://github.com/iTwin/itwinjs-core/issues/new?template=feature_request.md).

#### @itwin/core-common

| Removed | Replacement |
| ---------------------------------------------- | ---------------------------------------------------- |
| `CodeSpec.isManagedWithIModel` | `CodeSpec.scopeReq` |
| `FeatureOverrides.overrideModel` | `FeatureOverrides.override` |
| `FeatureOverrides.overrideSubCategory` | `FeatureOverrides.override` |
| `FeatureOverrides.overrideElement` | `FeatureOverrides.override` |
| `Localization.getLocalizedStringWithNamespace` | `Localization.getLocalizedString` |
| `TerrainProviderName` | N/A |
| `RenderMaterial.Params` | `CreateRenderMaterialArgs` |
| `RenderTexture.Params` | `RenderSystem.createTexture` and `CreateTextureArgs` |

#### @itwin/core-bentley

| Removed | Replacement |
Expand Down
Loading