static int _s52_setupVRMEBL(s52droid_state_t *state) { //char *attVal = NULL; // ordinary cursor char attVal[] = "cursty:2,_cursor_label:0.0N 0.0W"; // open cursor double xyz[3] = {state->cLon, state->cLat, 0.0}; int S52_VRMEBL_vrm = TRUE; int S52_VRMEBL_ebl = TRUE; int S52_VRMEBL_sty = TRUE; // normalLineStyle int S52_VRMEBL_ori = TRUE; // (user) setOrigin _cursor2 = S52_newMarObj("cursor", S52_POINT, 1, xyz, attVal); //int ret = S52_toggleObjClassOFF("cursor"); //g_print("_s52_setupVRMEBL(): S52_toggleObjClassOFF('cursor'); ret=%i\n", ret); //int ret = S52_toggleObjClassON("cursor"); //g_print("_s52_setupVRMEBL(): S52_toggleObjClassON('cursor'); ret=%i\n", ret); _vrmeblA = S52_newVRMEBL(S52_VRMEBL_vrm, S52_VRMEBL_ebl, S52_VRMEBL_sty, S52_VRMEBL_ori); //_vrmeblA = S52_newVRMEBL(S52_VRMEBL_vrm, !S52_VRMEBL_ebl, S52_VRMEBL_sty, !S52_VRMEBL_ori); //_vrmeblA = S52_newVRMEBL(S52_VRMEBL_vrm, !S52_VRMEBL_ebl, S52_VRMEBL_sty, S52_VRMEBL_ori); S52_toggleObjClassON("cursor"); // suppression ON S52_toggleObjClassON("ebline"); S52_toggleObjClassON("vrmark"); return TRUE; }
static int _s52_setupPRDARE(s52droid_state_t *state) // test - centroid (PRDARE: wind farm) { // AREA (CW: to center the text) double xyzArea[6*3] = { state->cLon + 0.000, state->cLat + 0.000, 0.0, state->cLon - 0.005, state->cLat + 0.004, 0.0, state->cLon - 0.010, state->cLat + 0.000, 0.0, state->cLon - 0.010, state->cLat + 0.005, 0.0, state->cLon + 0.000, state->cLat + 0.005, 0.0, state->cLon + 0.000, state->cLat + 0.000, 0.0, }; // PRDARE/WNDFRM51/CATPRA9 char attVal[] = "CATPRA:9"; _prdare = S52_newMarObj("PRDARE", S52_AREAS, 6, xyzArea, attVal); return TRUE; }
static int _s52_setupVESSEL(s52droid_state_t *state) { // ARPA //_vessel_arpa = S52_newVESSEL(1, dummy, "ARPA label"); //_vessel_arpa = S52_newVESSEL(1, "ARPA label"); //S52_pushPosition(_vessel_arpa, _engine.state.cLat + 0.01, _engine.state.cLon - 0.02, 045.0); //S52_setVector(_vessel_arpa, 2, 060.0, 3.0); // water // AIS active _vessel_ais = S52_newVESSEL(2, NULL); S52_setDimension(_vessel_ais, 100.0, 100.0, 15.0, 15.0); //S52_pushPosition(_vessel_ais, _engine.state.cLat - 0.02, _engine.state.cLon + 0.02, 045.0); //S52_pushPosition(_vessel_ais, state->cLat - 0.04, state->cLon + 0.04, 045.0); S52_pushPosition(_vessel_ais, state->cLat - 0.01, state->cLon + 0.01, 045.0); S52_setVector(_vessel_ais, 1, 060.0, 16.0); // ground // (re) set label S52_setVESSELlabel(_vessel_ais, VESSELLABEL); int vesselSelect = 0; // OFF int vestat = 1; int vesselTurn = VESSELTURN_UNDEFINED; S52_setVESSELstate(_vessel_ais, vesselSelect, vestat, vesselTurn); // AIS sleeping //_vessel_ais = S52_newVESSEL(2, 2, "MV Non Such - sleeping");); //S52_pushPosition(_vessel_ais, _engine.state.cLat - 0.02, _engine.state.cLon + 0.02, 045.0); // VTS (this will not draw anything!) //_vessel_vts = S52_newVESSEL(3, dummy); #ifdef S52_USE_AFGLOW // afterglow _vessel_ais_afglow = S52_newMarObj("afgves", S52_LINES, MAX_AFGLOW_PT, NULL, NULL); #endif return TRUE; }
static int _s52_setupLEGLIN(void) { /* http://www.marinfo.gc.ca/fr/Glaces/index.asp SRCN04 CWIS 122100 Bulletin des glaces pour le fleuve et le golfe Saint-Laurent de Les Escoumins aux détroits de Cabot et de Belle-Isle émis à 2100TUC dimanche 12 février 2012 par le Centre des glaces de Québec de la Garde côtière canadienne. Route recommandée no 01 De la station de pilotage de Les Escoumins au point de changement ALFA: 4820N 06920W au point de changement BRAVO: 4847N 06830W puis point de changement CHARLIE: 4900N 06800W puis point de changement DELTA: 4930N 06630W puis point de changement ECHO: 4930N 06425W puis point de changement FOXTROT: 4745N 06000W puis route normale de navigation. Route recommandée no 05 Émise à 1431UTC le 17 FEVRIER 2012 par le Centre des Glaces de Québec de la Garde côtière canadienne. De la station de pilotage de Les Escoumins au point de changement ALFA: 4820N 06920W au point de changement BRAVO: 4930N 06630W puis point de changement CHARLIE: 4945N 06450W puis point de changement DELTA: 4730N 06000W puis route normale de navigation. */ typedef struct WPxyz_t { double x,y,z; } WPxyz_t; //* WPxyz_t WPxyz[4] = { {-69.33333, 48.33333, 0.0}, // WP1 - ALPHA {-68.5, 48.78333, 0.0}, // WP2 - BRAVO {-68.0, 49.00, 0.0}, // WP3 - CHARLIE {-66.5, 49.5, 0.0} // WP4 - DELTA }; //*/ /* WPxyz_t WPxyz[4] = { {-69.33333, 48.33333, 0.0}, // WP1 - ALPHA {-66.5, 49.5, 0.0} // WP2 - BRAVO }; */ char attVal1[] = "select:2,OBJNAM:ALPHA"; // waypoint on alternate planned route char attVal2[] = "select:2,OBJNAM:BRAVO"; // waypoint on alternate planned route char attVal3[] = "select:2,OBJNAM:CHARLIE"; // waypoint on alternate planned route char attVal4[] = "select:2,OBJNAM:DELTA"; // waypoint on alternate planned route _waypnt1 = S52_newMarObj("waypnt", S52_POINT, 1, (double*)&WPxyz[0], attVal1); _waypnt2 = S52_newMarObj("waypnt", S52_POINT, 1, (double*)&WPxyz[1], attVal2); _waypnt3 = S52_newMarObj("waypnt", S52_POINT, 1, (double*)&WPxyz[2], attVal3); _waypnt4 = S52_newMarObj("waypnt", S52_POINT, 1, (double*)&WPxyz[3], attVal4); #define ALT_RTE 2 // select: alternate (2) legline for Ice Route 2012-02-12T21:00:00Z _leglin1 = S52_newLEGLIN(ALT_RTE, 0.0, 0.0, WPxyz[0].y, WPxyz[0].x, WPxyz[1].y, WPxyz[1].x, NULL); _leglin2 = S52_newLEGLIN(ALT_RTE, 0.0, 0.0, WPxyz[1].y, WPxyz[1].x, WPxyz[2].y, WPxyz[2].x, _leglin1); _leglin3 = S52_newLEGLIN(ALT_RTE, 0.0, 0.0, WPxyz[2].y, WPxyz[2].x, WPxyz[3].y, WPxyz[3].x, _leglin2); //_leglin4 = S52_newLEGLIN(1, 0.0, 0.0, WPxyz[3].y, WPxyz[3].x, WPxyz[4].y, WPxyz[4].x, _leglin3); //_route[0] = _leglin1; //_route[1] = _leglin2; //_route[2] = _leglin3; //_route[3] = _leglin3; //S52_setRoute(4, _route); /* {// test wholin char attVal[] = "loctim:1100,usrmrk:test_wholin"; double xyz[6] = {_engine.state.cLon, _engine.state.cLat, 0.0, _engine.state.cLon + 0.01, _engine.state.cLat - 0.01, 0.0}; _wholin = S52_newMarObj("wholin", S52_LINES, 2, xyz, attVal); } */ return TRUE; }
static _ais_t *_getAIS (unsigned int mmsi) { // return this _ais_t *ais = NULL; // check that gps_done() haven't flush this if (NULL == _ais_list) { g_print("s52ais:_getAIS() no AIS list\n"); return NULL; } unsigned int i = 0; for (i=0; i<_ais_list->len; ++i) { ais = &g_array_index(_ais_list, _ais_t, i); if (mmsi == ais->mmsi) { return ais; } } { // NEW AIS (not found hence new) _ais_t newais; __builtin_bzero(&newais, sizeof(_ais_t)); newais.mmsi = mmsi; newais.status = -1; // 0 indicate that status form report is needed //newais.name[AIS_SHIPNAME_MAXLEN + 1] = '\0'; newais.name[0] = '\0'; g_get_current_time(&newais.lastUpdate); newais.course = -1.0; newais.speed = 0.0; // create an active symbol, put mmsi since status is not known yet g_sprintf(newais.name, "%i", mmsi); #ifdef S52_USE_SOCK // debug: make ferry acte as ownshp if (OWNSHIP == mmsi) { gchar *resp = _encodeNsend("S52_newOWNSHP", "\"%s\"", newais.name); if (NULL != resp) { sscanf(resp, "[ %lu", (long unsigned int *) &newais.vesselH); } g_print("s52ais:_getAIS(): new ownshpH:%lu\n", (long unsigned int) newais.vesselH); } else { gchar *resp = _encodeNsend("S52_newVESSEL", "%i,\"%s\"", 2, newais.name); if (NULL != resp) { sscanf(resp, "[ %lu", (long unsigned int *) &newais.vesselH); } g_print("s52ais:_getAIS(): new vesselH:%lu\n", (long unsigned int) newais.vesselH); } #else // S52_USE_SOCK // debug: make ferry acte as ownshp if (OWNSHIP == mmsi) { newais.vesselH = S52_newOWNSHP(newais.name); } else { //int vesrce = 1; // ARPA int vesrce = 2; // AIS //int vesrce = 3; // VTS newais.vesselH = S52_newVESSEL(vesrce, newais.name); } #endif // S52_USE_SOCK // new AIS failed if (NULL == newais.vesselH) { g_print("s52ais:_getAIS(): new vesselH fail\n"); return NULL; } #ifdef S52_USE_AFGLOW #ifdef S52_USE_SOCK // debug: make ferry acte as ownshp if (OWNSHIP == mmsi) { gchar *resp = _encodeNsend("S52_newMarObj", "\"%s\",%i,%i", "afgshp", S52_LINES, MAX_AFGLOW_PT); if (NULL != resp) { sscanf(resp, "[ %lu", (long unsigned int *) &newais.afglowH); } g_print("s52ais:_getAIS(): new afglowH:%lu\n", (long unsigned int) newais.afglowH); } else { gchar *resp = _encodeNsend("S52_newMarObj", "\"%s\",%i,%i", "afgves", S52_LINES, MAX_AFGLOW_PT); if (NULL != resp) { sscanf(resp, "[ %lu", (long unsigned int *) &newais.afglowH); } g_print("s52ais:_getAIS(): new afglowH:%lu\n", (long unsigned int) newais.afglowH); } #else // S52_USE_SOCK // debug: make ferry acte as ownshp if (OWNSHIP == mmsi) newais.afglowH = S52_newMarObj("afgshp", S52_LINES, MAX_AFGLOW_PT, NULL, NULL); else newais.afglowH = S52_newMarObj("afgves", S52_LINES, MAX_AFGLOW_PT, NULL, NULL); #endif // S52_USE_SOCK if (NULL == newais.afglowH) { g_print("s52ais:_getAIS(): new afglowH fail\n"); return NULL; } #endif // save S52obj handle after registered in libS52 g_array_append_val(_ais_list, newais); ais = &g_array_index(_ais_list, _ais_t, _ais_list->len - 1); #ifdef S52_USE_DBUS _signal_newVESSEL(_dbus, newais.vesselH, newais.name); #endif } return ais; }