Select to view content in your preferred language

Search Widget Select - Select by point on Point Feature - 0 Features Selected - 2.1

483
2
10-15-2010 11:56 AM
FrankRoberts
Occasional Contributor III
I've got the 2.1 Flex Viewer Search Widget working, both the query and select with box and poly work dandy!  However, for some reason I can't "select by point" on a point data set.  When I do this I just get the "Features selected: 0".  I can click all over the place and can't seem to get it to select anything with this part of the tool.

Any ideas on this?
Frank
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Frank,

   Look here for the code that you will need to put into the searchWidget.

http://forums.esri.com/Thread.asp?c=158&f=2421&t=295461&mc=2#msgid921902
0 Kudos
FrankRoberts
Occasional Contributor III
As always  - You the man!!

Robert can you please provide your favorite lunch place in your town, I'll get you a gift certificate or have it delivered!!

I added:

import com.esri.ags.geometry.Extent;

And then swapped out the original searchDrawEnd with Robert's code below:

private function searchDrawEnd(event:DrawEvent):void
   {
    var geom:Geometry = event.graphic.geometry;
    if(geom.type == Geometry.MAPPOINT)
    {
     //Expand the point by 5 pixels
     var point:MapPoint = geom as MapPoint;
     var xMin:Number = map.toScreen(point).x - 2.5;
     var yMin:Number = map.toScreen(point).y - 2.5;
     var xMax:Number = map.toScreen(point).x + 2.5;
     var yMax:Number = map.toScreen(point).y + 2.5;
     var mp1:MapPoint = map.toMap(new Point(xMin,yMin));
     var mp2:MapPoint = map.toMap(new Point(xMax,yMax));
     var ext:Extent = new Extent(mp1.x, mp1.y, mp2.x, mp2.y);
     var pA:Array = [];
                 var pPoly:Polygon = new Polygon(null,geom.spatialReference);
              pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference));
              pA.push(new MapPoint(ext.xmin,ext.ymax,geom.spatialReference));
              pA.push(new MapPoint(ext.xmax,ext.ymax,geom.spatialReference));
              pA.push(new MapPoint(ext.xmax,ext.ymin,geom.spatialReference));
              pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference));
     pPoly.addRing(pA);
     queryFeaturesGraphical(pPoly);
    } else {
     queryFeaturesGraphical(geom);
    }
   }
0 Kudos