GNOME Bugzilla – Bug 300799
Shapes need midpoints
Last modified: 2013-09-13 19:55:43 UTC
After the introduction of midpoints in Dia, a lot of shapes need updating. Specifically, each shape needs a new connectionpoint defined in the center of the object with the midpoint attribute on. See for example the Square shape of the Assorted sheet. This bug should be a clearinghouse for what shapes gets fixed by whom.
I meant "main" attribute, as can be seen from the Square shape.
hello, just for a 1st approach a wrote this Python code. It need to hard-code the path to the shapes, and I only tested it against Assorted. It only reveals (and not fixes) a problem with 2 shapes from Assorted (comments behind the root-element). Tomorrow I'll test the other libs. Hi Paolo Bernardi
Created attachment 45422 [details] need python 2.3 - modifies the XML of shapes inserting the midpoint
> It only reveals (and not fixes) a problem with 2 shapes from Assorted > (comments behind the root-element). I'm 99% sure that is perfectly legal and valid SVG (I had to check the specifciations when making Gradients for Openclipart.org and putting comments at the end of the document outside the root node allowed me to workarounds some flaws in a particular SVG parser). You will need to provide a really good reason to change it. Which two shapes was it?
Drat, I wish I'd seen this before doing my own script. I made a little Perl script to do your method B, which I think works for a greater number of strange shapes. We'll need to check the shapes anyway. The shapes below had zero or one connection points, and so I didn't add any main point to them. Probably the middle of the object would do, but they're few enough to do manually. Only one connection in shapes/ChemEng/fan.shape Only one connection in shapes/Circuit/ground.shape Only one connection in shapes/Circuit/microphone_de.shape Only one connection in shapes/Civil/bvrest.shape Only one connection in shapes/Civil/hrest.shape Only one connection in shapes/Civil/vrest.shape Only one connection in shapes/Cybernetics/b-sens.shape Only one connection in shapes/Cybernetics/l-sens.shape Only one connection in shapes/Cybernetics/r-sens.shape Only one connection in shapes/Cybernetics/t-sens.shape Only one connection in shapes/network/flash.shape Only one connection in shapes/network/modem.shape Only one connection in shapes/network/rj45plug.shape Only one connection in shapes/network/sceadplug.shape Only one connection in shapes/Pneumatic/cnx.shape No connections in shapes/Pneumatic/commusc.shape No connections in shapes/Pneumatic/compb.shape No connections in shapes/Pneumatic/compush.shape No connections in shapes/Pneumatic/comspr.shape Only one connection in shapes/Pneumatic/drain.shape Only one connection in shapes/Pneumatic/presspn.shape Only one connection in shapes/RDP/transition.shape Only one connection in shapes/SDL/comment.shape Only one connection in shapes/SDL/return.shape Only one connection in shapes/SDL/stop.shape Only one connection in shapes/sybase/rsm.shape
We now need to check that all objects are properly midpointed. Below is a list of directories with shapes, then we can start working off of them. Please add a comment if you start on a chunk. The autogenerated shapes are in tonights CVS. shapes/Assorted shapes/ChemEng shapes/Circuit shapes/Cisco shapes/Civil shapes/Contact shapes/Cybernetics shapes/Electric shapes/flowchart shapes/jigsaw shapes/Logic shapes/Map/Isometric shapes/Misc shapes/MSE shapes/network shapes/Pneumatic shapes/RDP shapes/SDL shapes/sybase
Doing Assorted, ChemEng
Done with Assorted, ChemEng, Circuit, Cisco - Computer, Cisco - Hub. I'm finding the easiest way is to use layers to group the shapes -- I group into those that need manual handling, those that should just use the middle of the bounding box, those that have no interior, and those that have no or one connection points (and thus no midpoint yet). The names can then be extracted from dia files with only some layers saved with -e. Two of those groups can be fixed with Paolo's code.
This one is related to: #329603
So far I see no need for a logic gate to have a connection point in the center. I have noticed, to my chagrin, that when drawing a rectangle shape and adding text, there is this point in the center that snaps any text to it if it gets anywhere inside the rectangle (and the text starts in the center and flows toward the edge, looking terrible). really annoying misfeature of dia. Snap is off. something is misfunctioning. thinking of making this a separate bug unless this is really the place.
Elaborating about misfeatures with snap to object being off is definitely another bug report. At least if it is not just a misunderstanding about the available properties for text alignment.
I consider the quest for main points closed (697 shapes have it). Plus they are checked for bad misplacements with unit test. See: https://git.gnome.org/browse/dia/commit/?id=97add178fedc641344cb813edb682c45c8c4817f