static gboolean _zoom (GdkEventKey *event) { switch(event->keyval) { // zoom in case GDK_KEY_Page_Up : _engine.state.rNM /= 2.0; S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; // zoom out case GDK_KEY_Page_Down: _engine.state.rNM *= 2.0; S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; } return TRUE; }
static gboolean _scroll (GdkEventKey *event) { switch(event->keyval) { case GDK_KEY_Left : _engine.state.cLon -= _engine.state.rNM/(60.0*10.0); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; case GDK_KEY_Right: _engine.state.cLon += _engine.state.rNM/(60.0*10.0); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; case GDK_KEY_Up : _engine.state.cLat += _engine.state.rNM/(60.0*10.0); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; case GDK_KEY_Down : _engine.state.cLat -= _engine.state.rNM/(60.0*10.0); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); break; } return TRUE; }
static gboolean _rotation(GdkEventKey *event) { //S52_getView(&_view); //* switch(event->keyval) { // - case GDK_minus: _engine.state.north += 1.0; if (360.0 < _engine.state.north) _engine.state.north -= 360.0; break; // + case GDK_equal: case GDK_plus : _engine.state.north -= 1.0; if (_engine.state.north < 0.0) _engine.state.north += 360.0; break; } //*/ //S52_setView(&_view); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); return TRUE; }
static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { (void)event; (void)data; // FIXME: find the new screen size GtkAllocation allocation; gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation); //gtk_widget_get_allocation(GTK_WIDGET(_engine.window), &allocation); //gtk_widget_size_allocate(GTK_WIDGET(_engine.window), &allocation); //GtkRequisition requisition; //gtk_widget_get_child_requisition(widget, &requisition); _engine.width = allocation.width; _engine.height = allocation.height; _s52_computeView(&_engine.state); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); S52_setViewPort(0, 0, allocation.width, allocation.height); _engine.do_S52draw = TRUE; return TRUE; }
static gboolean _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { (void)widget; (void)event; (void)data; //g_print("_configure_event\n"); // FIXME: find the new screen size //GtkAllocation allocation; //gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation); //_engine.width = allocation.width; //_engine.height = allocation.height; //gtk_widget_get_allocation(GTK_WIDGET(_engine.window), &allocation); //gtk_widget_size_allocate(GTK_WIDGET(_engine.window), &allocation); //GtkRequisition requisition; //gtk_widget_get_child_requisition(widget, &requisition); //* if (TRUE == _engine.do_S52init) { g_print("s52egl:configure_event()\n"); _egl_init(&_engine); _s52_init(&_engine); _engine.do_S52init = FALSE; } _s52_computeView(&_engine.state); S52_setView(_engine.state.cLat, _engine.state.cLon, _engine.state.rNM, _engine.state.north); S52_setViewPort(0, 0, _engine.width, _engine.height); _engine.do_S52draw = TRUE; //*/ return TRUE; }
static int _s52_init (s52engine *engine) { if ((NULL==engine->eglDisplay) || (EGL_NO_DISPLAY==engine->eglDisplay)) { g_print("_init_S52(): no EGL display ..\n"); return FALSE; } eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_WIDTH, &engine->width); eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_HEIGHT, &engine->height); // return constant value EGL_UNKNOWN (-1) with Mesa eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_HORIZONTAL_RESOLUTION, &engine->wmm); eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_VERTICAL_RESOLUTION, &engine->hmm); { // FIXME: broken on some monitor GdkScreen *screen = NULL; gint w,h; gint wmm,hmm; screen = gdk_screen_get_default(); w = gdk_screen_get_width (screen); h = gdk_screen_get_height (screen); wmm = gdk_screen_get_width_mm (screen); hmm = gdk_screen_get_height_mm(screen); //w = 1280; //h = 1024; //w = engine->width; //h = engine->height; //wmm = 376; //hmm = 301; // wrong //hmm = 307; //g_print("_init_S52(): start -1- ..\n"); if (FALSE == S52_init(w, h, wmm, hmm, NULL)) { engine->do_S52init = FALSE; return FALSE; } //g_print("_init_S52(): start -2- ..\n"); S52_setViewPort(0, 0, w, h); } // can be called any time S52_version(); #ifdef S52_USE_EGL S52_setEGLcb((EGL_cb)_egl_beg, (EGL_cb)_egl_end, engine); #endif // read cell location fron s52.cfg //S52_loadCell(NULL, NULL); S52_loadCell("CA479017.000", NULL); S52_loadCell("SCX_CapSante.tif", NULL); S52_setMarinerParam(S52_MAR_DISP_RASTER, 1.0); // Rimouski //S52_loadCell("/home/sduclos/dev/gis/S57/riki-ais/ENC_ROOT/CA579041.000", NULL); //S52_loadCell("/home/vitaly/CHARTS/for_sasha/GB5X01SE.000", NULL); //S52_loadCell("/home/vitaly/CHARTS/for_sasha/GB5X01NE.000", NULL); // Ice - experimental //S52_loadCell("/home/sduclos/dev/gis/data/ice/East_Coast/--0WORLD.shp", NULL); // Bathy - experimental //S52_loadCell("/home/sduclos/dev/gis/data/bathy/2009_HD_BATHY_TRIALS/46307260_LOD2.merc.tif", NULL); //S52_loadCell("/home/sduclos/dev/gis/data/bathy/2009_HD_BATHY_TRIALS/46307250_LOD2.merc.tif", NULL); //S52_setMarinerParam(S52_MAR_DISP_RASTER, 1.0); // load AIS select symb. //S52_loadPLib("plib-test-priv.rle"); #ifdef S52_USE_WORLD // World data if (TRUE == S52_loadCell(PATH "/0WORLD/--0WORLD.shp", NULL)) { //S52_setMarinerParam(S52_MAR_DISP_WORLD, 0.0); // default S52_setMarinerParam(S52_MAR_DISP_WORLD, 1.0); // show world } #endif // debug - remove clutter from this symb in SELECT mode //S52_setS57ObjClassSupp("M_QUAL", TRUE); // supress display of the U pattern //S52_setS57ObjClassSupp("M_QUAL", FALSE); // displaythe U pattern S52_toggleObjClassON ("M_QUAL"); // suppression ON //S52_toggleObjClassOFF("M_QUAL"); // suppression OFF S52_loadPLib(PLIB); S52_loadPLib(COLS); // -- DEPTH COLOR ------------------------------------ S52_setMarinerParam(S52_MAR_TWO_SHADES, 0.0); // 0.0 --> 5 shades //S52_setMarinerParam(S52_MAR_TWO_SHADES, 1.0); // 1.0 --> 2 shades // sounding color //S52_setMarinerParam(S52_MAR_SAFETY_DEPTH, 10.0); S52_setMarinerParam(S52_MAR_SAFETY_DEPTH, 15.0); //S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR, 10.0); S52_setMarinerParam(S52_MAR_SAFETY_CONTOUR, 3.0); //S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, 10.0); S52_setMarinerParam(S52_MAR_SHALLOW_CONTOUR, 5.0); //S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, 11.0); S52_setMarinerParam(S52_MAR_DEEP_CONTOUR, 10.0); //S52_setMarinerParam(S52_MAR_SHALLOW_PATTERN, 0.0); // (default off) S52_setMarinerParam(S52_MAR_SHALLOW_PATTERN, 1.0); // ON // -- DEPTH COLOR ------------------------------------ S52_setMarinerParam(S52_MAR_SHIPS_OUTLINE, 1.0); S52_setMarinerParam(S52_MAR_HEADNG_LINE, 1.0); S52_setMarinerParam(S52_MAR_BEAM_BRG_NM, 1.0); //S52_setMarinerParam(S52_MAR_FULL_SECTORS, 0.0); // (default ON) //S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_BASE); // always ON //S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_STD); // default //S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_OTHER); //S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_BASE | S52_MAR_DISP_CATEGORY_STD | S52_MAR_DISP_CATEGORY_OTHER); //S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_STD | S52_MAR_DISP_CATEGORY_OTHER); S52_setMarinerParam(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_SELECT); //S52_setMarinerParam(S52_MAR_DISP_LAYER_LAST, S52_MAR_DISP_LAYER_LAST_NONE ); //S52_setMarinerParam(S52_MAR_DISP_LAYER_LAST, S52_MAR_DISP_LAYER_LAST_STD ); // default //S52_setMarinerParam(S52_MAR_DISP_LAYER_LAST, S52_MAR_DISP_LAYER_LAST_OTHER); S52_setMarinerParam(S52_MAR_DISP_LAYER_LAST, S52_MAR_DISP_LAYER_LAST_SELECT); // All Mariner (Standard(default) + Other) //S52_setMarinerParam(S52_MAR_COLOR_PALETTE, 0.0); // DAY (default) //S52_setMarinerParam(S52_MAR_COLOR_PALETTE, 1.0); // DAY DARK S52_setMarinerParam(S52_MAR_COLOR_PALETTE, 5.0); // DAY 60 //S52_setMarinerParam(S52_MAR_COLOR_PALETTE, 6.0); // DUSK 60 //S52_setMarinerParam(S52_MAR_SCAMIN, 1.0); // ON (default) //S52_setMarinerParam(S52_MAR_SCAMIN, 0.0); // debug OFF - show all // remove QUAPNT01 symbole (black diagonal and a '?') S52_setMarinerParam(S52_MAR_QUAPNT01, 0.0); // off S52_setMarinerParam(S52_MAR_DISP_CALIB, 1.0); // --- TEXT ---------------------------------------------- S52_setMarinerParam(S52_MAR_SHOW_TEXT, 1.0); //S52_setMarinerParam(S52_MAR_SHOW_TEXT, 0.0); S52_setTextDisp(0, 100, TRUE); // show all text //S52_setTextDisp(0, 100, FALSE); // no text // cell's legend //S52_setMarinerParam(S52_MAR_DISP_LEGEND, 1.0); // show S52_setMarinerParam(S52_MAR_DISP_LEGEND, 0.0); // hide (default) // ------------------------------------------------------- //S52_setMarinerParam(S52_MAR_DISP_DRGARE_PATTERN, 0.0); // OFF //S52_setMarinerParam(S52_MAR_DISP_DRGARE_PATTERN, 1.0); // ON (default) S52_setMarinerParam(S52_MAR_ANTIALIAS, 1.0); // on //S52_setMarinerParam(S52_MAR_ANTIALIAS, 0.0); // off // a delay of 0.0 to tell to not delete old AIS (default +600 sec old) //S52_setMarinerParam(S52_MAR_DEL_VESSEL_DELAY, 0.0); // debug - use for timing redering //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_SY); //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LS); //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LC); //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AC); //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AP); //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_TX); // if first start find where we are looking _s52_computeView(&engine->state); // then (re)position the 'camera' S52_setView(engine->state.cLat, engine->state.cLon, engine->state.rNM, engine->state.north); S52_newCSYMB(); // must be first mariners' object so that the // rendering engine place it on top of OWNSHP/VESSEL //_s52_setupVRMEBL(&engine->state); //_s52_setupLEGLIN(); //_s52_setupPRDARE(&engine->state); #ifdef USE_FAKE_AIS _s52_setupVESSEL(&engine->state); _s52_setupOWNSHP(&engine->state); #endif engine->do_S52init = FALSE; engine->do_S52draw = TRUE; engine->do_S52drawLast = TRUE; engine->do_S52setViewPort = FALSE; return EGL_TRUE; }