gint height = gdk_pixbuf_get_height(pixbuf);
guint *tex = g_new0(guint, 1);
- gis_opengl_begin(self->opengl);
+ gis_viewer_begin(self->viewer);
glGenTextures(1, tex);
glBindTexture(GL_TEXTURE_2D, *tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glFlush();
- gis_opengl_end(self->opengl);
+ gis_viewer_end(self->viewer);
tile->data = tex;
- gis_opengl_redraw(self->opengl);
+ gtk_widget_queue_draw(GTK_WIDGET(self->viewer));
g_object_unref(pixbuf);
return FALSE;
}
data->self = self;
data->tile = tile;
data->pixbuf = gdk_pixbuf_new_from_file(path, NULL);
+ if (!data->pixbuf)
+ g_warning("GisPluginBmng: _load_tile - Error loading pixbuf %s", path);
g_free(path);
g_idle_add_full(G_PRIORITY_LOW, _load_tile_cb, data, NULL);
g_debug("GisPluginBmng: _load_tile end %p", g_thread_self());
GisPluginBmng *self = _self;
g_mutex_lock(self->mutex);
gdouble lat, lon, elev;
- gis_view_get_location(self->view, &lat, &lon, &elev);
+ gis_viewer_get_location(self->viewer, &lat, &lon, &elev);
gis_tile_update(self->tiles,
MAX_RESOLUTION, TILE_WIDTH, TILE_WIDTH,
lat, lon, elev,
/*************
* Callbacks *
*************/
-static void _on_location_changed(GisView *view, gdouble lat, gdouble lon, gdouble elev,
- GisPluginBmng *self)
+static void _on_location_changed(GisViewer *viewer,
+ gdouble lat, gdouble lon, gdouble elev, GisPluginBmng *self)
{
g_thread_create(_update_tiles, self, FALSE, NULL);
}
/***********
* Methods *
***********/
-GisPluginBmng *gis_plugin_bmng_new(GisWorld *world, GisView *view, GisOpenGL *opengl)
+GisPluginBmng *gis_plugin_bmng_new(GisViewer *viewer)
{
g_debug("GisPluginBmng: new");
GisPluginBmng *self = g_object_new(GIS_TYPE_PLUGIN_BMNG, NULL);
- self->view = view;
- self->opengl = opengl;
+ self->viewer = viewer;
/* Load initial tiles */
_load_tile(self->tiles, self);
g_thread_create(_update_tiles, self, FALSE, NULL);
/* Connect signals */
- self->sigid = g_signal_connect(self->view, "location-changed",
+ self->sigid = g_signal_connect(self->viewer, "location-changed",
G_CALLBACK(_on_location_changed), self);
return self;
static void gis_plugin_bmng_expose(GisPlugin *_self)
{
GisPluginBmng *self = GIS_PLUGIN_BMNG(_self);
- g_debug("GisPluginBmng: expose opengl=%p tiles=%p,%p",
- self->opengl, self->tiles, self->tiles->data);
- gis_opengl_render_tiles(self->opengl, self->tiles);
+ g_debug("GisPluginBmng: expose viewer=%p tiles=%p,%p",
+ self->viewer, self->tiles, self->tiles->data);
+ gis_viewer_render_tiles(self->viewer, self->tiles);
}
g_debug("GisPluginBmng: dispose");
GisPluginBmng *self = GIS_PLUGIN_BMNG(gobject);
/* Drop references */
- g_signal_handler_disconnect(self->view, self->sigid);
+ g_signal_handler_disconnect(self->viewer, self->sigid);
G_OBJECT_CLASS(gis_plugin_bmng_parent_class)->dispose(gobject);
}
static void gis_plugin_bmng_finalize(GObject *gobject)