On 8/31/06, Redefined Horizons <redefined.horizons@...400...> wrote:
Where can I find the classes used to represent Inkscape's geometries?
I'm not entirely sure what you mean by "geometries". Inkscape has different kinds of objects, and their code is mostly in sp-*.cpp, for example sp-rect, sp-path etc. Of course these files use many other parts of the code. The purely geometric code is mostly in libnr/ and in livarot/.
I've dowloaded the source code for Inkscape 0.44, but I couldn't find a "geometry" folder in the "src" folder of the distribution. I imagine there would be a class file for rectangles, circles, elipses, lines, polylines and polygons. (Unless rectangles are represented as polylines and elipses as modified circles...)
Yes, all shapes except rectangles are represented as paths in Inkscape. But they nevertheless are separate classes each with its own behavior and controls.
Tools that allow the user to create the basic Inkscape geometries using precise coordinate entry. (For example, the user could enter coordinates into a dialog box for the two endpoints of a line and then create that line, or they might enter the coordinate for the start point of the line, and then an angle and distance that would be used to compute the endpoint of the line.)
Excellent idea, and the natural place for these precise controls is on each tool's controls bar. For example, for rectangles, we already have numeric boxes for width, height, and rounding radii; you can add another couple of boxes for x/y origin. For the Pen tool, we currently have no controls at all, but you can add them for setting precise coordinates of the next point.
Or the user might use other tools to select the precise coodinates of existing geometries as the input for such a tool, instead of entering the coordinates directly.
For that we already have the Paste size family of commands. You can propose other commands along the same lines.
(For example, selecting the coordinate at the midpoint of a line and the node of a polygon, and drawing the line with these exact coordinates as the two endpoints.)
This is much easier achieved by snapping, and is already mostly possible. Open Document properties, Snap tab, and turn on "snap nodes to objects" and "snap to object nodes" below it. After that the Pen tool and Node tool will snap nodes e.g. to the corners of a rectangle (though not to its center yet, but this is easy to add).
These tools will also allow the user to precisely modify existing geometries. (For example, move a polygon by precisely selecting two coorinates on existing geometries to compute the change in X and change in Y for the translation.)
Again, this is a matter of making the controls in the bar smart enough, so that others change their values accordingly when you change the value of one of them. Perhaps you'll need some locks and option buttons as well to modify this behavior.
So, to summarize, from your use cases I don't see a need for any new tools or concepts. Everything is achievable with what we already have or with a logical extension of it.
[1] Design and implement what I call "coordinate selectors". These are tools that allow very precise selection of points on the canvas. Typically these points will be selected from existing geometries.I would like to implement the following coordinate selectors for Inkscape:
I'm not sure what you mean by "coordinate selector". Can you describe step-by-step how it would work? Is this a new tool? Where would it put the selected coordinates? etc.