Mercurial > gemma
comparison client/src/map/Maplayer.vue @ 734:1581ba78a360
client: prepare for fairway intersection for profile
* Add calculation of features which intersect the extend of the profileLine
as preparation for the more expensive detailed intersect operation.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 24 Sep 2018 09:56:51 +0200 |
parents | e57955c1996f |
children | d7530644dde3 |
comparison
equal
deleted
inserted
replaced
733:e57955c1996f | 734:1581ba78a360 |
---|---|
87 if (inputLineString.getType() == GeometryType.LINE_STRING) { | 87 if (inputLineString.getType() == GeometryType.LINE_STRING) { |
88 // prepare to send the first line seqment to the server as GeoJSON | 88 // prepare to send the first line seqment to the server as GeoJSON |
89 inputLineString.transform("EPSG:3857", "EPSG:4326"); | 89 inputLineString.transform("EPSG:3857", "EPSG:4326"); |
90 var coords = inputLineString.getCoordinates(); | 90 var coords = inputLineString.getCoordinates(); |
91 if (coords.length >= 2) { | 91 if (coords.length >= 2) { |
92 var profileLine = new LineString([coords[0], coords[1]]); | |
92 var feature = new Feature({ | 93 var feature = new Feature({ |
93 geometry: new LineString([coords[0], coords[1]]), | 94 geometry: profileLine, |
94 // FIXME: hardcoded bottleneck and survey date | 95 // FIXME: hardcoded bottleneck and survey date |
95 bottleneck: "AT_Bottleneck_44", | 96 bottleneck: "AT_Bottleneck_44", |
96 date: "2017-11-20" | 97 date: "2017-11-20" |
97 }); | 98 }); |
98 var gStr = new GeoJSON({ geometryName: "geometry" }).writeFeature( | 99 var gStr = new GeoJSON({ geometryName: "geometry" }).writeFeature( |
103 // FIXME: assuming that we have the fairway dimensions loaded | 104 // FIXME: assuming that we have the fairway dimensions loaded |
104 var vectorSource = this.getLayerByName( | 105 var vectorSource = this.getLayerByName( |
105 "Fairway Dimensions" | 106 "Fairway Dimensions" |
106 ).data.getSource(); | 107 ).data.getSource(); |
107 console.log(vectorSource); | 108 console.log(vectorSource); |
108 // vectorSource.forEachFeatureIntersectingExtent() | 109 |
110 var diagStack = []; | |
111 vectorSource.forEachFeatureIntersectingExtent( | |
112 // need to use EPSG:3857 which is the proj of vectorSource | |
113 profileLine | |
114 .clone() | |
115 .transform("EPSG:4326", "EPSG:3857") | |
116 .getExtent(), | |
117 feature => { | |
118 // transform back to prepare for usage | |
119 var g = feature | |
120 .getGeometry() | |
121 .clone() | |
122 .transform("EPSG:3857", "EPSG:4326"); | |
123 // console.log("intersecting:", g); | |
124 this.addToFairwayRectangle(profileLine, g, diagStack); | |
125 } | |
126 ); | |
109 } | 127 } |
110 } | 128 } |
129 }, | |
130 addToFairwayRectangle(profileLine, fairwayGeometry, diagStack) { | |
131 // both geometries have to be in EPSG:4326 | |
132 console.log( | |
133 "addToFairwayRectangle(", | |
134 profileLine, | |
135 fairwayGeometry, | |
136 diagStack, | |
137 ")" | |
138 ); | |
111 }, | 139 }, |
112 activateInteraction() { | 140 activateInteraction() { |
113 const interaction = this.createInteraction(this.drawMode); | 141 const interaction = this.createInteraction(this.drawMode); |
114 this.interaction = interaction; | 142 this.interaction = interaction; |
115 this.openLayersMap.addInteraction(interaction); | 143 this.openLayersMap.addInteraction(interaction); |