MapXtreme+Asp.Netダイナミックトラック(オオカミの指摘を求める)

18202 ワード

機能紹介:MapXtreme+Asp.Netの環境下で軌跡再生機能を実現し,2日間の努力を経て基本的に実現した.しかし、一部の問題は解決しなければならない.大神たちに道に迷って、問題は終わりに提出される.
       

<asp:ScriptManager ID="ScriptManager1" runat="server" />
        
        <%-- js    scriptmanager  ,    Sys     --%>
        <script type="text/javascript">
        //  pagerequestmanager       
        //                         
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(TrackPlayBack);
        
        //      
        function TrackPlayBack()
        {
            var myInput1 = document.getElementById("input1");//    X     
            var myInput2 = document.getElementById("input2");
            if(myInput1 != null && myInput2 != null)
            {
                var pointX = myInput1.value.toString();//   X   
                var pointY = myInput2.value.toString();//   Y   
                if(pointX != "" && pointY != "")
                {
                    var mapImage = document.getElementById("MapControl1_Image");//      
                    if(mapImage != null)
                    {
                        //  URL  
                        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();
                       
                        //  Ajax                  
                        var xmlHttp = CreateXMLHttp();
                        xmlHttp.open("GET",url,false);   
                        xmlHttp.send();   
                        mapImage.src = url; 
                    }
                }
            }
         }
        </script>
        
        <cc1: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" />
             MapBaseCommand 
/// <summary>
    ///     
    /// </summary>
    [Serializable]
    public class TrackPlayBack : MapBaseCommand
    {
        private Catalog myCatalog = MapInfo.Engine.Session.Current.Catalog;
        /// <summary>
        ///         
        /// </summary>
        private string animationName = "    ";
        /// <summary>
        ///       Style
        /// </summary>
        private MapInfo.Styles.BitmapPointStyle trackBmpPointStyle = new MapInfo.Styles.BitmapPointStyle("TRUC1-32.BMP", MapInfo.Styles.BitmapStyles.NativeSize, System.Drawing.Color.Blue, 24);

        public TrackPlayBack(string _animationName, MapInfo.Styles.BitmapPointStyle  _trackBmpPointStyle)
        {
            Name = "TrackPlayBack";

            animationName = _animationName;
            trackBmpPointStyle = _trackBmpPointStyle;
        }

        public override void Process()
        {
            //      
            double pointX, pointY;
            double.TryParse(HttpContext.Current.Request["PointX"].ToString(), out pointX);
            double.TryParse(HttpContext.Current.Request["PointY"].ToString(), out pointY);
            //            MapContorlModel  
            MapControlModel myCtrlModel = MapControlModel.GetModelFromSession();
            try
            {
                //      
                Map myMap = myCtrlModel.GetMapObj(MapAlias);
                if(myMap != null)
                {
                    //          
                    MapInfo.Data.Table myTable = myCatalog.GetTable(animationName);
                    if(myTable != null)
                    {
                        #region     
                        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     
                        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 = trackBmpPointStyle;

                        myTable.InsertFeature(myFeature);
                        #endregion
                    }
                }
            }
            finally
            {
                System.IO.MemoryStream ms = myCtrlModel.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat);
                StreamImageToClient(ms);
            }

        }
    }
    

//    Timer                
protected void Timer1_Tick(object sender, EventArgs e)
    {
        double pointX = 4999 + myRandom.NextDouble() * 2;
        double pointY = pointX;

        this.input1.Value = pointX.ToString();
        this.input2.Value = pointY.ToString();
    }

質問:この機能は非同期更新エンティティの位置を採用し、TimerのIntervalを50 ms(さらに小さい)に設定し、IEブラウザの座標点を使用して1-3回/s更新し、検索ブラウザの座標点を使用する更新速度はもっと遅い.どのようにして更新速度を速めることができますか?問題はどこですか?MapXtremeの非同期更新自体の問題でしょうか?