[Interest] QtLocation MapPolyLine and MapPolyGon style
paolo.angelelli at qt.io
Tue Feb 26 23:41:33 CET 2019
Hi, yes some limitations are there by design (projection, trajectory of lines),
and to overcome these limitations it is necessary of a bit of redesign + implementation
When it comes to the shapes, however, i might not have explained my suggestion well enough.
So the idea would be to create your geo polygon that you need to fancy fill using a shape.
Then you would need to anchor it to the map using a MapQuickItem.
However, MapQuickItem allows you to anchor one pixel of your item to one coordinate of the map.
So, in essence, once you have your shape correct in pixel coordinates for a specific zoom level,
you need to calculate the proper anchor point and rotation, and then you use the MapQuickItem.zoomLevel
property to make it scale with the map.
On Tue, 26 Feb 2019 18:45:05 +0100
maitai <maitai at virtual-winds.org> wrote:
> Thanks Paolo for your replies here and at qt bugs report
> In fact I am porting a qt widget application based on QGraphicsScene to
> QML and indeed these painting features are badly missing. Calculating
> polygon/shapes screen coordinates is not an issue in itself but that
> will become really tricky to implement when the users pans or zoom, so I
> would say unless I can do it through mapboxgl I will have to propose
> something else than dashed areas and lines.
> There are some other features which I think will be missing too, for
> instance lines are just "loxodromic" (rhumb) lines, when they should be
> "orthodromic" (great circle), or at least there should be an option for
> both cases. Another big issue is the projection. Mercator is OK in most
> cases but is there a way to have another projection (with mapboxgl maybe
> ?), for instance Lambert conformal conic projection for usage in high
> That being said Qt Location is much much better that QGraphicsScene for
> doing all that stuff, of course.
> Thanks again,
> Philippe Lelong
> Le 26-02-2019 15:21, Paolo Angelelli a écrit :
> > If you need dashed or dotted or styled lines, at the moment that's the
> > only workaround we can offer.
> > The built-in lines are using QTriangulatingStroker under the hood,
> > that seems to be missing that part
> > of the QPen features (brush, style).
> > as for map polygon, the only workaround i can think of, if mapboxgl
> > does not offer it/is not an option, is
> > to use a MapQuickItem instead, create the polygon with Shapes, and
> > then do the math and georeference it "manually".
> > As for your last question, i don't think i can answer since too many
> > details are missing
> > hope this helps a bit, anyway
> > On Mon, 25 Feb 2019 20:01:17 +0100
> > maitai <maitai at virtual-winds.org> wrote:
> >> Hi,
> >> I may be wrong since it seems incredible, but it seems there is no way
> >> to draw a MapPolyLine dashed or dotlined, and similarly I didn't find
> >> a
> >> way to fill a MapPolygon with a pattern.
> >> If that is the case, what in your opinion would be the best way to
> >> implement this?
> >> I found QTBUG-46651 which recommends to use an empty mapboxgl layer
> >> instead of my current itemsoverlay map, would that cover the needs
> >> since
> >> I have plenty of other mapItems and need to manage z values for each
> >> of
> >> them?
> >> Thanks
> >> Philippe Lelong.
> >> _______________________________________________
> >> Interest mailing list
> >> Interest at qt-project.org
> >> https://lists.qt-project.org/listinfo/interest
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> Interest mailing list
> Interest at qt-project.org
More information about the Interest