예제 #1
0
PHP_METHOD(shapeFileObj, __set)
{
  char *property;
  long property_len = 0;
  zval *value;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                            &property, &property_len, &value) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  if ( (STRING_EQUAL("numshapes", property)) ||
       (STRING_EQUAL("type", property)) ||
       (STRING_EQUAL("source", property)) ||
       (STRING_EQUAL("isopen", property)) ||
       (STRING_EQUAL("lastshape", property)) ||
       (STRING_EQUAL("bounds", property)) ) {
    mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
  } else {
    mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
  }
}
예제 #2
0
PHP_METHOD(OWSRequestObj, __set)
{
    char *property;
    long property_len;
    zval *value;
    zval *zobj = getThis();
    php_owsrequest_object *php_owsrequest;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_owsrequest = (php_owsrequest_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    if ( (STRING_EQUAL("numparams", property)) ||
         (STRING_EQUAL("type", property)) ||
         (STRING_EQUAL("contenttype", property)) ||
         (STRING_EQUAL("postrequest", property)) ||
         (STRING_EQUAL("httpcookiedata", property)))
    {
        mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
    }
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #3
0
PHP_METHOD(referenceMapObj, __set)
{
    char *property;
    long property_len = 0;
    zval *value;
    zval *zobj = getThis();
    php_referencemap_object *php_referencemap;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_referencemap = (php_referencemap_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_SET_STRING("image", php_referencemap->referencemap->image, value)
    else IF_SET_LONG("width", php_referencemap->referencemap->width, value)
        else IF_SET_LONG("height", php_referencemap->referencemap->height, value)
            else IF_SET_LONG("status", php_referencemap->referencemap->status, value)
                else IF_SET_LONG("marker", php_referencemap->referencemap->marker, value)
                    else IF_SET_STRING("markername", php_referencemap->referencemap->markername, value)
                        else IF_SET_LONG("markersize", php_referencemap->referencemap->markersize, value)
                            else IF_SET_LONG("maxboxsize", php_referencemap->referencemap->maxboxsize, value)
                                else IF_SET_LONG("minboxsize", php_referencemap->referencemap->minboxsize, value)
                                    else if ( (STRING_EQUAL("extent", property)) ||
                                              (STRING_EQUAL("color", property)) ||
                                              (STRING_EQUAL("outlinecolor", property))) {
                                        mapscript_throw_exception("Property '%s' is an object and can only be modified through its accessors." TSRMLS_CC, property);
                                    } else {
                                        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
                                    }
}
예제 #4
0
PHP_METHOD(labelObj, __set)
{
  char *property;
  long property_len = 0;
  zval *value;
  zval *zobj = getThis();
  php_label_object *php_label;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                            &property, &property_len, &value) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_label = (php_label_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_SET_STRING("font",  php_label->label->font, value)
  else IF_SET_STRING("encoding", php_label->label->encoding, value)
    else IF_SET_LONG("type", php_label->label->type, value)
      else IF_SET_LONG("shadowsizex",  php_label->label->shadowsizex, value)
        else IF_SET_LONG("shadowsizey",  php_label->label->shadowsizey, value)
          else IF_SET_DOUBLE("size", php_label->label->size, value)
            else IF_SET_DOUBLE("minsize", php_label->label->minsize, value)
              else IF_SET_DOUBLE("maxsize", php_label->label->maxsize, value)
                else IF_SET_LONG("position", php_label->label->position, value)
                  else IF_SET_LONG("offsetx", php_label->label->offsetx, value)
                    else IF_SET_LONG("offsety", php_label->label->offsety, value)
                      else IF_SET_DOUBLE("angle", php_label->label->angle, value)
                        else IF_SET_LONG("anglemode", php_label->label->anglemode, value)
                          else IF_SET_LONG("buffer", php_label->label->buffer, value)
                            else IF_SET_LONG("antialias", php_label->label->antialias, value)
                              else IF_SET_BYTE("wrap", php_label->label->wrap, value)
                                else IF_SET_LONG("minfeaturesize", php_label->label->minfeaturesize, value)
                                  else IF_SET_LONG("autominfeaturesize", php_label->label->autominfeaturesize, value)
                                    else IF_SET_LONG("repeatdistance", php_label->label->repeatdistance, value)
                                      else IF_SET_LONG("mindistance", php_label->label->mindistance, value)
                                        else IF_SET_LONG("partials", php_label->label->partials, value)
                                          else IF_SET_LONG("force", php_label->label->force, value)
                                            else IF_SET_LONG("outlinewidth", php_label->label->outlinewidth, value)
                                              else IF_SET_LONG("align", php_label->label->align, value)
                                                else IF_SET_LONG("maxlength", php_label->label->maxlength, value)
                                                  else IF_SET_LONG("minlength", php_label->label->minlength, value)
                                                    else IF_SET_LONG("maxoverlapangle", php_label->label->maxoverlapangle, value)
                                                      else IF_SET_LONG("priority", php_label->label->priority, value)
                                                        else IF_SET_DOUBLE("maxscaledenom", php_label->label->maxscaledenom, value)
                                                          else IF_SET_DOUBLE("minscaledenom", php_label->label->minscaledenom, value)
                                                            else if ( (STRING_EQUAL("color", property)) ||
                                                                      (STRING_EQUAL("outlinecolor", property)) ||
                                                                      (STRING_EQUAL("leader", property)) ||
                                                                      (STRING_EQUAL("shadowcolor", property)) ) {
                                                              mapscript_throw_exception("Property '%s' is an object and can only be modified through its accessors." TSRMLS_CC, property);
                                                            } else if (STRING_EQUAL("numstyles", property)) {
                                                              mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
                                                            } else {
                                                              mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
                                                            }

}
예제 #5
0
PHP_METHOD(imageObj, __set)
{
    char *property;
    long property_len;
    zval *value;
    zval *zobj = getThis();
    php_image_object *php_image;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_image = (php_image_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_SET_STRING("imagepath", php_image->image->imagepath, value)
    else IF_SET_STRING("imageurl", php_image->image->imageurl, value)
    else IF_SET_STRING("imagetype", php_image->image->format->name, value)
    else if ( (STRING_EQUAL("width", property)) ||
              (STRING_EQUAL("resolution", property)) ||
              (STRING_EQUAL("resolutionfactor", property)) ||
              (STRING_EQUAL("height", property)) )
    {
        mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
    }
    else
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #6
0
파일: shape.c 프로젝트: bradh/mapserver
PHP_METHOD(shapeObj, __set)
{
    char *property;
    long property_len;
    zval *value;
    zval *zobj = getThis();
    php_shape_object *php_shape;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_shape = (php_shape_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_SET_STRING("text", php_shape->shape->text, value)
    else IF_SET_LONG("classindex", php_shape->shape->classindex, value) 
    else IF_SET_LONG("index", php_shape->shape->index, value) 
    else if ( (STRING_EQUAL("type", property)) ||
              (STRING_EQUAL("numlines", property)) ||
              (STRING_EQUAL("tileindex", property)) ||
              (STRING_EQUAL("bounds", property)) ||
              (STRING_EQUAL("values", property)) ||
              (STRING_EQUAL("numvalues", property)) )
    {
        mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
    }
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #7
0
파일: line.c 프로젝트: bradh/mapserver
PHP_METHOD(lineObj, __set)
{
    char *property;
    long property_len;
    zval *value;
    zval *zobj = getThis();
    php_line_object *php_line;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_line = (php_line_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    if (STRING_EQUAL("numpoints", property))
    {
        mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
    }
    else
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #8
0
/* {{{ proto int label.getbinding(const bindingid)
   Get the value of a attribute binding for a specfiled label property.
   Returns the string value if exist, else null. */
PHP_METHOD(labelObj, getBinding)
{
  zval *zobj = getThis();
  long bindingId;
  char *value = NULL;
  php_label_object *php_label;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
                            &bindingId) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_label = MAPSCRIPT_OBJ_P(php_label_object, zobj);

  if (bindingId < 0 || bindingId > MS_LABEL_BINDING_LENGTH) {
    mapscript_throw_exception("Invalid binding id." TSRMLS_CC);
    return;
  }

  if( (value = php_label->label->bindings[bindingId].item) != NULL) {
    MAPSCRIPT_RETURN_STRING(value, 1);
  }

  RETURN_NULL();

}
예제 #9
0
PHP_METHOD(labelCacheMemberObj, __get)
{
    char *property;
    long property_len;
    zval *zobj = getThis();
    php_labelcachemember_object *php_labelcachemember;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_labelcachemember = (php_labelcachemember_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_GET_STRING("text", php_labelcachemember->labelcachemember->text)
    else IF_GET_LONG("classindex", php_labelcachemember->labelcachemember->classindex)
    else IF_GET_LONG("featuresize", php_labelcachemember->labelcachemember->featuresize) 
    else IF_GET_LONG("layerindex", php_labelcachemember->labelcachemember->layerindex) 
    else IF_GET_LONG("numstyles", php_labelcachemember->labelcachemember->numstyles) 
    else IF_GET_LONG("shapeindex", php_labelcachemember->labelcachemember->shapeindex) 
    else IF_GET_LONG("status", php_labelcachemember->labelcachemember->status) 
    else IF_GET_LONG("markerid", php_labelcachemember->labelcachemember->markerid) 
    else IF_GET_LONG("tileindex", php_labelcachemember->labelcachemember->tileindex) 
    else IF_GET_OBJECT("point", mapscript_ce_point, php_labelcachemember->point, &php_labelcachemember->labelcachemember->point) 
    else IF_GET_OBJECT("label", mapscript_ce_label, php_labelcachemember->label, &php_labelcachemember->labelcachemember->label) 
    else IF_GET_OBJECT("styles", mapscript_ce_style, php_labelcachemember->styles, php_labelcachemember->labelcachemember->styles) 
    else IF_GET_OBJECT("poly", mapscript_ce_shape, php_labelcachemember->poly, php_labelcachemember->labelcachemember->poly) 
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #10
0
파일: rect.c 프로젝트: bradh/mapserver
PHP_METHOD(rectObj, __get)
{
    char *property;
    long property_len;
    zval *zobj = getThis();
    php_rect_object *php_rect;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_rect = (php_rect_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_GET_DOUBLE("minx", php_rect->rect->minx)
    else IF_GET_DOUBLE("miny", php_rect->rect->miny) 
    else IF_GET_DOUBLE("maxx", php_rect->rect->maxx) 
    else IF_GET_DOUBLE("maxy", php_rect->rect->maxy) 
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #11
0
파일: shape.c 프로젝트: bradh/mapserver
/* {{{ proto shape __construct(int type)
   Create a new shapeObj instance. */
PHP_METHOD(shapeObj, __construct)
{
    zval *zobj = getThis();
    php_shape_object *php_shape;
    long type;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
                              &type) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_shape = (php_shape_object *)zend_object_store_get_object(zobj TSRMLS_CC);
    
    if ((php_shape->shape = shapeObj_new(type)) == NULL)
    {
        mapscript_throw_exception("Unable to construct shapeObj." TSRMLS_CC);
        return;
    }

    MAKE_STD_ZVAL(php_shape->values);
    array_init(php_shape->values);    
}
예제 #12
0
파일: line.c 프로젝트: AdRiley/mapserver
/* {{{ proto int line.set(int, index, pointObj point)
   Set the point values at the specified index */
PHP_METHOD(lineObj, set)
{
  zval *zobj =  getThis();
  zval *zobj_point;
  long index;
  php_line_object *php_line;
  php_point_object *php_point;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lO",
                            &index, &zobj_point, mapscript_ce_point) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_line = (php_line_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  if ( (index < 0) || (index >= php_line->line->numpoints)) {
    mapscript_throw_exception("Point '%d' does not exist in this object." TSRMLS_CC, index);
    return;
  }

  php_point = (php_point_object *) zend_object_store_get_object(zobj_point TSRMLS_CC);

  php_line->line->point[index].x = php_point->point->x;
  php_line->line->point[index].y = php_point->point->y;

  RETURN_LONG(MS_SUCCESS);
}
예제 #13
0
/* {{{ proto point __construct()
   Create a new pointObj instance. */
PHP_METHOD(pointObj, __construct)
{
  php_point_object *php_point;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters_none() == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_point = (php_point_object *)zend_object_store_get_object(getThis() TSRMLS_CC);

  if ((php_point->point = pointObj_new()) == NULL) {
    mapscript_throw_exception("Unable to construct pointObj." TSRMLS_CC);
    return;
  }

  php_point->point->x = 0;
  php_point->point->y = 0;
#ifdef USE_POINT_Z_M
  php_point->point->z = 0;
  php_point->point->m = 0;
#endif
}
예제 #14
0
PHP_METHOD(pointObj, __set)
{
  char *property;
  long property_len;
  zval *value;
  zval *zobj = getThis();
  php_point_object *php_point;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                            &property, &property_len, &value) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_point = (php_point_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_SET_DOUBLE("x", php_point->point->x, value)
  else IF_SET_DOUBLE("y", php_point->point->y, value)
#ifdef USE_POINT_Z_M
    else IF_SET_DOUBLE("z", php_point->point->z, value)
      else IF_SET_DOUBLE("m", php_point->point->m, value)
#endif
        else {
          mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
        }
}
예제 #15
0
PHP_METHOD(errorObj, __get)
{
  char *property;
  long property_len;
  zval *zobj = getThis();
  php_error_object *php_error;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                            &property, &property_len) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_error = (php_error_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_GET_LONG("code", php_error->error->code)
  else IF_GET_STRING("routine", php_error->error->routine)
    else IF_GET_STRING("message", php_error->error->message)
      else IF_GET_LONG("isreported", php_error->error->isreported)
        else {
          mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
        }
}
예제 #16
0
/* {{{ proto int error.next()
   Returns a ref to the next errorObj in the list, or NULL if we reached the last one */
PHP_METHOD(errorObj, next)
{
  zval *zobj = getThis();
  php_error_object *php_error;
  errorObj *error = NULL;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters_none() == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_error = (php_error_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  if (php_error->error->next == NULL)
    RETURN_NULL();

  /* Make sure 'self' is still valid.  It may have been deleted by
   * msResetErrorList() */
  error = msGetErrorObj();
  while(error != php_error->error) {
    if (error->next == NULL) {
      mapscript_throw_exception("Trying to access an errorObj that has expired." TSRMLS_CC);
      return;
    }
    error = error->next;
  }

  php_error->error = php_error->error->next;
  *return_value = *zobj;
  zval_copy_ctor(return_value);
  INIT_PZVAL(return_value);
}
예제 #17
0
PHP_METHOD(imageObj, __get)
{
    char *property;
    long property_len;
    zval *zobj = getThis();
    php_image_object *php_image;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_image = (php_image_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_GET_LONG("width", php_image->image->width)
    else IF_GET_LONG("height", php_image->image->height)
    else IF_GET_LONG("resolution", php_image->image->resolution)
    else IF_GET_LONG("resolutionfactor", php_image->image->resolutionfactor)
    else IF_GET_STRING("imagepath", php_image->image->imagepath)
    else IF_GET_STRING("imageurl", php_image->image->imageurl)
    else IF_GET_STRING("imagetype", php_image->image->format->name)
    else
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #18
0
/* {{{ proto int label.removebinding(const bindingid)
   Remove attribute binding for a specfiled label property. Returns MS_SUCCESS on success. */
PHP_METHOD(labelObj, removeBinding)
{
  zval *zobj = getThis();
  long bindingId;
  php_label_object *php_label;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
                            &bindingId) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_label = MAPSCRIPT_OBJ_P(php_label_object, zobj);

  if (bindingId < 0 || bindingId > MS_LABEL_BINDING_LENGTH) {
    mapscript_throw_exception("Invalid binding id." TSRMLS_CC);
    return;
  }


  if(php_label->label->bindings[bindingId].item) {
    msFree(php_label->label->bindings[bindingId].item);
    php_label->label->bindings[bindingId].item =  NULL;
    php_label->label->bindings[bindingId].index = -1;
    php_label->label->numbindings--;
  }

  RETURN_LONG(MS_SUCCESS);

}
예제 #19
0
/* {{{ proto int getstyle(int index)
   return the style object. */
PHP_METHOD(labelObj, getStyle)
{
  long index;
  zval *zobj = getThis();
  php_label_object *php_label;
  styleObj *style = NULL;
  parent_object parent;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
                            &index) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_label = MAPSCRIPT_OBJ_P(php_label_object, zobj);

  if (index < 0 || index >= php_label->label->numstyles) {
    mapscript_throw_exception("Invalid style index." TSRMLS_CC);
    return;
  }

  style = php_label->label->styles[index];

  MAPSCRIPT_MAKE_PARENT(zobj, NULL);
  mapscript_create_style(style, parent, return_value TSRMLS_CC);
}
예제 #20
0
파일: cluster.c 프로젝트: AdRiley/mapserver
PHP_METHOD(clusterObj, __set)
{
  char *property;
  long property_len = 0;
  zval *value;
  zval *zobj = getThis();
  php_cluster_object *php_cluster;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                            &property, &property_len, &value) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_cluster = (php_cluster_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_SET_DOUBLE("maxdistance", php_cluster->cluster->maxdistance, value)
  else IF_SET_DOUBLE("buffer", php_cluster->cluster->buffer, value)
    else IF_SET_STRING("region", php_cluster->cluster->region, value)
      else {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
      }
}
예제 #21
0
PHP_METHOD(scalebarObj, __get)
{
  char *property;
  long property_len;
  zval *zobj = getThis();
  php_scalebar_object *php_scalebar;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                            &property, &property_len) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_scalebar = (php_scalebar_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_GET_LONG("height", php_scalebar->scalebar->height)
  else IF_GET_LONG("width", php_scalebar->scalebar->width)
    else IF_GET_LONG("style", php_scalebar->scalebar->style)
      else IF_GET_LONG("intervals", php_scalebar->scalebar->intervals)
        else IF_GET_LONG("units", php_scalebar->scalebar->units)
          else IF_GET_LONG("status", php_scalebar->scalebar->status)
            else IF_GET_LONG("position", php_scalebar->scalebar->position)
              else IF_GET_LONG("postlabelcache", php_scalebar->scalebar->postlabelcache)
                else IF_GET_LONG("align", php_scalebar->scalebar->align)
                  else IF_GET_OBJECT("color", mapscript_ce_color, php_scalebar->color, &php_scalebar->scalebar->color)
                    else IF_GET_OBJECT("backgroundcolor", mapscript_ce_color, php_scalebar->backgroundcolor, &php_scalebar->scalebar->backgroundcolor)
                      else IF_GET_OBJECT("outlinecolor", mapscript_ce_color, php_scalebar->outlinecolor, &php_scalebar->scalebar->outlinecolor)
                        else IF_GET_OBJECT("label", mapscript_ce_label, php_scalebar->label, &php_scalebar->scalebar->label)
                          else IF_GET_OBJECT("imagecolor", mapscript_ce_color, php_scalebar->imagecolor, &php_scalebar->scalebar->imagecolor)
                            else {
                              mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
                            }
}
예제 #22
0
PHP_METHOD(shapeFileObj, __get)
{
  char *property;
  long property_len = 0;
  zval *zobj = getThis();
  php_shapefile_object *php_shapefile;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                            &property, &property_len) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_shapefile = (php_shapefile_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_GET_LONG("numshapes", php_shapefile->shapefile->numshapes)
  else IF_GET_LONG("type", php_shapefile->shapefile->type)
    else IF_GET_LONG("isopen", php_shapefile->shapefile->isopen)
      else IF_GET_LONG("lastshape", php_shapefile->shapefile->lastshape)
        else IF_GET_STRING("source", php_shapefile->shapefile->source)
          else IF_GET_OBJECT("bounds", mapscript_ce_rect, php_shapefile->bounds, &php_shapefile->shapefile->bounds)
            else {
              mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
            }
}
예제 #23
0
파일: shape.c 프로젝트: bradh/mapserver
PHP_METHOD(shapeObj, __get)
{
    char *property;
    long property_len;
    zval *zobj = getThis();
    php_shape_object *php_shape;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_shape = (php_shape_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_GET_STRING("text", php_shape->shape->text)
    else IF_GET_LONG("classindex", php_shape->shape->classindex) 
    else IF_GET_LONG("index", php_shape->shape->index) 
    else IF_GET_LONG("tileindex", php_shape->shape->tileindex) 
    else IF_GET_LONG("numlines", php_shape->shape->numlines) 
    else IF_GET_LONG("numvalues", php_shape->shape->numvalues) 
    else IF_GET_LONG("type", php_shape->shape->type) 
    else IF_GET_OBJECT("bounds", mapscript_ce_rect, php_shape->bounds, &php_shape->shape->bounds) 
    else IF_GET_OBJECT("values", NULL, php_shape->values, NULL) 
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #24
0
PHP_METHOD(OWSRequestObj, __get)
{
    char *property;
    long property_len;
    zval *zobj = getThis();
    php_owsrequest_object *php_owsrequest;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_owsrequest = (php_owsrequest_object *) zend_object_store_get_object(zobj TSRMLS_CC);


    IF_GET_LONG("numparams", php_owsrequest->cgirequest->NumParams)
    else IF_GET_STRING("contenttype", php_owsrequest->cgirequest->contenttype)
    else IF_GET_STRING("postrequest", php_owsrequest->cgirequest->postrequest)
    else IF_GET_STRING("httpcookiedata", php_owsrequest->cgirequest->httpcookiedata)           
    else IF_GET_LONG("type", php_owsrequest->cgirequest->type)
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}
예제 #25
0
파일: shape.c 프로젝트: bradh/mapserver
/* {{{ proto int shape.line(int i)
   Returns line (part) number i.  First line is number 0. */
PHP_METHOD(shapeObj, line)
{
    zval *zobj =  getThis();
    long index;
    php_shape_object *php_shape;
    parent_object parent;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
                              &index) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_shape = (php_shape_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    
    if (index < 0 || index >= php_shape->shape->numlines)
    {
        mapscript_throw_exception("Line '%d' does not exist in this object." TSRMLS_CC, index);
        return;
    }
    
    MAPSCRIPT_MAKE_PARENT(zobj, NULL);
    mapscript_create_line(&(php_shape->shape->line[index]), parent, return_value TSRMLS_CC);
}
예제 #26
0
/* {{{ proto imageObj getImage(outputFormatObj outputformat)
   Get the symbol image */
PHP_METHOD(symbolObj, getImage)
{
    zval *zoutputformat;
    imageObj *image = NULL;
    php_symbol_object *php_symbol;
    php_outputformat_object *php_outputformat;    
    
    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O",
                              &zoutputformat, mapscript_ce_outputformat) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_symbol = (php_symbol_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
    php_outputformat = (php_outputformat_object *)zend_object_store_get_object(zoutputformat TSRMLS_CC);
    image = symbolObj_getImage(php_symbol->symbol, php_outputformat->outputformat);
    if (image == NULL)
    {
        mapscript_throw_exception("Unable to get the symbol image" TSRMLS_CC);
        return;
    }

    mapscript_create_image(image, return_value TSRMLS_CC);
}
예제 #27
0
PHP_METHOD(resultObj, __get)
{
  char *property;
  long property_len = 0;
  zval *zobj = getThis();
  php_result_object *php_result;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                            &property, &property_len) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_result = MAPSCRIPT_OBJ_P(php_result_object, zobj);

  IF_GET_LONG("shapeindex", php_result->result->shapeindex)
  else IF_GET_LONG("tileindex", php_result->result->tileindex)
    else IF_GET_LONG("classindex", php_result->result->classindex)
      else IF_GET_LONG("resultindex", php_result->result->resultindex)
        else {
          mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
        }
}
예제 #28
0
PHP_METHOD(referenceMapObj, __get)
{
    char *property;
    long property_len = 0;
    zval *zobj = getThis();
    php_referencemap_object *php_referencemap;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
                              &property, &property_len) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

    php_referencemap = (php_referencemap_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_GET_STRING("image", php_referencemap->referencemap->image)
    else IF_GET_LONG("width", php_referencemap->referencemap->width)
        else IF_GET_LONG("height", php_referencemap->referencemap->height)
            else IF_GET_LONG("status", php_referencemap->referencemap->status)
                else IF_GET_LONG("marker", php_referencemap->referencemap->marker)
                    else IF_GET_STRING("markername", php_referencemap->referencemap->markername)
                        else IF_GET_LONG("markersize", php_referencemap->referencemap->markersize)
                            else IF_GET_LONG("maxboxsize", php_referencemap->referencemap->maxboxsize)
                                else IF_GET_LONG("minboxsize", php_referencemap->referencemap->minboxsize)
                                    else IF_GET_OBJECT("extent", mapscript_ce_rect, php_referencemap->extent, &php_referencemap->referencemap->extent)
                                        else IF_GET_OBJECT("color", mapscript_ce_color, php_referencemap->color, &php_referencemap->referencemap->color)
                                            else IF_GET_OBJECT("outlinecolor", mapscript_ce_color, php_referencemap->outlinecolor, &php_referencemap->referencemap->outlinecolor)
                                                else {
                                                    mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
                                                }
}
예제 #29
0
파일: color.c 프로젝트: AdRiley/mapserver
PHP_METHOD(colorObj, __set)
{
  char *property;
  long property_len = 0;
  zval *value;
  zval *zobj = getThis();
  php_color_object *php_color;

  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                            &property, &property_len, &value) == FAILURE) {
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    return;
  }
  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);

  php_color = (php_color_object *) zend_object_store_get_object(zobj TSRMLS_CC);

  IF_SET_COLOR("red", php_color->color->red, value)
  else IF_SET_COLOR("green", php_color->color->green, value)
    else IF_SET_COLOR("blue", php_color->color->blue, value)
      else IF_SET_COLOR("alpha", php_color->color->alpha, value)
        else {
          mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
        }

}
예제 #30
0
PHP_METHOD(symbolObj, __set)
{
    char *property;
    long property_len;
    zval *value;
    zval *zobj = getThis();
    php_symbol_object *php_symbol;

    PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
                              &property, &property_len, &value) == FAILURE) {
        PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
        return;
    }
    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
    
    php_symbol = (php_symbol_object *) zend_object_store_get_object(zobj TSRMLS_CC);

    IF_SET_STRING("name", php_symbol->symbol->name, value)
    else IF_SET_LONG("type", php_symbol->symbol->type, value) 
    else IF_SET_LONG("inmapfile", php_symbol->symbol->inmapfile, value) 
    else IF_SET_DOUBLE("sizex", php_symbol->symbol->sizex, value) 
    else IF_SET_DOUBLE("sizey", php_symbol->symbol->sizey, value) 
    else IF_SET_LONG("filled", php_symbol->symbol->filled, value) 
    else IF_SET_LONG("transparent", php_symbol->symbol->transparent, value) 
    else IF_SET_LONG("transparentcolor", php_symbol->symbol->transparentcolor, value) 
    else IF_SET_STRING("character", php_symbol->symbol->character, value)
    else IF_SET_STRING("svg_text", php_symbol->symbol->svg_text, value)             
    else IF_SET_LONG("antialias", php_symbol->symbol->antialias, value) 
    else IF_SET_STRING("font", php_symbol->symbol->font, value)
    else IF_SET_DOUBLE("anchorpoint_y", php_symbol->symbol->anchorpoint_y, value)
    else IF_SET_DOUBLE("anchorpoint_x", php_symbol->symbol->anchorpoint_x, value)             
    else IF_SET_DOUBLE("maxx", php_symbol->symbol->maxx, value)
    else IF_SET_DOUBLE("maxy", php_symbol->symbol->maxy, value)
    else IF_SET_DOUBLE("minx", php_symbol->symbol->minx, value)
    else IF_SET_DOUBLE("miny", php_symbol->symbol->miny, value)                         
    else if ( (STRING_EQUAL("numpoints", property)) ||
         (STRING_EQUAL("imagepath", property)))
    {
        mapscript_throw_exception("Property '%s' is read-only and cannot be set." TSRMLS_CC, property);
    }
    else 
    {
        mapscript_throw_exception("Property '%s' does not exist in this object." TSRMLS_CC, property);
    }
}