|
@@ -1,6 +1,9 @@
|
|
|
import {Component} from '@angular/core';
|
|
import {Component} from '@angular/core';
|
|
|
|
|
|
|
|
-import {GeoJSON} from 'ol/format';
|
|
|
|
|
|
|
+import proj4 from 'proj4';
|
|
|
|
|
+import {get as getProjection, transform} from 'ol/proj';
|
|
|
|
|
+import {register} from 'ol/proj/proj4';
|
|
|
|
|
+import {View} from 'ol';
|
|
|
import {OSM, Vector as VectorSource} from 'ol/source';
|
|
import {OSM, Vector as VectorSource} from 'ol/source';
|
|
|
import {Tile, Vector as VectorLayer} from 'ol/layer';
|
|
import {Tile, Vector as VectorLayer} from 'ol/layer';
|
|
|
|
|
|
|
@@ -10,51 +13,34 @@ import {
|
|
|
HsToastService
|
|
HsToastService
|
|
|
} from 'hslayers-ng';
|
|
} from 'hslayers-ng';
|
|
|
|
|
|
|
|
|
|
+import {AppService} from './app.service';
|
|
|
|
|
+
|
|
|
|
|
+proj4.defs(
|
|
|
|
|
+ 'EPSG:3045',
|
|
|
|
|
+ '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
|
|
|
|
|
+);
|
|
|
|
|
+proj4.defs(
|
|
|
|
|
+ 'EPSG:5514',
|
|
|
|
|
+ '+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +towgs84=542.5,89.2,456.9,5.517,2.275,5.516,6.96 +units=m +no_defs'
|
|
|
|
|
+);
|
|
|
|
|
+register(proj4);
|
|
|
|
|
+
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'application-root',
|
|
selector: 'application-root',
|
|
|
templateUrl: './app.component.html',
|
|
templateUrl: './app.component.html',
|
|
|
styleUrls: ['./app.component.sass'],
|
|
styleUrls: ['./app.component.sass'],
|
|
|
})
|
|
})
|
|
|
-export class HslayersAppComponent {
|
|
|
|
|
|
|
+export class AppComponent {
|
|
|
|
|
+ sjtskProjection = getProjection('EPSG:5514');
|
|
|
/* You can name your app as you like or not at all */
|
|
/* You can name your app as you like or not at all */
|
|
|
title = 'hslayers-application';
|
|
title = 'hslayers-application';
|
|
|
constructor(
|
|
constructor(
|
|
|
|
|
+ private appService: AppService,
|
|
|
/* Inject here all modules from HSLayers-NG which you intend to use */
|
|
/* Inject here all modules from HSLayers-NG which you intend to use */
|
|
|
public hsConfig: HsConfig,
|
|
public hsConfig: HsConfig,
|
|
|
private hsEventBusService: HsEventBusService,
|
|
private hsEventBusService: HsEventBusService,
|
|
|
private hsToastService: HsToastService,
|
|
private hsToastService: HsToastService,
|
|
|
) {
|
|
) {
|
|
|
- /* Define a geometry of one square polygon */
|
|
|
|
|
- const geojsonObject = {
|
|
|
|
|
- 'type': 'FeatureCollection',
|
|
|
|
|
- 'crs': {
|
|
|
|
|
- 'type': 'name',
|
|
|
|
|
- 'properties': {
|
|
|
|
|
- 'name': 'EPSG:3857',
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- 'features': [
|
|
|
|
|
- {
|
|
|
|
|
- 'type': 'Feature',
|
|
|
|
|
- 'geometry': {
|
|
|
|
|
- 'type': 'Polygon',
|
|
|
|
|
- 'coordinates': [
|
|
|
|
|
- [
|
|
|
|
|
- [1e6, 6e6],
|
|
|
|
|
- [1e6, 8e6],
|
|
|
|
|
- [3e6, 8e6],
|
|
|
|
|
- [3e6, 6e6],
|
|
|
|
|
- [1e6, 6e6],
|
|
|
|
|
- ],
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- 'properties': {
|
|
|
|
|
- 'name': 'Poly 1',
|
|
|
|
|
- 'population': Math.floor(Math.random() * 100000),
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- };
|
|
|
|
|
/* Define the polygon's style using SLD */
|
|
/* Define the polygon's style using SLD */
|
|
|
const polygonSld = `<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
const polygonSld = `<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
<StyledLayerDescriptor version="1.0.0"
|
|
<StyledLayerDescriptor version="1.0.0"
|
|
@@ -98,14 +84,22 @@ export class HslayersAppComponent {
|
|
|
type: 'micka',
|
|
type: 'micka',
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
|
|
+ default_view: new View({
|
|
|
|
|
+ projection: this.sjtskProjection,
|
|
|
|
|
+ center: transform([16.944, 49.228], 'EPSG:4326', 'EPSG:5514'),
|
|
|
|
|
+ zoom: 14,
|
|
|
|
|
+ }),
|
|
|
/* Use hslayers-server if you need to proxify your requests to other services. See https://www.npmjs.com/package/hslayers-server */
|
|
/* Use hslayers-server if you need to proxify your requests to other services. See https://www.npmjs.com/package/hslayers-server */
|
|
|
- /* proxyPrefix: window.location.hostname.includes('localhost')
|
|
|
|
|
|
|
+ proxyPrefix: window.location.hostname.includes('localhost')
|
|
|
? `${window.location.protocol}//${window.location.hostname}:8085/`
|
|
? `${window.location.protocol}//${window.location.hostname}:8085/`
|
|
|
: '/proxy/',
|
|
: '/proxy/',
|
|
|
- */
|
|
|
|
|
- useProxy: false,
|
|
|
|
|
|
|
+ //useProxy: false,
|
|
|
panelsEnabled: {
|
|
panelsEnabled: {
|
|
|
- tripPlanner: true,
|
|
|
|
|
|
|
+ composition_browser: false,
|
|
|
|
|
+ info: false,
|
|
|
|
|
+ saveMap: false,
|
|
|
|
|
+ legend: false,
|
|
|
|
|
+ tripPlanner: false,
|
|
|
},
|
|
},
|
|
|
componentsEnabled: {
|
|
componentsEnabled: {
|
|
|
basemapGallery: true,
|
|
basemapGallery: true,
|
|
@@ -118,7 +112,7 @@ export class HslayersAppComponent {
|
|
|
{name: 'mountain', url: '/assets/icons/mountain42.svg'},
|
|
{name: 'mountain', url: '/assets/icons/mountain42.svg'},
|
|
|
{name: 'warning', url: '/assets/icons/warning.svg'},
|
|
{name: 'warning', url: '/assets/icons/warning.svg'},
|
|
|
],
|
|
],
|
|
|
- popUpDisplay: 'hover',
|
|
|
|
|
|
|
+ popUpDisplay: 'none',
|
|
|
default_layers: [
|
|
default_layers: [
|
|
|
/* One baselayer */
|
|
/* One baselayer */
|
|
|
new Tile({
|
|
new Tile({
|
|
@@ -133,26 +127,21 @@ export class HslayersAppComponent {
|
|
|
/* One thematic layer */
|
|
/* One thematic layer */
|
|
|
new VectorLayer({
|
|
new VectorLayer({
|
|
|
properties: {
|
|
properties: {
|
|
|
- title: 'Polygon vector layer',
|
|
|
|
|
|
|
+ title: 'Farma',
|
|
|
synchronize: false,
|
|
synchronize: false,
|
|
|
cluster: false,
|
|
cluster: false,
|
|
|
inlineLegend: true,
|
|
inlineLegend: true,
|
|
|
- popUp: {
|
|
|
|
|
- attributes: ['population'],
|
|
|
|
|
- },
|
|
|
|
|
editor: {
|
|
editor: {
|
|
|
editable: true,
|
|
editable: true,
|
|
|
defaultAttributes: {
|
|
defaultAttributes: {
|
|
|
- name: 'New polygon',
|
|
|
|
|
|
|
+ name: 'Moje farma',
|
|
|
description: 'none',
|
|
description: 'none',
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
sld: polygonSld,
|
|
sld: polygonSld,
|
|
|
- path: 'User generated',
|
|
|
|
|
|
|
+ //path: 'User generated',
|
|
|
},
|
|
},
|
|
|
- source: new VectorSource({
|
|
|
|
|
- features: new GeoJSON().readFeatures(geojsonObject),
|
|
|
|
|
- }),
|
|
|
|
|
|
|
+ source: new VectorSource(),
|
|
|
}),
|
|
}),
|
|
|
],
|
|
],
|
|
|
});
|
|
});
|