Compare commits
No commits in common. "48574dc0b0d8343b7e6d972801c82d3b0fc8e220" and "aa1ad9f8444674cb3fe6a63c9b357fe31716cddf" have entirely different histories.
48574dc0b0
...
aa1ad9f844
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -8,13 +8,13 @@ pipeline {
|
||||
stage('npm install'){
|
||||
steps {
|
||||
sh '''rm -rf node_modules/
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd projects/common
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd ../common-map
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd ../common-map3d
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +164,7 @@ export {
|
||||
ITemporalItemLayer,
|
||||
TemporalItemLayer,
|
||||
ifZoomToShowDirective,
|
||||
ZoomToShowAlert,
|
||||
IClickedFeature
|
||||
ZoomToShowAlert
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, OnInit,ViewChild } from '@angular/core';
|
||||
import { Feature} from 'ol';
|
||||
import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
|
||||
import * as extent from 'ol/extent';
|
||||
@ -10,56 +10,25 @@ import * as style from 'ol/style';
|
||||
templateUrl: './feature-thumbnail.component.html',
|
||||
styleUrls: ['./feature-thumbnail.component.scss']
|
||||
})
|
||||
export class GeometryThumbnailComponent implements AfterViewInit {
|
||||
|
||||
export class GeometryThumbnailComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
@ViewChild('canvas') canvas;
|
||||
@ViewChild('container') container;
|
||||
@Input('feature') feature:Feature<Geometry>;
|
||||
|
||||
private geometry:Geometry = null;
|
||||
@Input() set feature(value:Feature<Geometry>) {
|
||||
if(value) {
|
||||
this.geometry = value.getGeometry();
|
||||
} else {
|
||||
this.geometry = null;
|
||||
ngOnInit(): void {
|
||||
}
|
||||
this.render(this.canvas,
|
||||
this.geometryStyle,
|
||||
this.geometry,
|
||||
this.width,
|
||||
this.height);
|
||||
};
|
||||
|
||||
private defaultStyle:style.Style = new style.Style({
|
||||
render(canvas,width,height,geometry:Geometry) {
|
||||
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
|
||||
|
||||
let strokeStyle = new style.Style({
|
||||
stroke: new style.Stroke({ color: 'black',width:1.5 })
|
||||
});
|
||||
private geometryStyle:style.Style = this.defaultStyle;
|
||||
@Input() set fillColor(value:string) {
|
||||
if(style) {
|
||||
this.geometryStyle = new style.Style({
|
||||
stroke: new style.Stroke({ color: 'black',width:1.5 }),
|
||||
fill: new style.Fill({color: value})
|
||||
});
|
||||
} else {
|
||||
this.geometryStyle = this.defaultStyle
|
||||
}
|
||||
this.render(this.canvas,
|
||||
this.geometryStyle,
|
||||
this.geometry,
|
||||
this.width,
|
||||
this.height);
|
||||
}
|
||||
|
||||
private width:number = 0;
|
||||
private height:number = 0;
|
||||
|
||||
render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {
|
||||
if(canvas && canvas.nativeElement && geometry && style) {
|
||||
let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
|
||||
|
||||
let geom = geometry.clone(),
|
||||
let geom = geometry.clone() as Polygon,
|
||||
line = geom.getCoordinates()[0],
|
||||
e = extent.boundingExtent( line );
|
||||
|
||||
@ -76,20 +45,16 @@ export class GeometryThumbnailComponent implements AfterViewInit {
|
||||
|
||||
geom.translate( -dx, -dy );
|
||||
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
||||
geom.translate(width / 2,height / 2 );
|
||||
renderContext.setStyle( style );
|
||||
geom.translate( width / 2, height / 2 );
|
||||
|
||||
renderContext.setStyle( strokeStyle );
|
||||
renderContext.drawGeometry( geom );
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.width = this.container.nativeElement.offsetWidth;
|
||||
this.height = this.container.nativeElement.offsetHeight;
|
||||
this.render(this.canvas,
|
||||
this.geometryStyle,
|
||||
this.geometry,
|
||||
this.width,
|
||||
this.height);
|
||||
this.render(this.canvas.nativeElement,
|
||||
this.container.nativeElement.offsetWidth,
|
||||
this.container.nativeElement.offsetHeight,
|
||||
this.feature.getGeometry());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user