AW-6046 ng-openlayers
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { Circle } from 'ol/geom';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-circle',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryCircleComponent extends SimpleGeometryComponent implements OnInit {
|
||||
@Input()
|
||||
get radius(): number {
|
||||
return this.instance.getRadius();
|
||||
}
|
||||
set radius(radius: number) {
|
||||
this.instance.setRadius(radius);
|
||||
}
|
||||
|
||||
public componentType = 'geometry-circle';
|
||||
public instance: Circle;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
// defaulting coordinates to [0,0]. To be overridden in child component.
|
||||
this.instance = new Circle([0, 0]);
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { LineString } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-linestring',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryLinestringComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-linestring';
|
||||
public instance: LineString;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new LineString([
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { MultiLineString } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-multilinestring',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryMultiLinestringComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-multilinestring';
|
||||
public instance: MultiLineString;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new MultiLineString([
|
||||
[
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
],
|
||||
]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { MultiPoint } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-multipoint',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryMultiPointComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-multipoint';
|
||||
public instance: MultiPoint;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new MultiPoint([
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { MultiPolygon } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-multipolygon',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryMultiPolygonComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-multipolygon';
|
||||
public instance: MultiPolygon;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new MultiPolygon([
|
||||
[
|
||||
[
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[0, 1],
|
||||
],
|
||||
],
|
||||
]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { Point } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-point',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryPointComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-point';
|
||||
public instance: Point;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new Point([0, 0]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { SimpleGeometryComponent } from './simplegeometry.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import { Polygon } from 'ol/geom';
|
||||
|
||||
@Component({
|
||||
selector: 'aol-geometry-polygon',
|
||||
template: ` <ng-content></ng-content> `,
|
||||
})
|
||||
export class GeometryPolygonComponent extends SimpleGeometryComponent implements OnInit {
|
||||
public componentType = 'geometry-polygon';
|
||||
public instance: Polygon;
|
||||
|
||||
constructor(map: MapComponent, host: FeatureComponent) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.instance = new Polygon([
|
||||
[
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[0, 1],
|
||||
],
|
||||
]);
|
||||
super.ngOnInit();
|
||||
}
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
import { Input, OnInit, Directive } from '@angular/core';
|
||||
import { FeatureComponent } from '../feature.component';
|
||||
import { MapComponent } from '../map.component';
|
||||
import SimpleGeometry from 'ol/geom/SimpleGeometry';
|
||||
|
||||
@Directive()
|
||||
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||
export abstract class SimpleGeometryComponent implements OnInit {
|
||||
@Input() srid: string;
|
||||
|
||||
public instance: SimpleGeometry;
|
||||
public componentType = 'simple-geometry';
|
||||
|
||||
protected constructor(
|
||||
protected map: MapComponent,
|
||||
protected host: FeatureComponent
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.host.instance.setGeometry(this.instance);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user