Mapxtreme + Asp.net Dynamic Track (please kindly advise)

Source: Internet
Author: User

Function Description: implements the track playback function in the mapxtreme + Asp.net environment. After two days of efforts, this function is basically implemented. However, some problems still need to be solved. Please give us some advice and the problem will be raised at the end.

<Asp: scriptmanager id = "scriptmanager1" runat = "server"/> <% -- This js method is written after scriptmanager, prevent sys undefined errors -- %> <SCRIPT type = "text/JavaScript"> // Add an event after obtaining the pagerequestmanager instance // Refresh after synchronous sending or asynchronous sending trigger sys. webforms. pagerequestmanager. getinstance (). add_pageloaded (trackplayback); // function trackplayback () {var myinput1 = document. getelementbyid ("input1"); // controls used to store X coordinates var myinput2 = document. gete Lementbyid ("input2"); If (myinput1! = NULL & myinput2! = NULL) {var pointx = myinput1.value. tostring (); // Map x coordinate point var pointy = myinput2.value. tostring (); // map y coordinate point if (pointx! = "" & Pointy! = "") {Var mapimage = Document. getelementbyid ("mapcontrol1_image"); // obtain the map control if (mapimage! = NULL) {// pass URL data var url = "mapcontroller. ashx? Command = trackplayback & pointx = "+ pointx +" & pointy = "+ pointy +" & mapalias = "+ mapimage. mapalias + "& width =" + mapimage. width + "& Height =" + mapimage. height + "& exportformat =" + mapimage. exportformat + "& Ran =" + math. random (); // use ajax to partially refresh the updated map var XMLHTTP = createxmlhttp (); XMLHTTP. open ("get", URL, false); XMLHTTP. send (); mapimage. src = URL ;}}}</SCRIPT> <PC3: mapcontrol id = "mapcontrol1" runat = "server" width = "800" Height = "600" exportformat = "Jpeg" mapalias = "map1"/> <asp: updatepanel id = "updatepanel1" runat = "server"> <contenttemplate> <input id = "input1" runat = "server" type = "text" style = "width: 200; "/> <input id =" input2 "runat =" server "type =" text "style =" width: 200; "/> <input id =" input3 "runat =" server "type =" text "style =" width: 200; "/> </contenttemplate> <triggers> <asp: asyncpostbacktrigger controlid = "timer1"/> </triggers> </ASP: updatepanel> <asp: timer id = "timer1" runat = "server" enabled = "true" interval = "50" ontick = "timer1_tick"/>
The custom server called in the client mapbasecommand class /// <summary> /// track playback /// </Summary> [serializable] public class trackplayback: mapbasecommand {private catalog mycatalog = MapInfo. engine. session. current. catalog; /// <summary> /// animation playback layer alias /// </Summary> private string animationname = "animation playback "; /// <summary> /// specifies the style of the animation playback element. /// </Summary> private MapInfo. styles. bitmappointstyle trackbmp style = new MapInfo. styles. Bitmappointstyle ("TRUC1-32.BMP", MapInfo. styles. bitmapstyles. nativesize, system. drawing. color. blue, 24); Public trackplayback (string _ animationname, MapInfo. styles. bitmappointstyle _ trackbmp pointstyle) {name = "trackplayback"; animationname = _ animationname; trackbmp pointstyle = _ trackbmp pointstyle;} public override void process () {// obtain the substation Coordinate Double pointx, pointy; double. tryparse (httpcontext. cur Rent. request ["pointx"]. tostring (), Out pointx); double. tryparse (httpcontext. current. request ["Pointy"]. tostring (), Out pointy); // obtain the mapcontorlmodel instance mapcontrolmodel myctrlmodel = mapcontrolmodel that implements and executes various operations. getmodelfromsession (); try {// get map instance map mymap = myctrlmodel. getmapobj (mapalias); If (mymap! = NULL) {// clear the map track playback metadata MapInfo. Data. Table mytable = mycatalog. gettable (animationname); If (mytable! = NULL) {# region clear the searchinfo mysearchinfo = MapInfo. Data. searchinfofactory. searchwhere (""); iresultsetfeaturecollection myiretfeacoll = mycatalog. Search (mytable, mysearchinfo); If (myiretfeacoll! = NULL) {foreach (feature myobj in myiretfeacoll) {mytable. deletefeature (myobj) ;}# endregion # region add the metadata MapInfo. geometry. point mypoint = new MapInfo. geometry. point (mymap. getdisplaycoordsys (), new MapInfo. geometry. dpoint (pointx, pointy); feature myfeature = new feature (mytable. tableinfo. columns); myfeature. geometry = mypoint; myfeature. style = trackbmp pointstyle; mytable. insertfeature (myfeature); # endregion }}finally {system. io. the memorystream MS = myctrlmodel. getmap (mapalias, mapwidth, mapheight, exportformat); streamimagetoclient (MS );}}}
Background code // here the point generated by the timer simulation is used as the coordinate point of the Dynamic Track protected void timereffectick (Object sender, eventargs e) {double pointx = 4999 + myrandom. nextdouble () * 2; double pointy = pointx; this. input1.value = pointx. tostring (); this. input2.value = pointy. tostring ();}

Problem: This function uses the asynchronous update of the element location, and sets the timer interval to 50 ms (or even smaller). The update speed of coordinate points in IE browser is 1-3 times/s, the update speed of coordinate points in sogou browser is slower. How can we make updates faster? Where is the problem? Is mapxtreme asynchronous update itself a problem?

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.