/*
- * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ * Copyright (C) 2009-2011 Andy Spencer <andy753421@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* grits_viewer_project:
* @viewer: the viewer
* @lat: the latitude
- * @lon: the latitude
- * @elev: the latitude
+ * @lon: the longitude
+ * @elev: the elevation
* @px: the project x coordinate
* @py: the project y coordinate
* @pz: the project z coordinate
klass->project(viewer, lat, lon, elev, px, py, pz);
}
+/**
+ * grits_viewer_unproject:
+ * @viewer: the viewer
+ * @x: x coordinate in screen space
+ * @y: y coordinate in screen space
+ * @z: z coordinate in screen space, or -1 to use the value
+ * from the depth buffer at x and y as the z value
+ * @lat: the latitude
+ * @lon: the longitude
+ * @elev: the elevation
+ *
+ * Project a x, y point in screen space to a latitude, longitude, and elevation
+ * point. Useful for finding the position of the cursor or another on-screen
+ * object in world coordinates.
+ */
+void grits_viewer_unproject(GritsViewer *viewer,
+ gdouble px, gdouble py, gdouble pz,
+ gdouble *lat, gdouble *lon, gdouble *elev)
+{
+ GritsViewerClass *klass = GRITS_VIEWER_GET_CLASS(viewer);
+ if (!klass->unproject)
+ g_warning("GritsViewer: unproject - Unimplemented");
+ klass->unproject(viewer, px, py, pz, lat, lon, elev);
+}
+
/**
* grits_viewer_clear_height_func:
* @viewer: the viewer
*
* Returns: the #GritsObject referenced by the handle
*/
-GritsObject *grits_viewer_remove(GritsViewer *viewer, gpointer _object)
+GritsObject *grits_viewer_remove(GritsViewer *viewer, GritsObject *object)
{
- GritsObject *object = _object;
GritsViewerClass *klass = GRITS_VIEWER_GET_CLASS(viewer);
if (!klass->remove)
g_warning("GritsViewer: remove - Unimplemented");
- klass->remove(viewer, object->ref);
- object->ref = NULL;
- object->viewer = NULL;
+ klass->remove(viewer, object);
return object;
}