Īn data de Vin 30 Sep 2011 23:11:31 Martin Owens a scris:
> On Fri, 2011-09-30 at 12:01 -0700, Josh Andler wrote:
> > Did you happen to
> > notice a bunch of commented out code when browsing through the
> > connector stuff? If it was deleted, it's still somewhere in the
> > revision history at least to see which might be better.
> I noticed lots of code that wasn't commented out, but which seemed to
> have no reason. possibly not switched on. In any case the file should
> probably be stripped of the old code once we've got general consensus on
> the approach.
As in the reply to Josh's mail, you would have to uncomment the lines in toolbox.cpp (check the diffs from the link Josh (~suv, thank you) provided) to get the basic (unpolished) functionality.
Martin, thank you for all your work. It was me who initially coded the connection points code. It left in a rather unpolished state, although the core functionality was coded. I got really busy with my phd work (which I am soon to finish and would really much like to come back to properly fix connection points and connectors).
I watched the demo you made, it is really impressive and really close to what was intended. Still, I don't follow the reason of introducing the ConnPointChild type, but I guess it is my fault as the code is not that much verbose.
The main idea was to have two types of connection points: some default connection points (as currently only the center is) and user defined connection points. There would be 9 default connection points: the center (the only one available now) and other 8 connection points that you get when you draw 8 imaginary lines that connect the center to the corners of the object's bounding box and the midpoints of the edges of the object's bounding box and intersect these imaginary lines with the object's edge.
In the case of a rectangle (as in your video) the four connection points located at the middle of the rectangle's edges would be just default connection points (so the would be no need for ConnPointChild type?). The code that needs to be written to make this happen would be located in:
src/conn-avoid-ref.cpp, in Geom::Point SPAvoidRef::getConnectionPointPos(const int type, const int id),
where there should be a big switch for the default connection point type in which one would compute the intersections I mentioned above.
Then, in src/connector-context.cpp, in static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item),
cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, centre);
(line 1707 in your branch)
one should have to add the knots for the rest of the default connection points.
Sorry for being scarce with explanations, I hope some points about the code got cleared up.
Thank you again for the great work!
> Considering the code and the use of stencils, I propose using groups as
> specified. Feedback and critique is needed.
> Additionally we should have a curved connector option, and some preset
> styles for markers and lines. And some better code to control the jagged
> --- All of the data generated in your IT infrastructure is seriously
> valuable. Why? It contains a definitive record of application performance,
> security threats, fraudulent activity, and more. Splunk takes this data
> and makes sense of it. IT sense. And common sense.
> Inkscape-devel mailing list