-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of the @qgis-js/ol package and extentBuffer for XYZ tile …
…rendering (#13)
- Loading branch information
Showing
10 changed files
with
214 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,2 @@ | ||
import type { QgisApi } from "qgis-js"; | ||
|
||
import { | ||
QgisXYZDataSource, | ||
QgisXYZDataSourceOptions, | ||
} from "./QgisXYZDataSource"; | ||
|
||
export type { QgisXYZDataSource }; | ||
|
||
import { | ||
QgisCanvasDataSource, | ||
QgisCanvasDataSourceOptions, | ||
} from "./QgisCanvasDataSource"; | ||
import type { TileCoord } from "ol/tilecoord"; | ||
|
||
export type { QgisCanvasDataSource }; | ||
|
||
export type Mode = "xyz" | "canvas"; | ||
|
||
export class QgisOpenLayers { | ||
QgisXYZDataSource(api: QgisApi, options?: QgisXYZDataSourceOptions) { | ||
return new QgisXYZDataSource( | ||
(tileCoord: TileCoord, tileSize: number, devicePixelRatio: number) => { | ||
return api.renderXYZTile( | ||
tileCoord[1], | ||
tileCoord[2], | ||
tileCoord[0], | ||
tileSize, | ||
devicePixelRatio, | ||
); | ||
}, | ||
{ | ||
...(options ? options : {}), | ||
}, | ||
); | ||
} | ||
QgisCanvasDataSource(api: QgisApi, options?: QgisCanvasDataSourceOptions) { | ||
return new QgisCanvasDataSource( | ||
( | ||
srid: string, | ||
xMin: number, | ||
yMin: number, | ||
xMax: number, | ||
yMax: number, | ||
width: number, | ||
height: number, | ||
pixelRatio: number, | ||
) => { | ||
return api.renderImage( | ||
srid, | ||
new api.Rectangle(xMin, yMin, xMax, yMax), | ||
width, | ||
height, | ||
pixelRatio, | ||
); | ||
}, | ||
{ | ||
...options, | ||
...{ | ||
//TODO: make this work with the projection of the QGIS project | ||
//projection: "EPSG:3857", | ||
//projection: api.srid() | ||
}, | ||
}, | ||
); | ||
} | ||
} | ||
export { QgisXYZDataSource } from "./QgisXYZDataSource"; | ||
export { QgisCanvasDataSource } from "./QgisCanvasDataSource"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.