예제 #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        public MapInfoWrap(MapInfo settings, UserMapInfo userSettings)
        {
            Debug.Assert(settings != null);
            Debug.Assert(userSettings != null);

            _services = _CreateServices(settings, userSettings);
            _settings = settings;
        }
예제 #2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        private List<MapServiceInfoWrap> _CreateServices(MapInfo settings,
            UserMapInfo userSettings)
        {
            Debug.Assert(settings != null);
            Debug.Assert(userSettings != null);

            if (userSettings.Services == null)
                userSettings.Services = new List<UserMapServiceInfo>();

            List<UserMapServiceInfo> userServices = userSettings.Services;
            List<MapServiceInfoWrap> wrapServices = new List<MapServiceInfoWrap>();

            foreach (MapServiceInfo info in settings.Services)
            {
                if (!String.IsNullOrEmpty(info.Name))
                {
                    UserMapServiceInfo userInfo = _FindServiceInfo(info.Name,
                        userServices);

                    if (userInfo == null)
                    {
                        userInfo = new UserMapServiceInfo();
                        userInfo.Name = info.Name;
                        userInfo.IsVisible = info.IsVisible;
                        userInfo.Opacity = info.Opacity;
                        userServices.Add(userInfo);
                    }

                    MapServiceInfoWrap wrap = new MapServiceInfoWrap(info,
                        userInfo);

                    wrapServices.Add(wrap);
                }
                else
                    Logger.Warning("Map service configuration error: invalid name.");
            }

            return wrapServices;
        }