-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SourceTileWMTSComponent): add wmts source component and wmts gri…
…d tile component grid tile wmts has to be a child component of wms source to be compliant with Openlayers architecture. As the tileGrid parameter of source WMTS is mandatory, source intance is created after content initialization with tile grid child component instance as value for tileGrid
- Loading branch information
Showing
8 changed files
with
94 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
node_modules/* | ||
npm-debug.log | ||
|
||
# compiled output | ||
/dist | ||
|
||
# JetBrains | ||
.idea | ||
.project | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Component, Host, Input, OnInit, forwardRef, AfterContentInit , ContentChild } from '@angular/core'; | ||
import { | ||
TileLoadFunctionType, | ||
AttributionLike, | ||
tilegrid, | ||
ProjectionLike, | ||
source, | ||
ImageTile, | ||
TileCoord, | ||
Tile | ||
} from 'openlayers'; | ||
import { LayerTileComponent } from '../layers'; | ||
import { SourceComponent } from './source.component'; | ||
import { TileGridWMTSComponent } from '../tilegridwmts.component'; | ||
|
||
@Component({ | ||
selector: 'aol-source-tilewmts', | ||
template: `<ng-content></ng-content>`, | ||
providers: [ | ||
{ provide: SourceComponent, useExisting: forwardRef(() => SourceTileWMTSComponent) } | ||
] | ||
}) | ||
export class SourceTileWMTSComponent extends SourceComponent implements AfterContentInit { | ||
|
||
instance: source.WMTS; | ||
@Input() cacheSize?: number; | ||
@Input() crossOrigin?: (string); | ||
@Input() logo?: (string | olx.LogoOptions); | ||
@Input() tileGrid: tilegrid.WMTS; | ||
@Input() projection: ProjectionLike; | ||
@Input() reprojectionErrorThreshold?: number; | ||
@Input() requestEncoding?: (source.WMTSRequestEncoding | string); | ||
@Input() layer: string; | ||
@Input() style: string; | ||
@Input() tileClass?: ((n: ImageTile, coords: TileCoord, state: Tile.State, s1: string, s2: string, type: TileLoadFunctionType) => any); | ||
@Input() tilePixelRatio?: number; | ||
@Input() version?: string; | ||
@Input() format?: string; | ||
@Input() matrixSet: string; | ||
@Input() dimensions?: GlobalObject; | ||
@Input() url?: string; | ||
@Input() tileLoadFunction?: TileLoadFunctionType; | ||
@Input() urls?: string[]; | ||
@Input() wrapX?: boolean; | ||
|
||
@ContentChild(TileGridWMTSComponent) tileGridWMTS: TileGridWMTSComponent; | ||
|
||
constructor( @Host() layer: LayerTileComponent) { | ||
super(layer); | ||
} | ||
|
||
ngAfterContentInit(): void { | ||
if (this.tileGridWMTS) { | ||
this.tileGrid = this.tileGridWMTS.instance; | ||
this.instance = new source.WMTS(this); | ||
this.host.instance.setSource(this.instance); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { tilegrid, Extent, Size, Coordinate } from 'openlayers'; | ||
import { TileGridComponent } from './tilegrid.component'; | ||
|
||
@Component({ | ||
selector: 'aol-tilegrid-wmts', | ||
template: '' | ||
}) | ||
export class TileGridWMTSComponent extends TileGridComponent implements OnInit { | ||
instance: tilegrid.WMTS; | ||
|
||
@Input() origin?: Coordinate; | ||
@Input() origins?: Coordinate[]; | ||
@Input() resolutions: number[]; | ||
@Input() matrixIds: string[]; | ||
@Input() sizes?: Size[]; | ||
@Input() tileSizes?: ((number | Size)[]); | ||
@Input() widths?: number[]; | ||
|
||
ngOnInit() { | ||
this.instance = new tilegrid.WMTS(this); | ||
} | ||
} |
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