Dimension line annotation tool
Open, Needs TriagePublic

Description

The straight line annotation tool supports both end of lines (arrow, diamond, etc.) and leader lines. These are conflicting with each others in some cases.

Possible combinations:

  • LL+Square: Partially overlapping. No idea what this is good for.
  • LL+Circle: No visual conflict. No idea what this is good for.
  • LL+Diamond: No visual conflict. No idea what this is good for.
  • LL+OpenArrow: Best for dimensioning of longer distances.
  • LL+ClosedArrow: Similar to OpenArrow.
  • LL+None: No conflict.
  • LL+Butt: Complete conflict.
  • LL+ROpenArrow: Best for dimensioning of shorter distances. But we must arrows "outside" leader for this use case (currently bug?).
  • LL+RClosedArrow: Similar to ROpenArrow.
  • LL+Slash: Used but the slash should be centered on the leader line, and not shorten the line (see image 2)

We should find a way to expose only meaningful combinations to the user. A possibility is to create a new tool e.g. "DImensioning line" (based on straigth line) where only the meaningful line terminations are exposed, and remove the leader liine options from the straight line tool.

Moreover for dimensioning purpose a distance is usually written on top of the line. This is now possible thanks to D21490, but an interface to expose this feature to the user is required.

Consider that the annotation toolbar is currently been rewritten (D15580) so we can think on how to expose these features according to the new interface.


Image 1


Image 2

See BUG: 407463

TODO:

  • Expose line caption to the user
  • Expose only meaningful combinations of line endings and leader lines to the user

If there is a dedicated tool for dimensions, straight line annotations recognized as dimension should be movable by dragging the label. FreeCAD illustrates this, although a bit unintuitive: ;)


Moving sideways is probably not possible, but moving up and down would change the lenght of the leader lines.

Who will write the value of the dimension? Some users asked about a measuring tool.
If Okular calculates the value, some kind of snapping might be useful.

Limiting to certain angles would also be useful, this was also asked for the straight line tool.

tobiasdeiminger added a comment.EditedJun 2 2019, 12:11 PM

Moving sideways is probably not possible, but moving up and down would change the lenght of the leader lines.

Yes, it is possible from a PDF reference point of view (see PDF 1.7, chapter 12.5.6.7). The CO attribute ("Caption Offset") can be given, which defines a horizontal and a vertical offset from captions normal position.

Poppler core implements getters

double AnnotLine::getCaptionTextHorizontal() const;
double AnnotLine::getCaptionTextVertical() const;

but I see no setters.

It is also not yet exposed in Poppler Qt5 frontend. So, implementing the setters, exposing it in in Qt5 frontend and then in Okular::LineAnnotation would be one of the sub tasks here.

Then it’s time I want to ask this:

Why do we need dimension annotations? Just because it’s almost implemented with Straight Line as defined in PDF? Okular is not a CAD tool, and PDF documents usually do not have all the information needed for dimensioning.

In my opinion we should not aim at something extremely complicated and fully featured as the CAD one (no one actually requested this feature as far as I know). I was more thinking at reducing the clutter in the straight line annotation tool, by creating a sort of clone of it dedicated to this 'dimension line'. So expose the possiblity to add text and avoid the conflicting line ending / leader line.

tobiasdeiminger added a comment.EditedJun 2 2019, 12:21 PM

Then it’s time I want to ask this:

Why do we need dimension annotations? Just because it’s almost implemented with Straight Line as defined in PDF? Okular is not a CAD tool, and PDF documents usually do not have all the information needed for dimensioning.

Well, LineDimension is mentioned explicitly in the PDF reference as Line Annotation "intent".

IT - (Optional; PDF 1.6) 

A name describing the intent of the line annotation
(see also Table 170). Valid values shall be LineArrow, which means that
the annotation is intended to function as an arrow, and LineDimension,
which means that the annotation is intended to function as a dimension
line.

Just like typewriteris an explicitly mentioned intent for the Free Text Annotation (inline note, in okular speak).

So it makes us somewhat more feature complete from PDF point of view. I don't claim that we really need it, that should be answered by others.

I think it would be nice, personally. A richer set of annotations can't be a bad thing IMO.

I was more thinking at reducing the clutter in the straight line annotation tool, by creating a sort of clone of it dedicated to this 'dimension line'.

I think it would be nice, personally. A richer set of annotations can't be a bad thing IMO.

And the building blocks in the backend are mostly there, so it's relatively cheap to add it. Occasionally I had some use for it from time to time, so I'd also vote for doing a specific and simple dimension line tool.

Some other arbitrary questions that come to my mind:

Do we want to set a dash pattern for straight lines? {Poppler,Okular}::Annotation are readily prepared. LineAnnotPainter needs to learn how to draw dash patterns for non-PDF documents.

Do we want polylines? Do we want an extra tool for it? It's like straight line, just more than 2 points and somewhat fewer PDF options (e.g., arrows yes, leaders line yes, but no leader extension, and no caption). PolyLineEngine, {Poppler,Okular}::LineAnnotation are ready. LineAnnotPainter needs minor adaption.

Do we want captions on ordinary straight lines (i.e., not only for dimensioning)? {Poppler,Okular}::LineAnnotation are readily prepared. LineAnnotPainter is in progress, but mostly there.

If yes, do we want exact positioning by means of inner/top setting, and a horizontal / vertical offset? Needs extra work in Okular and Poppler backend.

Sorry, just realized my above comments are somewhat off-topic as long as the title of T11014 is Dimension line annotation tool. Can we broaden it to cover line annotations as a whole? Or shall we open additional tasks?