Opened 13 years ago

Last modified 12 years ago

#3634 assigned enhancement

Add funciton layerObj.setItem(...) in MapScript(SWIG/JAVA)

Reported by: rai1000 Owned by: unicoletti
Priority: normal Milestone: 6.2 release
Component: MapScript-Java Version: 5.6
Severity: normal Keywords: java mapscript
Cc: aboudreault, dmorissette, sdlime

Description

Is not possible to set items/atributes to a layerObj in java mapscript, it's possible to do getItems or set class items, but not simlpe items. This items/attributes are showed like a field of every feature in a WFS response.

The function msLayerSetItems in maplayer.c that isn't accessible from mapscript java, although the comments says that is ok.

/* A helper function to set the items to be retrieved with a particular shape. Unused at the moment but will be used from within MapScript. Should not need modification. */ int msLayerSetItems(layerObj *layer, char items, int numitems)

Change History (6)

comment:1 by sdlime, 13 years ago

Component: MapScriptMapScript-Java
Owner: changed from sdlime to unicoletti

comment:2 by unicoletti, 13 years ago

Status: newassigned

Added setItems to the layerObj interface definition in r11741. Needs testing, so I'll leave it open for a while.

comment:3 by dmorissette, 13 years ago

Cc: aboudreault dmorissette added
Milestone: 6.2 release

We should probably add this to PHP MapScript as well, right? (adding Alan to CC)

comment:4 by aboudreault, 13 years ago

Cc: sdlime added

I'm trying to test this function... but I can't get the result I want. I always get all items in my $shape->values. Steve, is my script incorrect? Also, if I move the setItems call below the whichShapes one, I have no more result, nextShape returns null.

<?php
$map = ms_newMapObj("/home/aboudreault/opt/fgs/www/htdocs/maps/gmap-ms46/htdocs/gmap75.map");
 
$layer = $map->getLayerByName("popplace");
$layer->open();

print_r($layer->getItems());

$a = array("name_e", "name_f");
$layer->setItems($a);
$layer->whichshapes($map->extent);
while ($shape = $layer->nextShape())
{
    echo $shape->numvalues."\n";
    print_r($shape->values);
}
$layer->close();
?>

comment:5 by unicoletti, 12 years ago

Can I close this?

comment:6 by dmorissette, 12 years ago

Can someone confirm the expected output for Alan's script?

Note: See TracTickets for help on using tickets.