[mapguide-users] Mapguide 3.0 - Ajax viewer - Zoom to selection problem
Jag
jaugusto at phinformatica.pt
Tue Jul 21 03:59:56 PDT 2015
Hi
I was going to report a problem but i found out the solution to it.
So here it is and i hope that this helps someone.
I performed the update to MapGuide 3.0 and zoom to selection,
ExecuteMapAction(10), stopped working in ajax viewer.
I found out that ExecuteMapAction(10) now needs selBounds, an array with the
bounds of the selection.
I changed <u>Search.aspx</u> to send these bounds to function CellClicked of
search.templ:
sel.AddFeatureIds(layer, featureClassName, idProps);
String selText = EscapeForHtml(sel.ToXml());
// **************************
// new lines
MgAgfReaderWriter agfRW = new MgAgfReaderWriter();
string geomPropName = classDef.GetDefaultGeometryPropertyName();
MgByteReader geomReader = features.GetGeometry(geomPropName);
MgGeometry geom = agfRW.Read(geomReader);
MgEnvelope env = geom.Envelope();
double minx = env.LowerLeftCoordinate.X;
double miny = env.LowerLeftCoordinate.Y;
double maxx = env.UpperRightCoordinate.X;
double maxy = env.UpperRightCoordinate.Y;
string Bounds = "";
Bounds = minx.ToString().Replace(',','.')+';'+
miny.ToString().Replace(',','.')+';'+
maxx.ToString().Replace(',','.')+';'+maxy.ToString().Replace(',','.');
// **************************
// changed line
Response.Write(String.Format(" {5}\n", (row % 2) == 0 ? "Search" :
"Search2", row, i, row, selText, val,Bounds));
// **************************
}
Now CellClicked function of <u>search.templ</u> is like this
function CellClicked(sel, bounds)
{
var coord=bounds.split(';');
var ll=GetParent().GetMapFrame();
ll.selBounds = { minx: parseFloat(coord[0]), miny: parseFloat(coord[1]),
maxx: parseFloat(coord[2]), maxy: parseFloat(coord[3]) };
GetParent().SetSelectionXML(sel);
GetParent().ExecuteMapAction(10);
}
Regards
José
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapguide-3-0-Ajax-viewer-Zoom-to-selection-problem-tp5216351.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list