Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
HARP-11509: Remove usages of @here/harp-omv-datasource from the examples
Browse files Browse the repository at this point in the history
This change replaces the usages of the deprecate module
@here/harp-omv-datasource with @here/harp-vectortile-datasource.

Signed-off-by: Roberto Raggi <roberto.raggi@here.com>
  • Loading branch information
robertoraggi committed Aug 12, 2020
1 parent b967f3c commit c610279
Show file tree
Hide file tree
Showing 31 changed files with 142 additions and 91 deletions.
9 changes: 6 additions & 3 deletions @here/harp-examples/decoder/decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ declare let self: Worker & {

self.importScripts("three.min.js");

import { OmvTileDecoderService, OmvTilerService } from "@here/harp-omv-datasource/index-worker";
import {
GeoJsonTilerService,
VectorTileDecoderService
} from "@here/harp-vectortile-datasource/index-worker";
import { CustomDecoderService } from "./custom_decoder";

OmvTileDecoderService.start();
OmvTilerService.start();
VectorTileDecoderService.start();
GeoJsonTilerService.start();

//Following code is only needed for datasource_custom example.
// snippet:custom_datasource_example_custom_decoder_service_start.ts
Expand Down
20 changes: 12 additions & 8 deletions @here/harp-examples/lib/PerformanceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ import {
SimpleFrameStatistics
} from "@here/harp-mapview";
import { debugContext } from "@here/harp-mapview/lib/DebugContext";
import { APIFormat, AuthenticationMethod, OmvDataSource } from "@here/harp-omv-datasource";
import { assert, LoggerManager, PerformanceTimer } from "@here/harp-utils";
import {
APIFormat,
AuthenticationMethod,
VectorTileDataSource
} from "@here/harp-vectortile-datasource";
import * as THREE from "three";
import { apikey, copyrightInfo } from "../config";
import { PerformanceTestData } from "./PerformanceConfig";
Expand All @@ -31,7 +35,7 @@ export namespace PerformanceUtils {
mapView: MapView;
mapControls: MapControls;
omvDataSourceConnected: boolean;
mainDataSource: OmvDataSource | undefined;
mainDataSource: VectorTileDataSource | undefined;
}

export interface ThemeDef {
Expand Down Expand Up @@ -175,11 +179,11 @@ export namespace PerformanceUtils {
dataSourceTypes: string[],
storageLevelOffsetModifier: number
): Promise<DataSource[]> {
const createDataSource = (dataSourceType: string): OmvDataSource => {
let dataSource: OmvDataSource | undefined;
const createDataSource = (dataSourceType: string): VectorTileDataSource => {
let dataSource: VectorTileDataSource | undefined;
switch (dataSourceType) {
case "OMV":
dataSource = new OmvDataSource({
dataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
Expand Down Expand Up @@ -207,7 +211,7 @@ export namespace PerformanceUtils {
}

return mapViewApp.mapView.addDataSource(dataSource).then(() => {
if (dataSource instanceof OmvDataSource) {
if (dataSource instanceof VectorTileDataSource) {
mapViewApp.omvDataSourceConnected = true;
}
return dataSource;
Expand Down Expand Up @@ -678,15 +682,15 @@ export namespace PerformanceUtils {

function applyDataFilter(mapView: MapView, showLabels: boolean) {
for (const dataSource of mapView.dataSources) {
if (dataSource instanceof OmvDataSource) {
if (dataSource instanceof VectorTileDataSource) {
applyDataFilterToDataSource(mapView, dataSource, showLabels);
}
}
}

function applyDataFilterToDataSource(
mapView: MapView,
dataSource: OmvDataSource,
dataSource: VectorTileDataSource,
showLabels: boolean
) {
const tileGeometryManager = mapView.tileGeometryManager;
Expand Down
2 changes: 1 addition & 1 deletion @here/harp-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@here/harp-mapview": "^0.18.0",
"@here/harp-mapview-decoder": "^0.18.0",
"@here/harp-materials": "^0.18.0",
"@here/harp-omv-datasource": "^0.18.0",
"@here/harp-vectortile-datasource": "^0.18.0",
"@here/harp-text-canvas": "^0.18.0",
"@here/harp-utils": "^0.18.0",
"@here/harp-webtile-datasource": "^0.18.0",
Expand Down
8 changes: 4 additions & 4 deletions @here/harp-examples/src/bounds-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { GeoCoordinates, mercatorProjection } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { BoundsGenerator, CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";

import { apikey } from "../config";

Expand Down Expand Up @@ -85,7 +85,7 @@ export namespace BoundsExample {
map.resize(window.innerWidth, window.innerHeight);
});

addOmvDataSource(map);
addVectorTileDataSource(map);
const featureList: MapViewFeature[] = []; //createFeatureList();
let featuresDataSource: FeaturesDataSource | undefined;
//@ts-ignore
Expand Down Expand Up @@ -169,8 +169,8 @@ export namespace BoundsExample {
return map;
}

function addOmvDataSource(map: MapView) {
const omvDataSource = new OmvDataSource({
function addVectorTileDataSource(map: MapView) {
const omvDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
4 changes: 2 additions & 2 deletions @here/harp-examples/src/camera-animations_key-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ControlPoint
} from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";
import { GUI } from "dat.gui";
import THREE = require("three");

Expand Down Expand Up @@ -243,7 +243,7 @@ export namespace CameraAnimationExample {
mapView.resize(window.innerWidth, window.innerHeight);
});

const omvDataSource = new OmvDataSource({
const omvDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { GeoCoordinates, sphereProjection } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";

import { apikey } from "../config";
import { faults, hotspots } from "../resources/geology";
Expand Down Expand Up @@ -225,7 +225,7 @@ export namespace LinesPointsFeaturesExample {

CopyrightElementHandler.install("copyrightNotice", mapView);

const baseMap = new OmvDataSource({
const baseMap = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
4 changes: 2 additions & 2 deletions @here/harp-examples/src/datasource_features_polygons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { GeoCoordinates, sphereProjection } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";
import * as THREE from "three";

import { apikey } from "../config";
Expand Down Expand Up @@ -334,7 +334,7 @@ export namespace PolygonsFeaturesExample {

CopyrightElementHandler.install("copyrightNotice", mapView);

const baseMap = new OmvDataSource({
const baseMap = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
6 changes: 3 additions & 3 deletions @here/harp-examples/src/datasource_geojson_choropleth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Style, StyleSet, Theme } from "@here/harp-datasource-protocol";
import { GeoCoordinates } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { GeoJsonDataProvider, OmvDataSource } from "@here/harp-omv-datasource";
import { GeoJsonDataProvider, VectorTileDataSource } from "@here/harp-vectortile-datasource";
import * as THREE from "three";

import { apikey } from "../config";
Expand Down Expand Up @@ -88,7 +88,7 @@ export namespace GeoJsonHeatmapExample {

CopyrightElementHandler.install("copyrightNotice", mapView);

const baseMapDataSource = new OmvDataSource({
const baseMapDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down Expand Up @@ -166,7 +166,7 @@ export namespace GeoJsonHeatmapExample {
"italy",
new URL("resources/italy.json", window.location.href)
);
const geoJsonDataSource = new OmvDataSource({
const geoJsonDataSource = new VectorTileDataSource({
dataProvider: geoJsonDataProvider,
styleSetName: "geojson"
});
Expand Down
6 changes: 3 additions & 3 deletions @here/harp-examples/src/datasource_geojson_custom-shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { GeoBox, GeoCoordinates, GeoPointLike } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { GeoJsonDataProvider, OmvDataSource } from "@here/harp-omv-datasource";
import { GeoJsonDataProvider, VectorTileDataSource } from "@here/harp-vectortile-datasource";
import { apikey } from "../config";

import * as geojson from "../resources/polygon.json";
Expand Down Expand Up @@ -118,7 +118,7 @@ export namespace GeoJsonCustomShaderExample {
start() {}

private addBaseMap() {
const dataSource = new OmvDataSource({
const dataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand All @@ -127,7 +127,7 @@ export namespace GeoJsonCustomShaderExample {
}

private addEvRange() {
const datasource = new OmvDataSource({
const datasource = new VectorTileDataSource({
dataProvider: new GeoJsonDataProvider("geojson", geojson as any),
styleSetName: "geojson"
});
Expand Down
16 changes: 8 additions & 8 deletions @here/harp-examples/src/datasource_geojson_styling_game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ import {
APIFormat,
AuthenticationMethod,
GeoJsonDataProvider,
OmvDataSource
} from "@here/harp-omv-datasource";
VectorTileDataSource
} from "@here/harp-vectortile-datasource";
import { apikey, copyrightInfo } from "../config";
import * as geojson from "../resources/italy.json";

/**
* In this example showcases how to use the styling of a [[OmvDataSource]] that using a
* In this example showcases how to use the styling of a [[VectorTileDataSource]] that using a
* [[GeoJsonDataProvider]] with a dynamic [[StyleSet]] to generate a quiz game. First, we generate a
* [[MapView]], without [[MapControls]] this time, and then we also attach an additional base map
* from an [[OmvDataSource]].
* from an [[VectorTileDataSource]].
* ```typescript
* [[include:harp_gl_initmapview.ts]]
* ```
*
* We then create the map of Italy via a [[OmvDataSource]] that only serves one GeoJson.
* We then create the map of Italy via a [[VectorTileDataSource]] that only serves one GeoJson.
* This is performed via a custom class, `GeoJsonDataProvider`. When the datasource is linked we
* then set its [[StyleSet]] and add the click listener on the canvas to handle the quiz logic.
* ```typescript
Expand All @@ -34,7 +34,7 @@ import * as geojson from "../resources/italy.json";
*
* The quiz logic is performed when a region is picked. The name of the picked
* region is compared to the expected name, and if they match, an update to the
* [[OmvDataSource]]'s [[StyleSet]] is performed.
* [[VectorTileDataSource]]'s [[StyleSet]] is performed.
* ```typescript
* [[include:harp_gl_gamelogic.ts]]
* ```
Expand Down Expand Up @@ -94,7 +94,7 @@ export namespace GeoJsonStylingGame {
mapView.resize(window.innerWidth, window.innerHeight);
});
mapView.canvas.addEventListener("contextmenu", e => e.preventDefault());
const baseMap = new OmvDataSource({
const baseMap = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
Expand All @@ -114,7 +114,7 @@ export namespace GeoJsonStylingGame {
new URL("resources/italy.json", window.location.href)
);

const geoJsonDataSource = new OmvDataSource({
const geoJsonDataSource = new VectorTileDataSource({
dataProvider: geoJsonDataProvider,
name: "geojson",
styleSetName: "geojson",
Expand Down
10 changes: 7 additions & 3 deletions @here/harp-examples/src/datasource_here_vector_tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
*/
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { APIFormat, AuthenticationMethod, OmvDataSource } from "@here/harp-omv-datasource";
import {
APIFormat,
AuthenticationMethod,
VectorTileDataSource
} from "@here/harp-vectortile-datasource";

import { apikey, copyrightInfo } from "../config";

Expand Down Expand Up @@ -43,7 +47,7 @@ import { apikey, copyrightInfo } from "../config";
* [[include:harp_gl_datasource_here_vector_tile_example_3.ts]]
* ```
* At the end of the initialization a [[MapView]] object is returned. To show vector tiles the HERE
* Vector Tile datasource is used, [[OmvDataSource]]:
* Vector Tile datasource is used, [[VectorTileDataSource]]:
*
* ```typescript
* [[include:harp_gl_datasource_here_vector_tile_example_4.ts]]
Expand Down Expand Up @@ -97,7 +101,7 @@ export namespace DatasourceHEREVectorTileExample {
const mapView = initializeMapView("mapCanvas");

// snippet:harp_gl_datasource_here_vector_tile_example_4.ts
const omvDataSource = new OmvDataSource({
const omvDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
apiFormat: APIFormat.XYZOMV,
styleSetName: "tilezen",
Expand Down
4 changes: 2 additions & 2 deletions @here/harp-examples/src/geojson-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { StyleSet, Theme } from "@here/harp-datasource-protocol";
import { FeaturesDataSource } from "@here/harp-features-datasource";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";
import { apikey } from "../config";

/**
Expand Down Expand Up @@ -169,7 +169,7 @@ export namespace GeoJsonExample {
mapView.resize(innerWidth - _width, innerHeight);
});

const baseMap = new OmvDataSource({
const baseMap = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
6 changes: 3 additions & 3 deletions @here/harp-examples/src/getting-started_free-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
MapViewOptions,
MapViewUtils
} from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";
import * as THREE from "three";
import { apikey } from "../config";

Expand Down Expand Up @@ -94,13 +94,13 @@ export namespace FreeCameraAppDebuggingToolExample {
}

/**
* Attaches the [[OmvDataSource]] and [[DebugTileDataSource]] to the map as well as
* Attaches the [[VectorTileDataSource]] and [[DebugTileDataSource]] to the map as well as
* initializes the debug view (making the: `R`, `T` and `V` keys modify the camera's current
* rotation (`R`), translation/postion (`T`) and changing the camera view to the one the
* user is seeing (`V`).
*/
start() {
const omvDataSource = new OmvDataSource({
const omvDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
4 changes: 2 additions & 2 deletions @here/harp-examples/src/getting-started_globe-projection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { sphereProjection } from "@here/harp-geoutils";
import { MapControls, MapControlsUI } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
import { OmvDataSource } from "@here/harp-omv-datasource";
import { VectorTileDataSource } from "@here/harp-vectortile-datasource";
import { apikey } from "../config";

export namespace GlobeExample {
Expand Down Expand Up @@ -35,7 +35,7 @@ export namespace GlobeExample {
function main() {
const map = initializeMapView("mapCanvas");

const omvDataSource = new OmvDataSource({
const omvDataSource = new VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
authenticationCode: apikey
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
};
const copyrights = [hereCopyrightInfo];

const omvDataSource = new harp.OmvDataSource({
const omvDataSource = new harp.VectorTileDataSource({
baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
apiFormat: harp.APIFormat.XYZOMV,
styleSetName: "tilezen",
Expand Down
Loading

0 comments on commit c610279

Please sign in to comment.