예제 #1
0
mapObj *mapObj_clone(mapObj* self) {
    mapObj *dstMap;
    dstMap = msNewMapObj();
    if (msCopyMap(dstMap, self) != MS_SUCCESS)
    {
        msFreeMap(dstMap);
        dstMap = NULL;
    }
    return dstMap;
  }
예제 #2
0
Handle<Value> MSMap::Clone(const Arguments& args) {
  HandleScope scope;
  MSMap *map = ObjectWrap::Unwrap<MSMap>(args.This());
  MSMap *clone;
  mapObj * _copy = msNewMapObj();
  if (msCopyMap(_copy, map->this_) == MS_SUCCESS) {
    return scope.Close(MSMap::New(_copy));
  }
  return Undefined();
}
예제 #3
0
/**
 * @details This creates a `mapObj` primed for use with a `mapservObj`.
 */
mapObj* Map::LoadMap(mapservObj *mapserv, mapObj *src) {
  mapObj* map = msNewMapObj();

  if (!map) {
    return NULL;
  }

  // updating alters the state of the map, so work on a copy
  if (msCopyMap(map, src) != MS_SUCCESS) {
    msFreeMap(map);
    return NULL;
  }
  mapserv->map = map;

  // delegate to the helper function
  if (updateMap(mapserv, map) != MS_SUCCESS) {
    msFreeMap(map);
    mapserv->map = NULL;
    return NULL;
  }

  return map;
}
예제 #4
0
/*
** Extract Map File name from params and load it.
** Returns map object or NULL on error.
*/
static mapObj*
msModuleLoadMap(mapservObj *mapserv, mapserver_dir_config *conf)
{
  int i;
  /* OK, here's the magic: we take the mapObj from our stored config.
   * We will use a copy of it created by msCopyMap since MapServer
   * modifies the object at several places during request processing
   */
  mapObj *map = msNewMapObj ();
  if(!map) return NULL;
  msCopyMap (map, conf->map);


  /* check for any %variable% substitutions here, also do any map_ changes, we do this here so WMS/WFS  */
  /* services can take advantage of these "vendor specific" extensions */
  for(i=0; i<mapserv->request->NumParams; i++) {
    /*
    ** a few CGI variables should be skipped altogether
    **
    ** qstring: there is separate per layer validation for attribute queries and the substitution checks
    **          below conflict with that so we avoid it here
    */
    if(strncasecmp(mapserv->request->ParamNames[i],"qstring",7) == 0) continue;

    if(strncasecmp(mapserv->request->ParamNames[i],"map_",4) == 0 || strncasecmp(mapserv->request->ParamNames[i],"map.",4) == 0) { /* check to see if there are any additions to the mapfile */
      if(msUpdateMapFromURL(map, mapserv->request->ParamNames[i], mapserv->request->ParamValues[i]) != MS_SUCCESS) {
        msFreeMap(map);
        return NULL;
      }
      continue;
    }
  }

  msApplySubstitutions(map, mapserv->request->ParamNames, mapserv->request->ParamValues, mapserv->request->NumParams);
  msApplyDefaultSubstitutions(map);

  /* check to see if a ogc map context is passed as argument. if there */
  /* is one load it */

  for(i=0; i<mapserv->request->NumParams; i++) {
    if(strcasecmp(mapserv->request->ParamNames[i],"context") == 0) {
      if(mapserv->request->ParamValues[i] && strlen(mapserv->request->ParamValues[i]) > 0) {
        if(strncasecmp(mapserv->request->ParamValues[i],"http",4) == 0) {
          if(msGetConfigOption(map, "CGI_CONTEXT_URL"))
            msLoadMapContextURL(map, mapserv->request->ParamValues[i], MS_FALSE);
        } else
          msLoadMapContext(map, mapserv->request->ParamValues[i], MS_FALSE);
      }
    }
  }
  /*
   * RFC-42 HTTP Cookie Forwarding
   * Here we set the http_cookie_data metadata to handle the
   * HTTP Cookie Forwarding. The content of this metadata is the cookie
   * content. In the future, this metadata will probably be replaced
   * by an object that is part of the mapObject that would contain
   * information on the application status (such as cookie).
   */
  if( mapserv->request->httpcookiedata != NULL ) {
    msInsertHashTable( &(map->web.metadata), "http_cookie_data",
                       mapserv->request->httpcookiedata );
  }

  return map;
}