{"action":"created","issue":{"url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/47","labels_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/47/comments","events_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/47/events","html_url":"https://github.com/qgis/QGIS-Enhancement-Proposals/issues/47","id":114028662,"number":47,"title":"QEP 28: Label connectors","user":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/labels/Draft","name":"Draft","color":"207de5"}],"state":"open","locked":false,"assignee":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-10-29T11:17:40Z","updated_at":"2015-11-04T08:35:46Z","closed_at":null,"body":"========================================================================\r\nQGIS Enhancement 28: Label connectors\r\n========================================================================\r\n\r\n**Date** October 2015\r\n**Author** Hugo Mercier\r\n**Contact** hugo dot mercier at oslandia dot com\r\n**Last Edited** \r\n**Status**  \r\n**Version** QGIS 2.14\r\n\r\nSummary\r\n-------\r\n\r\nThis proposal is aiming at adding to the labeling display engine the possibility for the user to define\r\n\"connectors\" between labels and the features they label.\r\n\r\nCurrent state\r\n-------------\r\n\r\nThe current (2.11) version of QGIS allows to manually place labels when the output of the automatic placement mechanism is not enough.\r\n\r\nIt relies on \"data defined\" properties. Indeed, the X and Y positions of a label as well as its rotation angle can be defined by a data column or any\r\nexpression.\r\n\r\nSome graphical controls allow then to manually manipulate these properties. The state of a label can be changed from being automatically placed to being\r\nmanually placed (pinning/unpinning). When they are pinned, labels can then be moved or rotated by interaction of the user. Positions and rotations\r\ndata are then updated in columns of the layer.\r\n\r\nProposed improvements\r\n---------------------\r\n\r\nIt may be desirable to have visual \"connectors\" between the label and the feature it refers to. They are a generalization of \"arrows\", as it\r\ncan be found in drawing programs: single arrows, straight lines or curves. Connectors are \"attached\" to a label: if one of the two endings\r\n(either the label or the feature) is moved, the shape of the connector is recomputed and a display refresh is needed.\r\n\r\nThis QEP is not meant to give an exhaustive list of possible connectors. The idea is to have a generic implementation with the most common\r\ntypes of connectors and everything needed in the code to be able to add new types in the future.\r\n\r\nPossible types of connectors:\r\n- a straight line\r\n- two connected straight lines, with an horizontal part and a free part\r\n- three connected straight lines, with two horizontal parts and a vertical part\r\n- a curve with one bending point\r\n- a curve with two bending points\r\n\r\n![Connector types](https://raw.githubusercontent.com/mhugo/QGIS-Enhancement-Proposals/adv_labeling/connector_types.jpg)\r\n\r\nTo actually draw the connectors, additional properties (aside X and Y position) are needed like:\r\n- style of the line (plain, dotted, dashed, etc.)\r\n- thickness of the line\r\n- color of the line\r\n- presence of arrow heads on both ends\r\n- style of the arrow heads\r\n- size of the arrow heads (absolute or relative)\r\n- color of the arrow heads\r\n\r\nPlacement of the two ends also need additional properties:\r\n- position of the ending on the side of the label : up, down, right, left, center, etc.\r\n- position of the ending on the side of the feature:\r\n  - for points: no particular option, it targets the point in itself\r\n  - for lines: beginning, middle, center\r\n  - for polygons: centroid of the polygon or on the border\r\n\r\nCertain types of connectors may also need specific properties like coordinates of the control points for curves (Bézier or B-splines). Coordinates\r\nof control points can only be data-defined or defined by 'null' which will make the display engine use 'best' coordinates.\r\n\r\nImplementation details\r\n----------------------\r\n\r\nConnectors are drawn to the Qt canvas, using the QPainter API. In order to be able to reuse the drawing code in other parts (possibly in a new symbology for lines), some\r\nclasses will be designed.\r\nThese classes are composed mostly of read/write properties with a central method aiming at doing the actual drawing with a render context.\r\n\r\nQgsConnectorRenderer\r\n\r\nlineStyle\r\nlineColor\r\nheadStyle\r\nheadColor\r\ntailStyle\r\ntailColor\r\nisCurved\r\nvoid render( point[], renderContext )\r\n\r\nIn the current code base, the following methods would be modified:\r\n- QgsPalLabeling::drawLabeling() : extract necessary property values and data-defined values for connectors\r\n- new method drawConnector, similar to drawLabel that will instanciate a QgsConnectorRenderer and call render\r\n\r\n\r\nGUI Changes\r\n-----------\r\n\r\nThe labeling part of the \"properties\" dialog of a layer will need a new entry for connector-related properties. These properties\r\nwill be available only if X and Y positions are data-defined (i.e. manual placement).\r\n\r\n![Connector types](https://raw.githubusercontent.com/mhugo/QGIS-Enhancement-Proposals/adv_labeling/connector_properties.png)\r\n\r\nEach of the property could also be data-defined (not represented here).\r\n\r\nFrom the user perspective, new tools will be available to easily manipulate label connectors. To be consistent with current label manual placement toolboxes,\r\nnew controls will be added to manually place control points for connector types that need them.\r\n\r\nOptionaly, it would be nice for the user to be able to edit per-connector properties, i.e. properties that are data-defined via a GUI dialog. This could\r\nbe achieved by reusing the connector properties dialog and connecting it to one particular feature.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/comments/153635981","html_url":"https://github.com/qgis/QGIS-Enhancement-Proposals/issues/47#issuecomment-153635981","issue_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/47","id":153635981,"user":{"login":"mhugo","id":1618556,"avatar_url":"https://avatars.githubusercontent.com/u/1618556?v=3","gravatar_id":"","url":"https://api.github.com/users/mhugo","html_url":"https://github.com/mhugo","followers_url":"https://api.github.com/users/mhugo/followers","following_url":"https://api.github.com/users/mhugo/following{/other_user}","gists_url":"https://api.github.com/users/mhugo/gists{/gist_id}","starred_url":"https://api.github.com/users/mhugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhugo/subscriptions","organizations_url":"https://api.github.com/users/mhugo/orgs","repos_url":"https://api.github.com/users/mhugo/repos","events_url":"https://api.github.com/users/mhugo/events{/privacy}","received_events_url":"https://api.github.com/users/mhugo/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T08:35:46Z","updated_at":"2015-11-04T08:35:46Z","body":"@timlinux Sure. That is planned. I will make it more explicit. Thanks"}}