Esempio n. 1
0
mapObj *mapObj_newFromString(char *map_text, char *new_path) {

      if(map_text && strlen(map_text))
        return msLoadMapFromString(map_text, new_path);
      else { /* create an empty map, no layers etc... */
        return msNewMapObj();
      }
}
Esempio n. 2
0
/**
 * @details This is called by `FromStringAsync` and runs in a different thread
 * to that function.
 *
 * @param req The asynchronous libuv request.
 */
void Map::FromStringWork(uv_work_t *req) {
  /* No HandleScope! This is run in a separate thread: *No* contact
     should be made with the Node/V8 world here. */

  MapfileBaton *baton = static_cast<MapfileBaton*>(req->data);

  baton->map = msLoadMapFromString(const_cast<char *>(baton->mapfile.c_str()), NULL);
  if (!baton->map) {
    errorObj *error = msGetErrorObj();
    if (!error || error->code == MS_NOERR || !strlen(error->message)) {
      baton->error = new MapserverError("Could not load mapfile", "Map::FromStringWork()");
    } else {
      baton->error = new MapserverError(error);
    }
  }

  msResetErrorList();
  return;
}