Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiPolygon.copy.addToLayer时会丢失MultiPolygon里的Circle #725

Closed
cXiaof opened this issue Jul 23, 2018 · 4 comments
Closed

MultiPolygon.copy.addToLayer时会丢失MultiPolygon里的Circle #725

cXiaof opened this issue Jul 23, 2018 · 4 comments
Labels

Comments

@cXiaof
Copy link

cXiaof commented Jul 23, 2018

MultiPolygon.copy()
得到的结果是正确的,_geometries对象是完整的,
但是addTo layer后,只能显示出多边形而显示不出圆或椭圆

重现代码可参考这个

var layer = new maptalks.VectorLayer('vector').addTo(map);

var circle = new maptalks.Circle(map.getCenter(), 1000);

var polygon = new maptalks.Polygon(
[[[-0.131049, 51.503568], [-0.107049, 51.503568], [-0.107049, 51.501568], [-0.131049, 51.501568]]]);

var multiPolygon = new maptalks.MultiPolygon([polygon, circle]);

var multiPolygonCopy = multiPolygon.copy().addTo(layer);

console.log(multiPolygonCopy)

// setTimeout(function() { circle.addTo(layer) }, 2000)
@fuzhenn fuzhenn added the bug label Jul 23, 2018
@fuzhenn
Copy link
Member

fuzhenn commented Sep 2, 2018

这个不算是bug,circle添加到multipolygon里时,确实会被转化为多边形

@fuzhenn fuzhenn closed this as completed Sep 2, 2018
@cXiaof
Copy link
Author

cXiaof commented Sep 2, 2018

不是我取不到circle了,问题是看不到这个圆,圆没有被渲染出来
转不转成多边形也不应该不渲染到地图上

@cXiaof
Copy link
Author

cXiaof commented Sep 2, 2018

// 地图上能正常渲染MultiPolygon,有polygon, circle两个图形
new maptalks.MultiPolygon([polygon, circle]).addTo(layer);

// 地图上只渲染了polygon, 不渲染circle
new maptalks.MultiPolygon([polygon, circle]).copy().addTo(layer);

@fuzhenn fuzhenn reopened this Sep 2, 2018
@fuzhenn
Copy link
Member

fuzhenn commented Sep 2, 2018

收到!
以后最好能提供一个可运行的jsfiddle(或类似)重现bug,这样不会产生误解,而且也能方便我定位和修改bug

@fuzhenn fuzhenn closed this as completed in fa9b7d4 Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants