Bug 100596 - Would like to be able to create and edit block arcs numerically.
Summary: Would like to be able to create and edit block arcs numerically.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
5.0.6.2 rc
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: VectorGraphic
  Show dependency treegraph
 
Reported: 2016-06-25 01:33 UTC by Bill
Modified: 2021-09-14 05:52 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
shows preliminary idea for solution GUI for creting/editing block arcs. (1.11 MB, image/jpeg)
2016-06-26 22:22 UTC, Bill
Details
Basic macro for setting arc and radius numerically (23.07 KB, application/vnd.oasis.opendocument.graphics)
2016-07-05 15:32 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bill 2016-06-25 01:33:52 UTC
I find that creating and modifying a block arc is quite difficult.  I actually could not with reasonable effort get what I wanted.  I had to settle for small triangles over big triangles, and I had to make circles and diameters, and work off intersections to get something close to what I really wanted.  Even for that, I had to review geometry and trigonometry lessons and use a hand calculator.  The results has overlaps, gaps, and other imperfect matches.

My request is to provide GUIs for creating and editing block arcs.  User inputs would be:
* the coordinates of the center of the block arc;
* the inner radius of the block arc;
* the outer radius of the block arc;
* the orientation (an angle) of one edge of the block arc; and
* the angle through which the block arc extends.
A resolution of 600 dots per inch is common in today's printers; the best have even finer resolution.  So the GUI inputs should retain at least 4 decimal places.
Comment 1 V Stuart Foote 2016-06-25 13:58:00 UTC
Difficult to conceptualize, what you are looking for. Please provide some screen clips of what you'd like to create and annotate.

Yes I know you can't do it in Draw, so please work it up Inkscape or DIA (or Illustrator, or Corel Draw, etc.) and post as PNG.
Comment 2 Heiko Tietze 2016-06-26 09:05:34 UTC
Precision is discussed in bug 44267. But better access to all properties of block arc, and perhaps other basic shapes as well, is needed. When I draw a block arc and look into the document there is a good number of properties not shown to the user.

<draw:custom-shape draw:name="MyArc" draw:style-name="gr1" draw:text-style-name="P1" draw:layer="layout" svg:width="5.1cm" svg:height="5.5cm" svg:x="3.8cm" svg:y="13.2cm"><text:p/><draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:type="block-arc" draw:modifiers="180 5400" draw:enhanced-path="B 0 0 21600 21600 ?f4 ?f3 ?f2 ?f3 W ?f5 ?f5 ?f6 ?f6 ?f2 ?f3 ?f4 ?f3 Z N"><draw:equation draw:name="f0" draw:formula="10800*cos($0 *(pi/180))"/><draw:equation draw:name="f1" draw:formula="10800*sin($0 *(pi/180))"/><draw:equation draw:name="f2" draw:formula="?f0 +10800"/><draw:equation draw:name="f3" draw:formula="?f1 +10800"/><draw:equation draw:name="f4" draw:formula="21600-?
f2 "/><draw:equation draw:name="f5" draw:formula="10800-$1 "/><draw:equation draw:name="f6" draw:formula="10800+$1 "/><draw:equation draw:name="f7" draw:formula="?f5 *cos($0 *(pi/180))"/><draw:equation draw:name="f8" draw:formula="?f5 *sin($0 *(pi/180))"/><draw:handle draw:handle-position="$1 $0" draw:handle-polar="10800 10800" draw:handle-radius-range-minimum="0" draw:handle-radius-range-maximum="10800"/></draw:enhanced-geometry></draw:custom-shape>
Comment 3 Bill 2016-06-26 22:22:17 UTC
Created attachment 125932 [details]
shows preliminary idea for solution GUI for creting/editing block arcs.

The top half of the attached image shows my preliminary rough idea of what the GUI for creating and editing block arcs should look like.  The bottom half is a rough drawing of the block arc created by the GUI in the top half.  I've also shown additional lines and the axis to help people correctly understand.  I assume that the origin of Draw's axes are in the upper left corner of the page area enclosed by the page margins.  The actual operational GUI should work both in metric units and in "American" units.
Comment 4 Regina Henschel 2016-07-05 15:32:49 UTC
Created attachment 126078 [details]
Basic macro for setting arc and radius numerically

I have attached a document, which contains a Basic library 'BlockArrowEditor'. For a block arc use the subroutine 'EditBlockArc' from module 'Arc', for a circular arrow (which is very similar) use the subroutine 'EditCirculaArrow' from module 'Arrow'. To get the macros to your environment, open the file, then with organizer for Basic export the library and then import it to 'My Macros' for example.

The solution has a dialog to set the angles in degree. And it has an input field to enter a factor for the inner radius.

The path of a custom shape is first drawn on a base square of 21600 internal units. Then it is scaled to the size, which you set in the Position&Size dialog. And other transformations like flipping, rotating, or shearing might be applied in addition.  But the values from the handles are directly used in the path calculation. Therefore it is not easily possible the make a dialog, which refers to the shape as you see it on screen. It would need some matrix operations. (I have currently not the time to do it.)

Therefore I have created the dialog so, that you specify the inner radius by a factor. If the untransformed shape has a width of 4cm, then the outer radius is 4cm. If you then want an inner radius of 3cm, you have to enter the factor 0.75, because 3cm = 0.75 * 4cm.

The angles always refer to a square shape, their value is in degrees.

I know it is not perfect, but it might help you until someone will implement a solution.

For implementation I would prefer a more general solution. The Position&Size dialog should get a new tab page "Custom Shape Adjudgment", which is shown in case a selected custom shape has handles. So not a special solution for a block arc, but a general solution for all custom shapes having handles.
Comment 5 Regina Henschel 2016-07-05 15:34:57 UTC
@Bill: To center the shape no new feature is needed, because you can set the position numerically in the Position&Size dialog.
Comment 6 Bill 2016-07-07 01:46:39 UTC
(In reply to Regina Henschel from comment #4)
> Created attachment 126078 [details]
> Basic macro for setting arc and radius numerically
> 
> I have attached a document, which contains a Basic library
> 'BlockArrowEditor'. For a block arc use the subroutine 'EditBlockArc' from
> module 'Arc', for a circular arrow (which is very similar) use the
> subroutine 'EditCirculaArrow' from module 'Arrow'. To get the macros to your
> environment, open the file, then with organizer for Basic export the library
> and then import it to 'My Macros' for example.
> 
> The solution has a dialog to set the angles in degree. And it has an input
> field to enter a factor for the inner radius.
> 
> The path of a custom shape is first drawn on a base square of 21600 internal
> units. Then it is scaled to the size, which you set in the Position&Size
> dialog. And other transformations like flipping, rotating, or shearing might
> be applied in addition.  But the values from the handles are directly used
> in the path calculation. Therefore it is not easily possible the make a
> dialog, which refers to the shape as you see it on screen. It would need
> some matrix operations. (I have currently not the time to do it.)
> 
> Therefore I have created the dialog so, that you specify the inner radius by
> a factor. If the untransformed shape has a width of 4cm, then the outer
> radius is 4cm. If you then want an inner radius of 3cm, you have to enter
> the factor 0.75, because 3cm = 0.75 * 4cm.
> 
> The angles always refer to a square shape, their value is in degrees.
> 
> I know it is not perfect, but it might help you until someone will implement
> a solution.
> 
> For implementation I would prefer a more general solution. The Position&Size
> dialog should get a new tab page "Custom Shape Adjudgment", which is shown
> in case a selected custom shape has handles. So not a special solution for a
> block arc, but a general solution for all custom shapes having handles.

In the longer term, I also am wanting a more general solution.  But I thought it easier and wiser to do one shape first.  Once that is working well, the others should be easier.  In the long term, I'm looking for:
* circular arcs created/edited by the user by entering in a GUI the center, the radius, the start angle, and either the central angle or the end angle.
* elliptical arcs created/edited by the user by entering in a GUI the center, the semi-major and semi-minor axes, the angle of rotation for the semi-major axis, the start angle, and either the central angle or the end angle.
* circles created/edited by the user by entering in a GUI the center and the radius.
* ellipses created/edited by the user by entering in a GUI the center, the semi-major and semi-minor axes, and the angle of rotation for the semi-major axis.
* rectangles created/edited by the user by entering in a GUI the center, the length, the width, and the angle of rotation.
* squares created/edited by the user by entering the center, the length of a side, and the angle of rotation.
* regular polygons created/edited by the user by entering the center, the number of sides (or vertices), the distance from the center to either a vertex or the mid-point of a side, and the angle of rotation.  (A square could be a special case of this.)
* stars created/edited by the user by entering the center, the number of points, the distance from the center to an inner point, the distance from the center to an outer point, and the angle of rotation.
Other shapes can be done appropriately.  The behavior I'm wanting is that when I want to create a new instance of a shape, I click the shape in the window area to the left of the document and its ruler, the GUI for me to enter the appropriate numbers would by default pop up.  I would not do any clicking or dragging in the document.  Likewise, to edit an instance of a shape, I click that shape in the document, and then use the right mouse button to bring up the floating menu, and from there select the GUI for editing the shape instance.  Again, I would not do any dragging in the document.  I should be able to change a preference value to choose between number entry and clicking/dragging to create/edit shape instances.

Thank-you for the attachment.  I'll give it a try, but I've never tried using macros before, so this will take some time.
Comment 7 Bill 2016-07-07 01:50:57 UTC
(In reply to Regina Henschel from comment #5)
> @Bill: To center the shape no new feature is needed, because you can set the
> position numerically in the Position&Size dialog.

Thank-you.  I showed it in my June 26 attachment for completeness.  Whether everything is in one dialog/tab or in separate windows/tabs - do what works best, what the majority of users want, what's simplest and most robust.  Be consistent across all shapes.

Bill.
Comment 8 Heiko Tietze 2021-09-14 05:52:29 UTC
(In reply to Bill from comment #3)
> Created attachment 125932 [details]
> shows preliminary idea for solution GUI for creting/editing block arcs.

I like it. Would show the illustration as preview right of the parameters as we do in other dialogs too. The "inner radius" could be disabled for non-block arcs. 
And it fits into the Position and Size dialog as an extra tab "Arc".