Re: Many changes in layers and markers



On Thu, Feb 10, 2011 at 3:26 PM, Jiří Techet <techet gmail com> wrote:
>> I hadn't seen a commit since early January and I was starting to worry
>> that libchamplain was dead... nice to see all this work done all of a
>> sudden, it's like Christmas all over again ;-)
>
> Yes, that's a bad habit of mine that I don't like when the dirty work
> in progress is visible.

That's what branches are for. Then once everything's working, merge it
back into master ;-)

>> I like the idea of renaming 'polygon' into 'path' because that is a
>> much less technical name (and more indicative of it's use), but I'm
>> not sure about the name 'ChamplainMarkerLayer'. The name doesn't make
>> it obvious that that's what you need to use when you want to draw
>> squiggles on the map. Perhaps it should be called
>> ChamplainDrawingLayer? That seems like a more general name that would
>> indicate it's used for drawing points or polygons.
>
> It's because you have to insert markers inherited from ChamplainMarker
> into ChamplainMarkerLayer, which are then also used as nodes of the
> path.
> The path is just a property of the marker layer - you display or hide
> the connection between the markers inside the layer by
> champlain_marker_layer_set_path_visible():

Ok, I guess it makes sense in that context. I haven't been able to
play with this yet because jhbuild was having trouble building
clutter-gtk yesterday, but I'm hoping to get something done tonight.

>> If these two methods return only a float with no success boolean, then
>> that totally obviates the need for those python overrides I wrote.
>> Excellent!
>
> Previously the boolean return value returned always TRUE so it didn't
> make any sense to keep it.

Glad to hear it's gone, then ;-)

>> Cool. So what would be the recommended way to go about implementing a
>> custom widget on the map that's pinned to the view, but not the map?
>
> I'm not sure if I was clear enough - ChamplainLayer always moves
> together with the map so this is not the one you should use for custom
> widgets.

Yeah, that part I got...

> How to implement a custom widget? There are absolutely no restrictions
> on how the widget should be implemented apart from that it has to be a
> ClutterActor. At the moment we have 2 widgets - ChamplainScale and
> ChamplainLicense. They are both "active" which means they react to
> what happens with ChamplainView. In order to make them active, they
> have to connect to the signals of ChamplainView they are interested
> in. This is what happens in champlain_license_connect_view() and
> champlain_scale_connect_view() - there is also their opposite for
> disconnecting. ChamplainScale connects to notify::latitude and
> ChamplainLicense to notify::map-source. Of course if your widget is
> "passive", you don't need any function like that. You can then use the
> layout manager of the view to position the widget where you want.

Ok, the layout manager is the part that I'm not familiar with.
Currently, I have some clutter actors, and then I have a single
function that connects to the notify signals for lat, lon, height, and
width, and then spend a bit of time moving/sizing actors into place.

If the layout manager means that I don't have to position my actors
anymore, then that's exactly what I'm looking for. Eg, if I want
something to be centered, it needs to stay in the center even when the
window is resized.

> So for instance to insert the scale to the left bottom corner, use
> something like that:
>
>  scale = champlain_scale_new ();
>  champlain_scale_connect_view (CHAMPLAIN_SCALE (scale), view);
>
>  /* align to the bottom left */
>  layout_manager = champlain_view_get_layout_manager (view);
>  clutter_bin_layout_add (layout_manager, scale,
>                          CLUTTER_BIN_ALIGNMENT_START,
>                          CLUTTER_BIN_ALIGNMENT_END);

Well, that looks simple enough.

> Alternatively you can put it at exact position directly into the stage.

Yeah, that's how I've been doing it, and it seems a little clunky, so
I'm trying to get away from that.

> That's it. Again, "scale" from the above example can be arbitrary
> ClutterActor, there's nothing special about it.

Good show.

-- 
http://exolucere.ca


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]