开发者

Drawing a polygon in pygame [duplicate]

开发者 https://www.devze.com 2023-01-04 13:13 出处:网络
This question already has an answer here: Drawing polygons in pygame using list (1 answer) Closed 4 days ago.
This question already has an answer here: Drawing polygons in pygame using list (1 answer) Closed 4 days ago.

i am jaison i like to build an application for land survey process. for that i need to plot points in a canvas for a given gsi file. for example

the points be

       a.             .b


          c.         .d          .e

these are the 5 points and i need to develop a tool to connect these points by line. while closing a boundry by like connecting points acdba. give it a parcel_id and other details like land owner, tax payment etc. save these details for feature query.

in real time the points will be more than 100000. and i need the canvas should have pan and zoom property.

friends i like to do this project in python using pygame. is it possible to do. i am a newbie to 开发者_C百科python.

please need help.


Pygame is absolutely a good tool for this.

Look into using a pygame.surface object, and the pygame.draw module.

http://www.pygame.org/docs/ref/

If you need anything more complicated than dots, pygame.sprite is a relatively well developed module as well.


http://www.pygame.org/docs/ref/draw.html#pygame.draw.polygon

This is the function for drawing polygons in pygame. You can draw straight to screen or to a separate surface. I am not sure how fast it is with lots of points, you might want to split up what your drawing into smaller segments and just display what you need.

If you do need to show the whole polygon I would look into some way of compressing the amount of points to only get the general shape

0

精彩评论

暂无评论...
验证码 换一张
取 消