当前位置:网站首页>Openlayers ol ext: Transform object, rotate, stretch, zoom in
Openlayers ol ext: Transform object, rotate, stretch, zoom in
2022-07-25 03:06:00 【Gary_ Leong】

OpenLayers quote ol-ext:Transform Can be right Feature Enlarge the drawing 、 narrow 、 Move 、 rotate 、 Stretching and other operations , Very easy to use .
Code :
transformFeature() {
var _this = this
if (this.transform !== null || this.transform !== '') {
this.map.removeInteraction(this.transform)
}
this.editMenuStyle.height = '0px'
const transform = new Transform({
enableRotatedTransform: false,
addCondition: shiftKeyOnly,
hitTolerance: 2,
// Translate when click on feature
translateFeature: false,
// Can translate the feature
translate: true,
stretch: true,
scale: true,
rotate: true
})
var firstPoint = false
var startangle = 0
var d = [0, 0]
transform.on(['select'], function(e) {
if (firstPoint && e.features && e.features.getLength()) {
transform.setCenter(e.features.getArray()[0].getGeometry().getFirstCoordinate())
}
})
transform.on(['rotatestart', 'translatestart'], function(e) {
// Rotation
startangle = e.feature.get('angle') || 0
// Translation
d = [0, 0]
})
transform.on('rotating', function(e) {
// Set angle attribute to be used on style !
e.feature.set('angle', startangle - e.angle)
})
transform.on('translating', function(e) {
d[0] += e.delta[0]
d[1] += e.delta[1]
if (firstPoint) {
transform.setCenter(e.features.getArray()[0].getGeometry().getFirstCoordinate())
}
})
transform.on('scaling', function(e) {
if (firstPoint) {
transform.setCenter(e.features.getArray()[0].getGeometry().getFirstCoordinate())
}
})
transform.on(['rotateend', 'translateend', 'scaleend'], function(e) {
_this.editFeatureCoord(e.feature)
})
this.transform = transform
this.map.addInteraction(this.transform)
},
边栏推荐
- # CF #808 Div.2(A - C)
- Using one stack to sort another stack
- 6.0 cancellation of member registration verification code
- Three ways to solve your performance management problems
- Flume's study notes
- Use reflection to convert RDD to dataframe
- JS written test question -- realize the flat function of array
- [stm32f130rct6] idea and code of ultrasonic ranging module
- MySQL configuration in CDH installation
- Dc-2-range practice
猜你喜欢

Dynamic programming -- Digital DP

JS foundation -- math

mysql_ Master slave synchronization_ Show slave status details

Learning record 12
![[Kali's sshd service is enabled]](/img/1b/180534d51049177254e30c4b783eba.png)
[Kali's sshd service is enabled]

JS written test questions -- random numbers, array de duplication

Win10 -- open the hosts file as an administrator

Publish the project online and don't want to open a port

C: wechat chat software instance (wpf+websocket+webapi+entityframework)

Riotboard development board series notes (4) -- using Vpu hardware decoding
随机推荐
mysql_ Case insensitive
Function of each layer of data warehouse
Tp5.1 initialize initialization method (not \u initialize)
Banana pie bpi-m5 toss record (2) -- compile u-boot
Hashcode details
Ctfshow misc introduction
Method of adding kernel in Jupiter notebook
New key points of ES6
Concurrent programming day01
[stm32f103rct6] can communication
Domain driven model (DDD)
Learning record XIII
What should I do when the interface encounters jsonstring
Use of stm32cubemonitor Part II - historical data storage and network access
Flink's study notes
Request and response
Wechat sports field reservation of the finished works of the applet graduation project (6) opening defense ppt
DOM node type
Daily three questions 7.19
mysql_ Master slave synchronization_ Show slave status details