コード例 #1
0
ファイル: VPrintCommand.cs プロジェクト: vasnake/cartobonus
        }         // private void cloneMap(ESRI.ArcGIS.Client.Map mapFrom, ESRI.ArcGIS.Client.Map mapTo)

        void onLayersInitialized(object sender, EventArgs args)
        {
            // call from map event. renew RL after load.from.file
            // set timer for recreate RL layer
            try {
                log(string.Format("VPrintImpl.onLayersInitialized"));

                if (mapState == VMapState.Ready)
                {
                    return;
                }

                if (mapState == VMapState.Processing)                // RL refreshed
                {
                    mapState = VMapState.Ready;
                }
                else
                {
                    mapState = VMapState.Loaded;                     // timer will call 'renewRL'
                }
            }
            catch (Exception ex) {
                log(string.Format("VPrintImpl.onLayersInitialized failed, error: {0}", ex.Message));
            }
        }         // void onLayersInitialized(object sender, EventArgs args)
コード例 #2
0
        }         // void Map_MouseMove(object sender, MouseEventArgs e) {

        /// <summary>
        /// On map.LayersInitialized event. Set mapstate=Loaded for renew RLL task
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void Layers_LayersInitialized(object sender, EventArgs args)
        {
            // call from map event. renew RL after load.from.file
            // set timer for recreate RL layer
            try {
                log(string.Format("VRedlineImpl.Layers_LayersInitialized"));
                var gl = MapApplication.Current.Map.Layers[layerID] as GraphicsLayer;
                if (gl == null)
                {
                    return;
                }

                if (mapState == VMapState.Loaded)
                {
                    return;
                }
                if (mapState == VMapState.Processing)
                {
                    mapState = VMapState.Ready;
                    return;
                }

                mapState = VMapState.Loaded;                 // timer will call 'renewRL'
                return;
            }
            catch (Exception ex) {
                log(string.Format("VRedlineImpl.Layers_LayersInitialized, RL init error: {0}", ex.Message));
            }
        }          // void Layers_LayersInitialized(object sender, EventArgs args)
コード例 #3
0
        }         // private GraphicsLayer addRLL2Map(GraphicsLayer rl)

        /// <summary>
        /// If RL layer exists reload RL data and reattach RLL to map.
        /// Called from timer when map layers loaded.
        /// Set mapstate=Processing or Ready
        /// </summary>
        private void renewRL()
        {
            log(string.Format("VRedlineImpl.renewRL"));
            if (mapState != VMapState.Loaded)
            {
                return;
            }
            mapState = VMapState.Processing;

            var lyr = MapApplication.Current.SelectedLayer;

            //load RL content
            var gl = reloadRLData(MapApplication.Current.Map, VRedlineImpl.layerID, VRedlineImpl.layerName);

            if (gl == null)
            {
                mapState = VMapState.Ready;
                log(string.Format("VRedlineImpl.renewRL, RL layer doesn't exists"));
                return;
            }
            log(string.Format("VRedlineImpl.renewRL, symbols restored"));

            // attach RL layer to map in right way
            marks = new GraphicCollection(gl.Graphics);
            MapApplication.Current.Map.Layers.Remove(gl);
            addRLL2Map(gl);

            if (gl.ID == lyr.ID)
            {
                MapApplication.Current.SelectedLayer = gl;
            }
            log(string.Format("VRedlineImpl.renewRL done"));
            return;
        }         // private void renewRL()
コード例 #4
0
        }         // private void evtAfterHideAttrForm(object sender, EventArgs args)

        /// <summary>
        /// Return existing RLL or create new RL graphics layer and add it to map
        /// </summary>
        /// <returns>Redline layer</returns>
        private GraphicsLayer getRLLayer()
        {
            log("VRedlineImpl.getRLLayer");
            mapState = VMapState.Processing;

            //var gl = makeRLLayer(MapApplication.Current.Map, layerID, layerName);
            var gl = MapApplication.Current.Map.Layers[layerID] as GraphicsLayer;

            if (gl != null)
            {
                return(gl);
            }

            gl = createRLLayer(layerID, layerName);
            gl = addRLL2Map(gl);
            return(gl);
        }         // private GraphicsLayer getRLLayer()
コード例 #5
0
ファイル: VPrintCommand.cs プロジェクト: vasnake/cartobonus
        }         // void onLayersInitialized(object sender, EventArgs args)

        /// <summary>
        /// Reload RL data if RL layer exists.
        /// Called from timer when map layers loaded.
        /// Set mapstate=Processing or Ready
        /// </summary>
        private void renewRL(ESRI.ArcGIS.Client.Map map)
        {
            // recreate RL layer, load RL content
            if (mapState != VMapState.Loaded)
            {
                return;
            }
            mapState = VMapState.Processing;
            log(string.Format("VPrintImpl.renewRL"));

            var gl = VRedlineImpl.reloadRLData(map, VRedlineImpl.layerID, VRedlineImpl.layerName);

            if (gl == null)
            {
                mapState = VMapState.Ready;
                log(string.Format("VPrintImpl.renewRL, graphic layer is null"));
            }

            return;
        }         // private void renewRL()
コード例 #6
0
ファイル: VPrintCommand.cs プロジェクト: vasnake/cartobonus
        }         // public void configure()

        void timer_Tick(object sender, EventArgs e)
        {
            // we need timer because of mapEvents invoke layers reload, which invoke mapEvents and so on
            // http://en.wikipedia.org/wiki/Virtual_finite-state_machine
            VMapState t = mapState;

            try {
                if (mapState == VMapState.Loaded)                  // flag set by onLayersInitialized
                {
                    log(string.Format("VPrintImpl.timer_Tick, layers Loaded"));
                    renewRL(frmPrint.Map);
                }
            }
            catch (Exception ex) {
                mapState = VMapState.Unknown;
                log(string.Format("VPrintImpl.timer_Tick, error: {0}", ex.Message));
            }
            if (t == mapState)
            {
                mapState = VMapState.Unknown;
            }
        }          // void timer_Tick(object sender, EventArgs e)