本文整理汇总了C++中VIK_LAYER函数的典型用法代码示例。如果您正苦于以下问题:C++ VIK_LAYER函数的具体用法?C++ VIK_LAYER怎么用?C++ VIK_LAYER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VIK_LAYER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_complete_process
/**
* Some common things to do on completion of a datasource process
* . Update layer
* . Update dialog info
* . Update main dsisplay
*/
static void on_complete_process (w_and_interface_t *wi)
{
if (wi->w->running) {
gtk_label_set_text ( GTK_LABEL(wi->w->status), _("Done.") );
if ( wi->creating_new_layer ) {
/* Only create the layer if it actually contains anything useful */
// TODO: create function for this operation to hide detail:
if ( ! vik_trw_layer_is_empty ( wi->vtl ) ) {
vik_layer_post_read ( VIK_LAYER(wi->vtl), wi->w->vvp, TRUE );
vik_aggregate_layer_add_layer( vik_layers_panel_get_top_layer(wi->w->vlp), VIK_LAYER(wi->vtl));
}
else
gtk_label_set_text ( GTK_LABEL(wi->w->status), _("No data.") );
}
/* View this data if available and is desired */
if ( wi->vtl && wi->w->source_interface->autoview ) {
vik_trw_layer_auto_set_view ( wi->vtl, vik_layers_panel_get_viewport(wi->w->vlp) );
}
if ( wi->w->source_interface->keep_dialog_open ) {
gtk_dialog_set_response_sensitive ( GTK_DIALOG(wi->w->dialog), GTK_RESPONSE_ACCEPT, TRUE );
gtk_dialog_set_response_sensitive ( GTK_DIALOG(wi->w->dialog), GTK_RESPONSE_REJECT, FALSE );
} else {
gtk_dialog_response ( GTK_DIALOG(wi->w->dialog), GTK_RESPONSE_ACCEPT );
}
// Main display update
if ( wi->vtl )
vik_layers_panel_emit_update ( wi->w->vlp );
} else {
/* cancelled */
if ( wi->creating_new_layer )
g_object_unref(wi->vtl);
}
}
示例2: aggregate_layer_track_list_dialog
static void aggregate_layer_track_list_dialog ( gpointer data[2] )
{
VikAggregateLayer *val = VIK_AGGREGATE_LAYER(data[0]);
gchar *title = g_strdup_printf ( _("%s: Track and Route List"), VIK_LAYER(val)->name );
vik_trw_layer_track_list_show_dialog ( title, VIK_LAYER(val), NULL, aggregate_layer_track_create_list, TRUE );
g_free ( title );
}
示例3: vik_aggregate_layer_tool
/* returns 0 == we're good, 1 == didn't find any layers, 2 == got rejected */
guint vik_aggregate_layer_tool ( VikAggregateLayer *val, VikLayerTypeEnum layer_type, VikToolInterfaceFunc tool_func, GdkEventButton *event, VikViewport *vvp )
{
GList *iter = val->children;
gboolean found_rej = FALSE;
if (!iter)
return FALSE;
while (iter->next)
iter = iter->next;
while ( iter )
{
/* if this layer "accepts" the tool call */
if ( VIK_LAYER(iter->data)->visible && VIK_LAYER(iter->data)->type == layer_type )
{
if ( tool_func ( VIK_LAYER(iter->data), event, vvp ) )
return 0;
else
found_rej = TRUE;
}
/* recursive -- try the same for the child aggregate layer. */
else if ( VIK_LAYER(iter->data)->visible && VIK_LAYER(iter->data)->type == VIK_LAYER_AGGREGATE )
{
gint rv = vik_aggregate_layer_tool(VIK_AGGREGATE_LAYER(iter->data), layer_type, tool_func, event, vvp);
if ( rv == 0 )
return 0;
else if ( rv == 2 )
found_rej = TRUE;
}
iter = iter->prev;
}
return found_rej ? 2 : 1; /* no one wanted to accept the tool call in this layer */
}
示例4: aggregate_layer_track_list_dialog
static void aggregate_layer_track_list_dialog ( menu_array_values values )
{
VikAggregateLayer *val = VIK_AGGREGATE_LAYER ( values[MA_VAL] );
gchar *title = g_strdup_printf ( _("%s: Track and Route List"), VIK_LAYER(val)->name );
vik_trw_layer_track_list_show_dialog ( title, VIK_LAYER(val), NULL, aggregate_layer_track_create_list, TRUE );
g_free ( title );
}
示例5: aggregate_layer_marshall
static void aggregate_layer_marshall( VikAggregateLayer *val, guint8 **data, gint *datalen )
{
GList *child = val->children;
VikLayer *child_layer;
guint8 *ld;
gint ll;
GByteArray* b = g_byte_array_new ();
gint len;
#define alm_append(obj, sz) \
len = (sz); \
g_byte_array_append ( b, (guint8 *)&len, sizeof(len) ); \
g_byte_array_append ( b, (guint8 *)(obj), len );
vik_layer_marshall_params(VIK_LAYER(val), &ld, &ll);
alm_append(ld, ll);
g_free(ld);
while (child) {
child_layer = VIK_LAYER(child->data);
vik_layer_marshall ( child_layer, &ld, &ll );
if (ld) {
alm_append(ld, ll);
g_free(ld);
}
child = child->next;
}
*data = b->data;
*datalen = b->len;
g_byte_array_free(b, FALSE);
#undef alm_append
}
示例6: layers_item_toggled
static void layers_item_toggled (VikLayersPanel *vlp, GtkTreeIter *iter)
{
gboolean visible;
gpointer p;
gint type;
/* get type and data */
type = vik_treeview_item_get_type ( vlp->vt, iter );
p = vik_treeview_item_get_pointer ( vlp->vt, iter );
switch ( type )
{
case VIK_TREEVIEW_TYPE_LAYER:
visible = (VIK_LAYER(p)->visible ^= 1);
vik_layer_emit_update_although_invisible ( VIK_LAYER(p) ); /* set trigger for half-drawn */
break;
case VIK_TREEVIEW_TYPE_SUBLAYER:
visible = vik_layer_sublayer_toggle_visible ( VIK_LAYER(vik_treeview_item_get_parent(vlp->vt, iter)),
vik_treeview_item_get_data(vlp->vt, iter), p);
vik_layer_emit_update_although_invisible ( VIK_LAYER(vik_treeview_item_get_parent(vlp->vt, iter)) );
break;
default: return;
}
vik_treeview_item_set_visible ( vlp->vt, iter, visible );
}
示例7: VIK_GEOREF_LAYER
static VikGeorefLayer *georef_layer_new ( VikViewport *vvp )
{
VikGeorefLayer *vgl = VIK_GEOREF_LAYER ( g_object_new ( VIK_GEOREF_LAYER_TYPE, NULL ) );
vik_layer_set_type ( VIK_LAYER(vgl), VIK_LAYER_GEOREF );
// Since GeoRef layer doesn't use uibuilder
// initializing this way won't do anything yet..
vik_layer_set_defaults ( VIK_LAYER(vgl), vvp );
// Make these defaults based on the current view
vgl->mpp_northing = vik_viewport_get_ympp ( vvp );
vgl->mpp_easting = vik_viewport_get_xmpp ( vvp );
vik_coord_to_utm ( vik_viewport_get_center ( vvp ), &(vgl->corner) );
vgl->image = NULL;
vgl->pixbuf = NULL;
vgl->click_x = -1;
vgl->click_y = -1;
vgl->scaled = NULL;
vgl->scaled_width = 0;
vgl->scaled_height = 0;
vgl->ll_br.lat = 0.0;
vgl->ll_br.lon = 0.0;
vgl->alpha = 255;
return vgl;
}
示例8: vik_aggregate_layer_delete
gboolean vik_aggregate_layer_delete ( VikAggregateLayer *val, GtkTreeIter *iter )
{
VikLayer *l = VIK_LAYER( vik_treeview_item_get_pointer ( VIK_LAYER(val)->vt, iter ) );
gboolean was_visible = l->visible;
vik_treeview_item_delete ( VIK_LAYER(val)->vt, iter );
aggregate_layer_delete_common ( val, l );
return was_visible;
}
示例9: VIK_COORD_LAYER
static VikCoordLayer *coord_layer_new ( VikViewport *vvp )
{
VikCoordLayer *vcl = VIK_COORD_LAYER ( g_object_new ( VIK_COORD_LAYER_TYPE, NULL ) );
vik_layer_set_type ( VIK_LAYER(vcl), VIK_LAYER_COORD );
vik_layer_set_defaults ( VIK_LAYER(vcl), vvp );
vcl->gc = NULL;
return vcl;
}
示例10: vik_aggregate_layer_delete
gboolean vik_aggregate_layer_delete ( VikAggregateLayer *val, GtkTreeIter *iter )
{
VikLayer *l = VIK_LAYER( vik_treeview_item_get_pointer ( VIK_LAYER(val)->vt, iter ) );
gboolean was_visible = l->visible;
vik_treeview_item_delete ( VIK_LAYER(val)->vt, iter );
val->children = g_list_remove ( val->children, l );
g_assert(DISCONNECT_UPDATE_SIGNAL(l,val)==1);
g_object_unref ( l );
return was_visible;
}
示例11: trw_layer_waypoint_list_add
/*
* Foreach entry we copy the various individual waypoint properties into the tree store
* formatting & converting the internal values into something for display
*/
static void trw_layer_waypoint_list_add ( vik_trw_waypoint_list_t *vtdl,
GtkTreeStore *store,
vik_units_height_t height_units )
{
GtkTreeIter t_iter;
VikWaypoint *wpt = vtdl->wpt;
VikTrwLayer *vtl = vtdl->vtl;
// Get start date
gchar time_buf[32];
time_buf[0] = '\0';
if ( wpt->has_timestamp ) {
#if GLIB_CHECK_VERSION(2,26,0)
GDateTime* gdt = g_date_time_new_from_unix_utc ( wpt->timestamp );
gchar *time = g_date_time_format ( gdt, WAYPOINT_LIST_DATE_FORMAT );
strncpy ( time_buf, time, sizeof(time_buf) );
g_free ( time );
g_date_time_unref ( gdt);
#else
GDate* gdate_start = g_date_new ();
g_date_set_time_t ( gdate_start, wpt->timestamp );
g_date_strftime ( time_buf, sizeof(time_buf), WAYPOINT_LIST_DATE_FORMAT, gdate_start );
g_date_free ( gdate_start );
#endif
}
// NB: doesn't include aggegrate visibility
gboolean visible = VIK_LAYER(vtl)->visible && wpt->visible;
visible = visible && vik_trw_layer_get_waypoints_visibility(vtl);
gdouble alt = wpt->altitude;
switch (height_units) {
case VIK_UNITS_HEIGHT_FEET: alt = VIK_METERS_TO_FEET(alt); break;
default:
// VIK_UNITS_HEIGHT_METRES: no need to convert
break;
}
gtk_tree_store_append ( store, &t_iter, NULL );
gtk_tree_store_set ( store, &t_iter,
0, VIK_LAYER(vtl)->name,
1, wpt->name,
2, time_buf,
3, visible,
4, wpt->comment,
5, (gint)round(alt),
6, get_wp_sym_small (wpt->symbol),
TRW_COL_NUM, vtl,
WPT_COL_NUM, wpt,
-1 );
}
示例12: vik_layers_panel_add_layer
/**
* vik_layers_panel_add_layer:
* @l: existing layer
*
* Add an existing layer to panel.
*/
void vik_layers_panel_add_layer ( VikLayersPanel *vlp, VikLayer *l )
{
GtkTreeIter iter;
GtkTreeIter *replace_iter = NULL;
/* could be something different so we have to do this */
vik_layer_change_coord_mode ( l, vik_viewport_get_coord_mode(vlp->vvp) );
if ( ! vik_treeview_get_selected_iter ( vlp->vt, &iter ) )
vik_aggregate_layer_add_layer ( vlp->toplayer, l );
else
{
VikAggregateLayer *addtoagg;
if (vik_treeview_item_get_type ( vlp->vt, &iter ) == VIK_TREEVIEW_TYPE_LAYER )
{
if ( IS_VIK_AGGREGATE_LAYER(vik_treeview_item_get_pointer ( vlp->vt, &iter )) )
addtoagg = VIK_AGGREGATE_LAYER(vik_treeview_item_get_pointer ( vlp->vt, &iter ));
else {
VikLayer *vl = VIK_LAYER(vik_treeview_item_get_parent ( vlp->vt, &iter ));
while ( ! IS_VIK_AGGREGATE_LAYER(vl) ) {
iter = vl->iter;
vl = VIK_LAYER(vik_treeview_item_get_parent ( vlp->vt, &vl->iter ));
g_assert ( vl->realized );
}
addtoagg = VIK_AGGREGATE_LAYER(vl);
replace_iter = &iter;
}
}
else
{
/* a sublayer is selected, first get its parent (layer), then find the layer's parent (aggr. layer) */
VikLayer *vl = VIK_LAYER(vik_treeview_item_get_parent ( vlp->vt, &iter ));
replace_iter = &(vl->iter);
g_assert ( vl->realized );
VikLayer *grandpa = (vik_treeview_item_get_parent ( vlp->vt, &(vl->iter) ) );
if (IS_VIK_AGGREGATE_LAYER(grandpa))
addtoagg = VIK_AGGREGATE_LAYER(grandpa);
else {
addtoagg = vlp->toplayer;
replace_iter = &grandpa->iter;
}
}
if ( replace_iter )
vik_aggregate_layer_insert_layer ( addtoagg, l, replace_iter );
else
vik_aggregate_layer_add_layer ( addtoagg, l );
}
vik_layers_panel_emit_update ( vlp );
}
示例13: aggregate_layer_analyse
static void aggregate_layer_analyse ( menu_array_values values )
{
VikAggregateLayer *val = VIK_AGGREGATE_LAYER ( values[MA_VAL] );
// There can only be one!
if ( val->tracks_analysis_dialog )
return;
val->tracks_analysis_dialog = vik_trw_layer_analyse_this ( VIK_GTK_WINDOW_FROM_LAYER(VIK_LAYER(val)),
VIK_LAYER(val)->name,
VIK_LAYER(val),
NULL,
aggregate_layer_track_create_list,
aggregate_layer_analyse_close );
}
示例14: aggregate_layer_analyse
static void aggregate_layer_analyse ( gpointer data[2] )
{
VikAggregateLayer *val = VIK_AGGREGATE_LAYER(data[0]);
// There can only be one!
if ( val->tracks_analysis_dialog )
return;
val->tracks_analysis_dialog = vik_trw_layer_analyse_this ( VIK_GTK_WINDOW_FROM_LAYER(VIK_LAYER(val)),
VIK_LAYER(val)->name,
VIK_LAYER(val),
NULL,
aggregate_layer_track_create_list,
aggregate_layer_analyse_close );
}
示例15: alm_size
static VikAggregateLayer *aggregate_layer_unmarshall( guint8 *data, gint len, VikViewport *vvp )
{
#define alm_size (*(gint *)data)
#define alm_next \
len -= sizeof(gint) + alm_size; \
data += sizeof(gint) + alm_size;
VikAggregateLayer *rv = vik_aggregate_layer_new();
VikLayer *child_layer;
vik_layer_unmarshall_params ( VIK_LAYER(rv), data+sizeof(gint), alm_size, vvp );
alm_next;
while (len>0) {
child_layer = vik_layer_unmarshall ( data + sizeof(gint), alm_size, vvp );
if (child_layer) {
rv->children = g_list_append ( rv->children, child_layer );
g_signal_connect_swapped ( G_OBJECT(child_layer), "update", G_CALLBACK(vik_layer_emit_update_secondary), rv );
}
alm_next;
}
// g_print("aggregate_layer_unmarshall ended with len=%d\n", len);
return rv;
#undef alm_size
#undef alm_next
}