Skip to content

Commit

Permalink
startline icon
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed Jan 13, 2024
1 parent f57f909 commit cd082ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/app/modules/map/mapconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export const routeStyles = {
}),
startBoat: new Style({
image: new Icon({
src: './assets/img/startflag.png',
src: './assets/img/startboat.png',
rotateWithView: false,
scale: 0.5,
anchor: [22.5, 45],
scale: 0.15,
anchor: [24, 160],
anchorXUnits: 'pixels',
anchorYUnits: 'pixels'
}),
Expand Down
13 changes: 8 additions & 5 deletions src/app/modules/map/ol/lib/resources/layer-routes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';
import { Style, Stroke, Text, Fill, Circle } from 'ol/style';
import { LineString, Point } from 'ol/geom';
import { fromLonLat } from 'ol/proj';
import { MapComponent } from '../map.component';
import { Extent } from '../models';
import { fromLonLatArray, mapifyCoords } from '../util';
Expand Down Expand Up @@ -184,26 +185,28 @@ export class RouteLayerComponent implements OnInit, OnDestroy, OnChanges {
const sfla: Feature[] = [];

// start line
if (rte.feature.properties.startLine) {
const sla = fromLonLatArray(rte.feature.properties.startLine);
if (rte.feature.properties.startLine && rte.feature.properties.startLine.pin
&& rte.feature.properties.startLine.boat) {
const slp = fromLonLat(rte.feature.properties.startLine.pin);
const slb = fromLonLat(rte.feature.properties.startLine.boat);

const sl = new Feature({
geometry: new LineString(sla)
geometry: new LineString([slp,slb])
});
sl.setId('startline');
sl.setStyle(this.buildStartFinishLineStyle('startLine'));
sfla.push(sl);

const sp = new Feature({
geometry: new Point(sla[0]),
geometry: new Point(slp),
name: 'Start Pin'
});
sp.setId('startline.pin');
sp.setStyle(this.buildStartFinishLineStyle('startPin'));
sfla.push(sp);

const sb = new Feature({
geometry: new Point(sla[1]),
geometry: new Point(slb),
name: 'Start Boat'
});
sb.setId('startline.boat');
Expand Down
Binary file added src/assets/img/startboat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd082ba

Please sign in to comment.