如何以编程方式移动OpenLayers Vector? [英] How to move OpenLayers Vector programmatically?

查看:231
本文介绍了如何以编程方式移动OpenLayers Vector?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenLayers.Feature.Vector 说Vector本身没有任何方法。

The API documentation for OpenLayers.Feature.Vector says that Vector itself has no methods at all.

我知道如何让用户通过添加 OpenLayers.Control.DragFeature 控件来映射。因此,如果用户可以移动Vector,那么必须以编程方式移动它。但我无法弄明白该怎么做。

I know how to let user move the Vector by adding OpenLayers.Control.DragFeature control to map. So if the user can move the Vector then there has to ba a way to move it programmatically too. But I can't figure out how to do it.

推荐答案

你移动 OpenLayers.Feature.Vector 对象通过调用几何对象,而不是向量本身。这些方法包括移动,旋转,调整大小和变换。

You move an OpenLayers.Feature.Vector object by calling methods on its geometry object, not the vector itself. These methods include move, rotate, resize, and transform.

请注意,您将找不到OpenLayers.Geometry基础对象上定义的任何方法,但仅在相应的子对象上找到(请注意,其中有多个级别的继承) OpenLayers几何)。 OpenLayers.Geometry.Collection 就是一个很好的例子。

Note that you will not find any of the methods defined on the OpenLayers.Geometry base object but only on the appropriate child object (note that there are multiple level of inheritance within OpenLayers geometries). OpenLayers.Geometry.Collection is a good example.

您可以找到以编程方式移动OpenLayers向量的一个很好的示例这里

You can find a great example of programmatically moving OpenLayers vectors here.

这篇关于如何以编程方式移动OpenLayers Vector?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆