### Circle Drawing Weland Plugin

Posted:

**Jun 3rd '13, 18:17**I've written a plugin for Weland which will draw circles to your specifications. You specify the center, radius and number of lines (either directly, or by specifying the length of each arc segment or the angle of each arc), et voilĂ , you get a circle of points with all the lines connecting them. It should interact with existing lines as you'd expect, but there may be some cases I didn't think of, and at least one case (one of the circle points falls at the intersection of two lines that aren't already connected) where the correct behavior is not at all obvious.

At the moment, that's all it does, but I might add to it in the near future if there's interest. Some possible added features would be filling the interior of the circle, drawing multiple concentric circles and optionally connecting their corresponding points (creating a ring), and drawing other shapes.

Comments, questions, suggestions, and bugs reports welcome.

[EDIT]Something

[EDIT-2] Updated to specify start and end angle. Arcs > 360 degrees possible.

[EDIT-3]

[EDIT 4] Updated attachment to v1.1. Selecting a point before running plugin will preset parameters with that point as the center of the circle. Selecting a line before running plugin will preset parameters to use that line as diameter.

At the moment, that's all it does, but I might add to it in the near future if there's interest. Some possible added features would be filling the interior of the circle, drawing multiple concentric circles and optionally connecting their corresponding points (creating a ring), and drawing other shapes.

Comments, questions, suggestions, and bugs reports welcome.

[EDIT]Something

**important**I forgot to mention. There's an odd bug that causes the circle not to appear right away. It's there, but the window isn't redrawn for some reason. Clicking with the select tool or zooming or just about anything else will get the window to redraw and the circle will appear.[EDIT-2] Updated to specify start and end angle. Arcs > 360 degrees possible.

[EDIT-3]

**Installation notes**: There are three files included in the zip file. Put CirclePlugin.dll in the Weland Plugins directory*before*launching Weland. CirclePlugin.cs and CirclePlugin.glade are the source code files, included for anyone interested in writing their own plugins. Note this was the first code I've written in C# (and, by extension, for Mono), so it may not be the best example of how to do it. Notably, it uses GladeXML, which was deprecated by the GNOME group years ago, but Mono still doesn't have documentation for Gtk.Builder.**Usage notes**: The center and radius parameters are specified in AlephOne's internal units of 1/1024 of a World Unit. Angles are specified in degrees as real numbers (decimals allowed). The last parameter specifies how many lines are used to draw the circle. Use the popup menu to select how you want to specify this. '# Arcs' directly specifies the number of lines, 'Arc Length' specifies the length of each line and computes the number based on that, and 'Arc Angle' specifies the angle subtended by each arc. Using 'Arc Angle' is really no different than '# Arcs' (number of lines = (EndAngle - StartAngle) / ArcAngle), but maybe some folks would rather use that. It's also a little helpful if you want to draw more than 360 degrees for making sure that end points don't fall on top of each other. In that case, just make sure that your arc angle does not divide evenly into 360.[EDIT 4] Updated attachment to v1.1. Selecting a point before running plugin will preset parameters with that point as the center of the circle. Selecting a line before running plugin will preset parameters to use that line as diameter.