[mapserver-users] Re: layerObj queryByPoint problem

kirill bogdanov bogdanov8 at gmail.com
Thu Nov 24 04:53:48 EST 2011


Here is the code: 

shapefileObj file = new shapefileObj(obj.ShapeFilePath + f, -1);
layer = mapCtrl.mapServerThrd.map.getLayer(0);
layer = layer.clone();
layer.name = obj.ShapeFilePath;
int resss = mapCtrl.mapServerThrd.map.insertLayer(layer, -1);
layer =
mapCtrl.mapServerThrd.map.getLayer(mapCtrl.mapServerThrd.map.numlayers - 1);
layer.type = ShapeFileTypeConvert(file.type);

//layer.type = MS_LAYER_TYPE.MS_LAYER_QUERY;
//shapeObj shape = null;
layer.data = obj.ShapeFilePath + @"\" + f.Substring(1, f.Length - 1);
rectObj extent = new rectObj(0, 0, 0, 0, 0);
mapCtrl.mapServerThrd.map.setExtent(file.bounds.minx, file.bounds.miny,
file.bounds.maxx, file.bounds.maxy);
layer.setExtent(file.bounds.minx, file.bounds.miny, file.bounds.maxx,
file.bounds.maxy);
for (int i = 0; i <= file.numshapes - 1; i++)
                                {
                                    shapeObj shape = file.getShape(i);
                                    int res = layer.addFeature(shape);
                                }
if (layer.type == MS_LAYER_TYPE.MS_LAYER_POINT)
                                {
                                    classObj clas = layer.getClass(0);
                                    styleObj style = clas.getStyle(0);
                                    style.symbol =
mapCtrl.mapServerThrd.map.symbolset.index("circle");
                                    style.size = 10;
                                    style.color = new colorObj(0, 0, 0, 1);
                                }
                                
//layer.template = "template.html";
layer.tolerance = 100;
layer.toleranceunits = (int)MS_UNITS.MS_PIXELS;
classObj cla = layer.getClass(0);
cla.template = @"c:\ms4w\apps\tutorial\htdocs\template.html";
//layer.header = @"c:\ms4w\apps\tutorial\htdocs\header.html";
//layer.footer = @"c:\ms4w\apps\tutorial\htdocs\footer.html";
layer.open();
int r = layer.queryByPoint(mapCtrl.mapServerThrd.map, new
pointObj(55.744047, 55.635645, 0, 0), (int)MS_QUERY_MODE.MS_QUERY_MULTIPLE,
-1);
//int re = layer.queryByShape(mapCtrl.mapServerThrd.map, shape);
int re = layer.queryByRect(mapCtrl.mapServerThrd.map,new
rectObj(-175,-80,175,80,0));
int r1 = mapCtrl.mapServerThrd.map.queryByPoint(new pointObj(55, 55, 0, 0),
(int)MS_QUERY_MODE.MS_QUERY_MULTIPLE, -1);
int r2 = mapCtrl.mapServerThrd.map.queryByRect(new rectObj(-179, -80, 179,
80, 0));
int numres = layer.getNumResults();
if(numres != 0)
resultObj ress = layer.getResult(0);
//int s = ress.shapeindex;
layer.close();
mapCtrl.mapServerThrd.map.save(@"C:\map");
mapCtrl.refreshMap();

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/layerObj-queryByPoint-problem-tp7027251p7027561.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list