public void SetLocation (MapLocation toLocation)
		{
			var targetLocation = toLocation.Location.To2D();
			if (toLocation.Location.X == 0 && toLocation.Location.Y == 0)
			{
				// use the 'location manager' current coordinate
				if (locationManager.Location == null)
				{
					return;
				}
				{	// catch a possible null reference that i saw once [CD]
					targetLocation = locationManager.Location.Coordinate;
					ConferenceAnnotation a = new ConferenceAnnotation(targetLocation, "My location", "");
					mapView.AddAnnotationObject(a); 
				}
			}
			else if (toLocation.Title == conf.Location.Title)
			{
				// no need to drop anything
			}
			else
			{
				// drop a new pin
				ConferenceAnnotation a = new ConferenceAnnotation(toLocation.Location.To2D(), toLocation.Title,toLocation.Subtitle);
				mapView.AddAnnotationObject(a); 
			}
			mapView.CenterCoordinate = targetLocation;
		}
Esempio n. 2
0
        public static bool GetRegistryLocation(MapLocation which, ref RegistryHive hive, ref string keyname, ref string valuename)
        {
            hive = RegistryHive.CurrentUser;

            switch (which)
            {
                case MapLocation.LocalMachineKeyboardLayout:
                    hive = RegistryHive.LocalMachine;
                    keyname = @"SYSTEM\CurrentControlSet\Control\Keyboard Layout";
                    valuename = "Scancode Map";
                    break;
              case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                    keyname = AppController.ApplicationRegistryKeyName;
                    valuename = "BootMaps";
                    break;
              case MapLocation.KeyMapperVistaMappingsCache:
                    keyname = AppController.ApplicationRegistryKeyName;
                    valuename = "VistaBootCache";
                    break;
                default:
                    return false;
            }

            return true;
        }
Esempio n. 3
0
        public List<MapLocation> Getlocs()
        {
            string pathToDatabase = ((GlobalvarsApp)CallingActivity).DATABASE_PATH;

            locs = new List<MapLocation> ();
            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                var list1 = db.Table<GeoLocation> ().Where(x=>x.isUploaded==false)
                    .OrderBy(x=>x.Date)
                    .Take(30)
                    .ToList<GeoLocation> ();

                foreach (GeoLocation loc in list1) {
                    MapLocation bill = new MapLocation ();
                    bill.UID = loc.ID;
                    bill.Altitude = loc.Altitude;
                    bill.Date = loc.Date;
                    bill.Heading = loc.Heading;
                    bill.Lat = loc.lat;
                    bill.Lng = loc.lng;

                    locs.Add (bill);
                }
            }

            return locs;
        }
Esempio n. 4
0
        public void AdjacentLocationsFromMapLocation()
        {
            Location loc = new MapLocation (new Map (), new Point (5, 5));
            List<Location> adj_locs =
                new List<Location> (loc.AdjacentLocations);

            Assert.AreEqual (8, adj_locs.Count);

            CollectionAssert.Contains (adj_locs,
                Direction.North.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.NorthEast.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.East.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.SouthEast.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.South.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.SouthWest.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.West.ApplyTo (loc));
            CollectionAssert.Contains (adj_locs,
                Direction.NorthWest.ApplyTo (loc));
        }
Esempio n. 5
0
        public void MapLocationEquality()
        {
            Location loc1 = new MapLocation (new Map (), Point.Zero);
            Location loc2 = new MapLocation (loc1);

            Assert.IsTrue (loc1.Equals (loc2));
            Assert.IsTrue (loc1 == loc2);
            Assert.IsFalse (loc1 != loc2);
        }
 public void InsertOrUpdate(MapLocation maplocation)
 {
     if (maplocation.Id == default(int)) {
         // New entity
         context.MapLocations.Add(maplocation);
     } else {
         // Existing entity
         context.Entry(maplocation).State = EntityState.Modified;
     }
 }
Esempio n. 7
0
 public void SetDestination(MapLocation loc)
 {
     try
     {
         destinationMap.Center = loc.Point;
         destinationMap.ZoomLevel = 12;
     }
     catch (Exception e)
     {
         //exeption
     }
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        public DefaultStateMachine_WORLD()
        {
            //MVN_PLN must have loc0 as a location in the map
            _EntranceLocation = new MapLocation("loc0");
            _ObjectTableLocation = new MapLocation("loc1");
            _DropTableLocation = new MapLocation("loc2");
            _LeaveLocation = new MapLocation("loc3");

            _TableArrivedMessage = "I have arrived to the object location.";
            _ArmsNavigationPosition = "standby";
            _ArmsDefaultPosition = "home";
            _ArmsObjectTakenPosition = "navigation";
        }
Esempio n. 9
0
 public void OnPositionChanged()
 {
     if (LevelMap.main == null) return;
     int p = LevelMap.main.IsVisible(previousLocationConnector);
     int n = LevelMap.main.IsVisible(nextLocationConnector);
     if (n != 0 && p != 0 && p == n) {
         LevelMap.main.RemoveLocation(this);
         Destroy(gameObject);
         return;
     }
     if (nextLocation == null) {
         if (n == 0) {
             nextLocation = LevelMap.main.ShowNextLocation(this);
         }
     }
     if (previousLocation == null) {
         if (p == 0) {
             previousLocation = LevelMap.main.ShowPreviuosLocation(this);
         }
     }
 }
Esempio n. 10
0
        public async Task<BitmapImage> GetStreetviewImage(MapLocation location)
        {
            // string url = $"https://maps.googleapis.com/maps/api/streetview?size=800x600&&fov=90&heading=200&pitch=0";

            //string url = $"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={location.Point.Position.Latitude},{location.Point.Position.Longitude}&radius=500&keyword=monument";
            
            string placesUrl = $"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={location.Point.Position.Latitude},{location.Point.Position.Longitude}&radius=500&type=park&key=AIzaSyBHZBLrtywOoyYjlYn2FSi_Ueia76VwL5U";

            HttpWebRequest request = WebRequest.CreateHttp(new Uri(placesUrl, UriKind.Absolute));
            request.ContentType = "application/json";
            request.Accept = "application/json";
            request.Method = "GET";
            var response = await request.GetResponseAsync();
            var reader = new StreamReader(response.GetResponseStream());
            Debug.WriteLine(placesUrl);
            var deserializedObject = JsonConvert.DeserializeObject<dynamic>(reader.ReadToEnd());


            foreach (var v in deserializedObject.results)
            {
                if (v.photos != null)
                {
                    foreach (var photo in v.photos)
                    {
                        var refer = photo.photo_reference;
                        string imageUrl = $"https://maps.googleapis.com/maps/api/place/photo?maxwidth=1200&photoreference={refer}&key=AIzaSyBHZBLrtywOoyYjlYn2FSi_Ueia76VwL5U";
                        Debug.WriteLine("Image URL: " + imageUrl);
                        BitmapImage bi = new BitmapImage(new Uri(imageUrl, UriKind.Absolute));
                        return bi;
                    }
                }
            }






            return null;
        }
Esempio n. 11
0
        public static byte[] GetScancodeMapFromRegistry(MapLocation which)
        {
            RegistryKey registry = null;
            RegistryHive hive = RegistryHive.CurrentUser;
            string keyname = string.Empty;
            string valuename = string.Empty;

            if (GetRegistryLocation(which, ref hive, ref keyname, ref valuename))
            {
                switch (hive)
                {
                    case RegistryHive.LocalMachine:
                        registry = Registry.LocalMachine.OpenSubKey(keyname);
                        break;
                    case RegistryHive.CurrentUser:
                        registry = Registry.CurrentUser.OpenSubKey(keyname);
                        break;
                }
            }

            if (registry == null)
                return null;

            object keyvalue = registry.GetValue(valuename, null);

            if (keyvalue == null ||
                registry.GetValueKind(valuename) != RegistryValueKind.Binary ||
                keyvalue.GetType() != Type.GetType("System.Byte[]"))
            {
                // Not there, or not the right type.
                return null;
            }

            // Can't see how this cast can fail, shrug, will return null anyway.
            byte[] bytecodes = keyvalue as byte[];

            return bytecodes;
        }
Esempio n. 12
0
            private List<Connection> getLegalConnections(
			LocationData[,] map, int tileFrom,
			bool isBombPassable, bool isDestructiblePassable)
            {
                List<Connection> connections = new List<Connection> ();

                int mapWidth = this.gs.Width;
                int mapHeight = this.gs.Height;

                Coords coords = Coords.coordsTileNum (mapWidth, mapHeight, tileFrom);

                List<Coords> possibleCoords = this.gs.GetAdjacentAccessibleTiles (
                tileFrom, isBombPassable, isDestructiblePassable);

                foreach (Coords possibleCoord in possibleCoords) {
                    Node from = new MapLocation (coords);
                    Node to = new MapLocation (possibleCoord);
                    Connection conn = new Connection (from, to, MOVEMENT_COST + this.gs.tacticalCost(possibleCoord));
                    connections.Add (conn);
                }

                return connections;
            }
Esempio n. 13
0
 public LocationSuggestion(MapLocation location)
 {
     Location = location;
 }
Esempio n. 14
0
 public Path(MapLocation[] path)
 {
     _path = path;
 }
        /// <summary>
        /// Adds the MVN-PLN location (name, x,y and theta) to the locations dictionary.
        /// </summary>
        /// <param name="locationName"></param>
        /// <returns>the name of the MVN-PLN location</returns>
        public string addTableLocation(string tableNumber)
        {
            MapLocation tableLocation = new MapLocation("table"+tableNumber, tableNumber);
            tableNumber_mapPosition.Add(tableNumber, tableLocation);

            return tableLocation.Name;
        }
Esempio n. 16
0
 public bool InRangeOf(MapLocation location, int range)
 {
     return(DistanceTo(location) <= range);
 }
Esempio n. 17
0
 public PowerTower(MapLocation location, Path path) : base(location, path)
 {
 }
Esempio n. 18
0
 public void AddAccuracyCircle(MapLocation location, double radius, int segments, GeoLocationCircleOptions options) {
 }
Esempio n. 19
0
		public SelectedTileChangedEventArgs(MapLocation newSelected, IMapTile selectedTile)
		{
			this.newSelected = newSelected;
			this.selectedTile = selectedTile;
		}
Esempio n. 20
0
 public ItemShopSlot(int address, string name, MapLocation mapLocation, Item item)
     : base(address, name, mapLocation, item)
 {
 }
Esempio n. 21
0
 public TreasureChest(int address, string name, MapLocation mapLocation, Item item,
                      AccessRequirement accessRequirement = AccessRequirement.None,
                      bool isUnused = false)
     : base(address, name, mapLocation, item, accessRequirement, isUnused)
 {
 }
        public ShipPlacementResponse PlaceShip(Guid boardId, MapLocation locationFrom, MapLocation locationTo)
        {
            ServiceResponse response = null;

            var board = Boards.FirstOrDefault(b => b.Id == boardId);

            if (board != null)
            {
                Ship ship = null;
                //Normalize From To // Left TO Right // topToBottom
                if (locationFrom.Letter == locationTo.Letter) //If user passes reversed ship  H2->C2 - we should reverse it and place ship as C2 To h2
                {
                    if (locationFrom.Number <= locationTo.Number)
                    {
                        ship = new Ship(new MapLocation(locationFrom.Letter, locationFrom.Number), new MapLocation(locationTo.Letter, locationTo.Number));  //all good
                    }
                    else
                    {
                        ship = new Ship(new MapLocation(locationFrom.Letter, locationTo.Number), new MapLocation(locationTo.Letter, locationFrom.Number)); //reverse in Numbers direction
                    }
                }
                else if (locationFrom.Number == locationTo.Number)
                {
                    if (locationFrom.Letter <= locationTo.Letter)
                    {
                        ship = new Ship(new MapLocation(locationFrom.Letter, locationFrom.Number), new MapLocation(locationTo.Letter, locationTo.Number)); //all good
                    }
                    else
                    {
                        ship = new Ship(new MapLocation(locationTo.Letter, locationFrom.Number), new MapLocation(locationFrom.Letter, locationTo.Number)); //reverse in Letters direction
                    }
                }

                return(board.PlaceShip(ship));
            }
            return(new ShipPlacementResponse {
                IsSuccess = false, ReasonFailed = "Board has not been found"
            });
        }
Esempio n. 23
0
 public void SetLocation(MapLocation value)
 {
     _location = value;
 }
Esempio n. 24
0
 public TeleportDestination(MapLocation destination, MapIndex index, Coordinate coordinates, ExitTeleportIndex exit)
     : this(destination, index, coordinates, exits : exit)
 {
 }
Esempio n. 25
0
 public TeleportDestination(MapLocation destination, MapIndex index, Coordinate coordinates, TeleportIndex teleport)
     : this(destination, index, coordinates, new List <TeleportIndex> {
     teleport
 })
 {
 }
Esempio n. 26
0
        private static void GetMappingsFromRegistry(MapLocation location)
        {
            var mappings = new Collection<KeyMapping>();

            MappingType type = MappingType.Null;
            switch (location)
            {
                case MapLocation.LocalMachineKeyboardLayout:
                case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                    type = MappingType.Boot;
                    break;
                case MapLocation.CurrentUserKeyboardLayout:
                case MapLocation.KeyMapperCurrentUserKeyboardLayout:
                    type = MappingType.User;
                    break;
            }


            byte[] map = RegistryProvider.GetScancodeMapFromRegistry(location);

            if (map != null)
                mappings = GetMappingsFromScancodeMap(map, type);

            switch (location)
            {
                case MapLocation.LocalMachineKeyboardLayout:
                    _bootMappings = mappings;
                    break;
                case MapLocation.CurrentUserKeyboardLayout:
                    _userMappings = mappings;
                    break;
                case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                    _savedBootMappings = mappings;
                    break;
                case MapLocation.KeyMapperCurrentUserKeyboardLayout:
                    _savedUserMappings = mappings;
                    break;
                default:
                    break;
            }
        }
 public AddressSearchSuggestionItem(MapLocation location)
 {
     Point = location.Point;
     _location = location;
 }
Esempio n. 28
0
        private async void AddressTbx_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync(args.QueryText, new Geopoint(new BasicGeoposition() {
                Latitude = 10.762689,
                Longitude = 106.6823399
            }), 1);

            if (result.Status == MapLocationFinderStatus.Success)
            {
                MapIcon icon = new MapIcon();
                icon.Location = result.Locations[0].Point;
                icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
                icon.Title = result.Locations[0].Address.FormattedAddress;
                location = result.Locations[0];

                LocationMap.MapElements.Clear();
                LocationMap.MapElements.Add(icon);
                LocationMap.Center = result.Locations[0].Point;
            }
        }
Esempio n. 29
0
 public override void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
 {
     _mapTile = (XCMapTile)e.SelectedTile;
     _lastLoc = e.MapPosition;
     Refresh();
 }
        private static string getAddress(MapLocation mapLocation)
        {
            string Address = "";
            string region = MapHelper.getRegion(mapLocation);
            string city = mapLocation.Information.Address.City;
            string country = mapLocation.Information.Address.Country;

            if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(city) && string.IsNullOrEmpty(country))
                Address = "";
            else if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(city))
                Address = country;
            else if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(country))
                Address = city;
            else if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(country))
                Address = region;
            else if (string.IsNullOrEmpty(region))
                Address = string.Format("{0}, {1} ", city, country);
            else if (string.IsNullOrEmpty(city))
                Address = string.Format("{0}, {1} ", region, country);
            else if (string.IsNullOrEmpty(country))
                Address = string.Format("{0}, {1} ", city, region);
            else
                Address = string.Format("{0}, {1}, {2} ", city, region, country);

            return Address;
        }
Esempio n. 31
0
		/// <summary>
		/// Get/Set a MapTile using a MapLocation 
		/// </summary>
		/// <param name="location"></param>
		/// <returns></returns>
		public IMapTile this[MapLocation location]
		{
			get { return this[location.Row, location.Col, location.Height]; }
			set { this[location.Row, location.Col, location.Height] = value; }
		}
Esempio n. 32
0
        private static void GetMappingsFromRegistry(MapLocation location)
        {
            var mappings = new Collection<KeyMapping>();

            byte[] map = RegistryProvider.GetScancodeMapFromRegistry(location);

            if (map != null)
                mappings = GetMappingsFromScancodeMap(map);

            switch (location)
            {
                case MapLocation.LocalMachineKeyboardLayout:
                    MappingsManager.mappings = mappings;
                    break;
                case MapLocation.KeyMapperLocalMachineKeyboardLayout:
                    savedBootMappings = mappings;
                    break;
                default:
                    throw new InvalidOperationException("Unknown value for MapLocation: " + location);
            }
        }
Esempio n. 33
0
 public Tower(MapLocation Location)
 {
     _location = Location;
 }
 public static string getRegion( MapLocation mapLocation)
 {
     string region = "";
     region = string.IsNullOrEmpty(region) ? mapLocation.Information.Address.Province : region;
     region = string.IsNullOrEmpty(region) ? mapLocation.Information.Address.County : region;
     region = string.IsNullOrEmpty(region) ? mapLocation.Information.Address.State : region;
     region = string.IsNullOrEmpty(region) ? mapLocation.Information.Address.District : region;
     return region;
 }
Esempio n. 35
0
        public IncentiveData(MT19337 rng, IIncentiveFlags flags, OverworldMap map, ItemShopSlot shopSlot)
        {
            Dictionary <MapLocation, Tuple <List <MapChange>, AccessRequirement> > fullLocationRequirements = map.FullLocationRequirements;
            var forcedItemPlacements = ItemLocations.AllOtherItemLocations.ToList();

            if (!flags.NPCItems)
            {
                forcedItemPlacements.AddRange(ItemLocations.AllNPCFreeItemLocationsExcludingVendor);
                forcedItemPlacements.Add(shopSlot);
            }
            if (!flags.NPCFetchItems)
            {
                forcedItemPlacements.AddRange(ItemLocations.AllNPCFetchItemLocations);
            }
            if (!flags.Treasures)
            {
                forcedItemPlacements.AddRange(ItemLocations.AllTreasures);
            }
            var incentivePool = new List <Item>();

            if (flags.IncentivizeBridge)
            {
                incentivePool.Add(Item.Bridge);
            }
            if (flags.IncentivizeShip)
            {
                incentivePool.Add(Item.Ship);
            }
            if (flags.IncentivizeCanal)
            {
                incentivePool.Add(Item.Canal);
            }
            if (flags.IncentivizeLute)
            {
                incentivePool.Add(Item.Lute);
            }
            if (flags.IncentivizeCrown)
            {
                incentivePool.Add(Item.Crown);
            }
            if (flags.IncentivizeCrystal)
            {
                incentivePool.Add(Item.Crystal);
            }
            if (flags.IncentivizeHerb)
            {
                incentivePool.Add(Item.Herb);
            }
            if (flags.IncentivizeKey)
            {
                incentivePool.Add(Item.Key);
            }
            if (flags.IncentivizeTnt)
            {
                incentivePool.Add(Item.Tnt);
            }
            if (flags.IncentivizeAdamant)
            {
                incentivePool.Add(Item.Adamant);
            }
            if (flags.IncentivizeSlab)
            {
                incentivePool.Add(Item.Slab);
            }
            if (flags.IncentivizeRuby)
            {
                incentivePool.Add(Item.Ruby);
            }
            if (flags.IncentivizeRod)
            {
                incentivePool.Add(Item.Rod);
            }
            if (flags.IncentivizeFloater)
            {
                incentivePool.Add(Item.Floater);
            }
            if (flags.IncentivizeChime)
            {
                incentivePool.Add(Item.Chime);
            }
            if (flags.IncentivizeTail)
            {
                incentivePool.Add(Item.Tail);
            }
            if (flags.IncentivizeCube)
            {
                incentivePool.Add(Item.Cube);
            }
            if (flags.IncentivizeBottle)
            {
                incentivePool.Add(Item.Bottle);
            }
            if (flags.IncentivizeOxyale)
            {
                incentivePool.Add(Item.Oxyale);
            }
            if (flags.IncentivizeCanoe)
            {
                incentivePool.Add(Item.Canoe);
            }

            if (flags.IncentivizeXcalber)
            {
                incentivePool.Add(Item.Xcalber);
            }
            if (flags.IncentivizeMasamune)
            {
                incentivePool.Add(Item.Masamune);
            }
            if (flags.IncentivizeRibbon)
            {
                incentivePool.Add(Item.Ribbon);
            }
            if (flags.IncentivizeRibbon2)
            {
                incentivePool.Add(Item.Ribbon);
            }
            if (flags.IncentivizeOpal)
            {
                incentivePool.Add(Item.Opal);
            }
            if (flags.Incentivize65K)
            {
                incentivePool.Add(Item.Gold65000);
            }
            if (flags.IncentivizeBad)
            {
                incentivePool.Add(Item.Cloth);
            }
            if (flags.IncentivizeDefCastArmor)
            {
                incentivePool.Add(Item.WhiteShirt);
            }
            if (flags.IncentivizeOffCastArmor)
            {
                incentivePool.Add(Item.BlackShirt);
            }
            if (flags.IncentivizeOtherCastArmor)
            {
                incentivePool.Add(Item.PowerGauntlets);
            }
            if (flags.IncentivizeDefCastWeapon)
            {
                incentivePool.Add(Item.Defense);
            }
            if (flags.IncentivizeOffCastWeapon)
            {
                incentivePool.Add(Item.ThorHammer);
            }
            if (flags.IncentivizeOtherCastWeapon)
            {
                incentivePool.Add(Item.BaneSword);
            }

            var incentiveLocationPool = new List <IRewardSource>();

            if (flags.IncentivizeKingConeria)
            {
                incentiveLocationPool.Add(ItemLocations.KingConeria);
            }
            if (flags.IncentivizePrincess)
            {
                incentiveLocationPool.Add(ItemLocations.Princess);
            }
            if (flags.IncentivizeMatoya)
            {
                incentiveLocationPool.Add(ItemLocations.Matoya);
            }
            if (flags.IncentivizeBikke)
            {
                incentiveLocationPool.Add(ItemLocations.Bikke);
            }
            if (flags.IncentivizeElfPrince)
            {
                incentiveLocationPool.Add(ItemLocations.ElfPrince);
            }
            if (flags.IncentivizeAstos)
            {
                incentiveLocationPool.Add(ItemLocations.Astos);
            }
            if (flags.IncentivizeNerrick)
            {
                incentiveLocationPool.Add(ItemLocations.Nerrick);
            }
            if (flags.IncentivizeSmith)
            {
                incentiveLocationPool.Add(ItemLocations.Smith);
            }
            if (flags.IncentivizeSarda)
            {
                incentiveLocationPool.Add(ItemLocations.Sarda);
            }
            if (flags.IncentivizeCanoeSage)
            {
                incentiveLocationPool.Add(ItemLocations.CanoeSage);
            }
            if (flags.IncentivizeCubeBot)
            {
                incentiveLocationPool.Add(ItemLocations.CubeBot);
            }
            if (flags.IncentivizeFairy)
            {
                incentiveLocationPool.Add(ItemLocations.Fairy);
            }
            if (flags.IncentivizeLefein)
            {
                incentiveLocationPool.Add(ItemLocations.Lefein);
            }
            if (flags.IncentivizeVolcano)
            {
                incentiveLocationPool.Add(ItemLocations.VolcanoMajor);
            }
            if (flags.IncentivizeEarth)
            {
                incentiveLocationPool.Add(ItemLocations.EarthCaveMajor);
            }
            if (flags.IncentivizeMarsh)
            {
                incentiveLocationPool.Add(ItemLocations.MarshCaveMajor);
            }
            if (flags.IncentivizeMarshKeyLocked)
            {
                incentiveLocationPool.Add(ItemLocations.MarshCave13);
            }
            if (flags.IncentivizeSkyPalace)
            {
                incentiveLocationPool.Add(ItemLocations.SkyPalaceMajor);
            }
            if (flags.IncentivizeSeaShrine)
            {
                incentiveLocationPool.Add(ItemLocations.SeaShrineMajor);
            }
            if (flags.IncentivizeConeria)
            {
                incentiveLocationPool.Add(ItemLocations.ConeriaMajor);
            }
            if (flags.IncentivizeIceCave)
            {
                incentiveLocationPool.Add(ItemLocations.IceCaveMajor);
            }
            if (flags.IncentivizeOrdeals)
            {
                incentiveLocationPool.Add(ItemLocations.OrdealsMajor);
            }
            if (flags.IncentivizeCaravan)
            {
                incentiveLocationPool.Add(ItemLocations.CaravanItemShop1);
            }
            if (flags.IncentivizeTitansTrove)
            {
                incentiveLocationPool.Add(ItemLocations.TitansTunnel1);
            }
            var itemLocationPool =
                ItemLocations.AllTreasures.Concat(ItemLocations.AllNPCItemLocations)
                .Where(x => !x.IsUnused && !forcedItemPlacements.Any(y => y.Address == x.Address))
                .ToList();

            if (flags.EarlyOrdeals)
            {
                forcedItemPlacements =
                    forcedItemPlacements
                    .Select(x => ((x as TreasureChest)?.AccessRequirement.HasFlag(AccessRequirement.Crown) ?? false)
                                                                ? new TreasureChest(x, x.Item, x.AccessRequirement & ~AccessRequirement.Crown)
                                                                : x).ToList();
                itemLocationPool =
                    itemLocationPool
                    .Select(x => ((x as TreasureChest)?.AccessRequirement.HasFlag(AccessRequirement.Crown) ?? false)
                                                                ? new TreasureChest(x, x.Item, x.AccessRequirement & ~AccessRequirement.Crown)
                                                                : x).ToList();
                incentiveLocationPool =
                    incentiveLocationPool
                    .Select(x => ((x as TreasureChest)?.AccessRequirement.HasFlag(AccessRequirement.Crown) ?? false)
                                                        ? new TreasureChest(x, x.Item, x.AccessRequirement & ~AccessRequirement.Crown)
                                                        : x).ToList();
            }
            if (flags.EarlySage)
            {
                forcedItemPlacements =
                    forcedItemPlacements
                    .Select(x => x.Address == ItemLocations.CanoeSage.Address
                                                                        ? new MapObject(ObjectId.CanoeSage, MapLocation.CrescentLake, x.Item)
                                                                        : x).ToList();
                itemLocationPool =
                    itemLocationPool
                    .Select(x => x.Address == ItemLocations.CanoeSage.Address
                                                                        ? new MapObject(ObjectId.CanoeSage, MapLocation.CrescentLake, x.Item)
                                                                        : x).ToList();
                incentiveLocationPool =
                    incentiveLocationPool
                    .Select(x => x.Address == ItemLocations.CanoeSage.Address
                                                                        ? new MapObject(ObjectId.CanoeSage, MapLocation.CrescentLake, x.Item)
                                                                        : x).ToList();
            }
            if (flags.EarlySarda)
            {
                forcedItemPlacements =
                    forcedItemPlacements
                    .Select(x => x.Address == ItemLocations.Sarda.Address
                                                                ? new MapObject(ObjectId.Sarda, MapLocation.SardasCave, x.Item)
                                                                : x).ToList();
                itemLocationPool =
                    itemLocationPool
                    .Select(x => x.Address == ItemLocations.Sarda.Address
                                                                ? new MapObject(ObjectId.Sarda, MapLocation.SardasCave, x.Item)
                                                                : x).ToList();
                incentiveLocationPool =
                    incentiveLocationPool
                    .Select(x => x.Address == ItemLocations.Sarda.Address
                                                                ? new MapObject(ObjectId.Sarda, MapLocation.SardasCave, x.Item)
                                                                : x).ToList();
            }

            MapLocation elfDoctorLocation = map.ObjectiveNPCs[ObjectId.ElfDoc];

            if (elfDoctorLocation != MapLocation.ElflandCastle)
            {
                forcedItemPlacements =
                    forcedItemPlacements
                    .Select(x => x.Address == ItemLocations.ElfPrince.Address
                                                                ? new MapObject(ObjectId.ElfPrince, MapLocation.ElflandCastle, x.Item, AccessRequirement.Herb, ObjectId.ElfDoc, requiredSecondLocation: elfDoctorLocation)
                                                                : x).ToList();
                itemLocationPool =
                    itemLocationPool
                    .Select(x => x.Address == ItemLocations.ElfPrince.Address
                                                                ? new MapObject(ObjectId.ElfPrince, MapLocation.ElflandCastle, x.Item, AccessRequirement.Herb, ObjectId.ElfDoc, requiredSecondLocation: elfDoctorLocation)
                                                                : x).ToList();
                incentiveLocationPool =
                    incentiveLocationPool
                    .Select(x => x.Address == ItemLocations.ElfPrince.Address
                                                                ? new MapObject(ObjectId.ElfPrince, MapLocation.ElflandCastle, x.Item, AccessRequirement.Herb, ObjectId.ElfDoc, requiredSecondLocation: elfDoctorLocation)
                                                                : x).ToList();
            }

            MapLocation unneLocation = map.ObjectiveNPCs[ObjectId.Unne];

            if (unneLocation != MapLocation.Melmond)
            {
                forcedItemPlacements =
                    forcedItemPlacements
                    .Select(x => x.Address == ItemLocations.Lefein.Address
                                                                ? new MapObject(ObjectId.Lefein, MapLocation.Lefein, x.Item, AccessRequirement.Slab, ObjectId.Unne, requiredSecondLocation: unneLocation)
                                                                : x).ToList();
                itemLocationPool =
                    itemLocationPool
                    .Select(x => x.Address == ItemLocations.Lefein.Address
                                                                ? new MapObject(ObjectId.Lefein, MapLocation.Lefein, x.Item, AccessRequirement.Slab, ObjectId.Unne, requiredSecondLocation: unneLocation)
                                                                : x).ToList();
                incentiveLocationPool =
                    incentiveLocationPool
                    .Select(x => x.Address == ItemLocations.Lefein.Address
                                                                ? new MapObject(ObjectId.Lefein, MapLocation.Lefein, x.Item, AccessRequirement.Slab, ObjectId.Unne, requiredSecondLocation: unneLocation)
                                                                : x).ToList();
            }

            foreach (var item in forcedItemPlacements.Select(x => x.Item))
            {
                incentivePool.Remove(item);
            }

            var validKeyLocations = new List <IRewardSource> {
                ItemLocations.ElfPrince
            };
            var validBridgeLocations = new List <IRewardSource> {
                ItemLocations.KingConeria
            };
            var validShipLocations = new List <IRewardSource> {
                ItemLocations.Bikke
            };
            var validCanoeLocations = new List <IRewardSource> {
                ItemLocations.CanoeSage
            };
            var everythingButOrbs = ~AccessRequirement.BlackOrb;

            if (flags.NPCFetchItems)
            {
                var validKeyMapLocations = ItemPlacement.AccessibleMapLocations(~(AccessRequirement.BlackOrb | AccessRequirement.Key), MapChange.All, fullLocationRequirements);
                validKeyLocations = itemLocationPool.Where(x => validKeyMapLocations.Contains(x.MapLocation) &&
                                                           validKeyMapLocations.Contains((x as MapObject)?.SecondLocation ?? MapLocation.StartingLocation)).ToList();
                var keyPlacementRank = rng.Between(1, incentivePool.Count);
                if (incentivePool.Contains(Item.Key) && incentiveLocationPool.Any(x => validKeyLocations.Any(y => y.Address == x.Address)) && keyPlacementRank <= incentiveLocationPool.Count)
                {
                    validKeyLocations = validKeyLocations.Where(x => incentiveLocationPool.Any(y => y.Address == x.Address)).ToList();
                }
                else if (!flags.IncentivizeKey && incentivePool.Count >= incentiveLocationPool.Count)
                {
                    validKeyLocations = validKeyLocations.Where(x => !incentiveLocationPool.Any(y => y.Address == x.Address)).ToList();
                }
            }

            if (flags.NPCItems)
            {
                var everythingButCanoe      = ~MapChange.Canoe;
                var startingPotentialAccess = map.StartingPotentialAccess;
                var startingMapLocations    = ItemPlacement.AccessibleMapLocations(startingPotentialAccess, MapChange.None, fullLocationRequirements);
                var validShipMapLocations   = ItemPlacement.AccessibleMapLocations(startingPotentialAccess | AccessRequirement.Crystal, MapChange.Bridge, fullLocationRequirements);
                var validCanoeMapLocations  = ItemPlacement.AccessibleMapLocations(everythingButOrbs, everythingButCanoe, fullLocationRequirements);

                validBridgeLocations =
                    itemLocationPool.Where(x => startingMapLocations.Contains(x.MapLocation) &&
                                           startingMapLocations.Contains((x as MapObject)?.SecondLocation ?? MapLocation.StartingLocation)).ToList();
                validShipLocations =
                    itemLocationPool.Where(x => validShipMapLocations.Contains(x.MapLocation) &&
                                           validShipMapLocations.Contains((x as MapObject)?.SecondLocation ?? MapLocation.StartingLocation)).ToList();
                validCanoeLocations =
                    itemLocationPool.Where(x => validCanoeMapLocations.Contains(x.MapLocation) &&
                                           validCanoeMapLocations.Contains((x as MapObject)?.SecondLocation ?? MapLocation.StartingLocation)).ToList();

                var canoePlacementRank   = rng.Between(1, incentivePool.Count);
                var validCanoeIncentives = validCanoeLocations.Where(x => incentiveLocationPool.Any(y => y.Address == x.Address)).ToList();
                if (incentivePool.Contains(Item.Canoe) && canoePlacementRank <= incentiveLocationPool.Count &&
                    validKeyLocations.Union(validCanoeIncentives).Count() > 1)                     // The Key can be placed in at least one place more than than the Canoe
                {
                    validCanoeLocations = validCanoeIncentives;
                }
                else if (!flags.IncentivizeBridge && incentivePool.Count >= incentiveLocationPool.Count)
                {
                    validCanoeLocations = validCanoeLocations.Where(x => !incentiveLocationPool.Any(y => y.Address == x.Address)).ToList();
                }
            }

            var nonEndgameMapLocations = ItemPlacement.AccessibleMapLocations(~AccessRequirement.BlackOrb, MapChange.All, fullLocationRequirements);

            ForcedItemPlacements = forcedItemPlacements.ToList();
            IncentiveItems       = incentivePool.ToList();

            BridgeLocations = validBridgeLocations
                              .Where(x => !forcedItemPlacements.Any(y => y.Address == x.Address))
                              .ToList();
            ShipLocations = validShipLocations
                            .Where(x => !forcedItemPlacements.Any(y => y.Address == x.Address))
                            .ToList();
            KeyLocations = validKeyLocations
                           .Where(x => !forcedItemPlacements.Any(y => y.Address == x.Address))
                           .ToList();
            CanoeLocations = validCanoeLocations
                             .Where(x => !forcedItemPlacements.Any(y => y.Address == x.Address))
                             .ToList();
            IncentiveLocations = incentiveLocationPool
                                 .Where(x => !forcedItemPlacements.Any(y => y.Address == x.Address))
                                 .ToList();

            AllValidItemLocations            = itemLocationPool.ToList();
            AllValidPreBlackOrbItemLocations = AllValidItemLocations
                                               .Where(x => nonEndgameMapLocations.Contains(x.MapLocation) && nonEndgameMapLocations.Contains((x as MapObject)?.SecondLocation ?? MapLocation.StartingLocation))
                                               .ToList();
        }
Esempio n. 36
0
 public SniperTower(MapLocation location) : base(location)
 {
 }
Esempio n. 37
0
 public Tower(MapLocation location)
 {
     _location = location;
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        public Restaurant_WORLD()
        {
            startFollowMessage = "Ok, lets go.";
            kitchenConfirmationMessage = "I heard: here is the kitchen, is that correct?";
            orderAskingMessage = "Ok, tell me. to which table should I go to take an order?";
            tableDirectionAskingMessage = "Please tell me if the table is at my left or my right side.";
            okMessage = "ok";
            goinToTakeOrderMessage = "I am going to take an order to table";
            goingToKitchenMessage = "I am going to the kitchen.";

            mvnplnKitchenLocation = new MapLocation("kitchenTable");

            armsFollowPosition = "standby";
            armsHomePosition = "home";

            tableLocationKeywords = new List<string>(new [] {"table", "ordering"});
            tableNumberKeywords = new List<string>(new[] { "one", "two", "three"});
            kitchenLocationKeywords = new List<string>(new[] { "kitchen" });
            tableDirectionKeywords = new List<string>(new[] { "right", "left"});

            headFollowPosition.pan = 0.0;
            headFollowPosition.tilt = -0.1;
            headHomePosition.pan = 0.0;
            headHomePosition.tilt = 0.0;
        }
Esempio n. 39
0
        public IPersistable CreateRIFObject(ObjectType objectType, ref IntermediateFormatReader context)
        {
            IPersistable persistable = null;

            if (objectType == ObjectType.Null)
            {
                return(null);
            }
            IDOwner    parentIDOwner    = this.m_parentIDOwner;
            ReportItem parentReportItem = this.m_parentReportItem;

            switch (objectType)
            {
            case ObjectType.PageSection:
                persistable             = new PageSection(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.Line:
                persistable             = new Line(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.Rectangle:
                persistable             = new Rectangle(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.Image:
                persistable             = new Image(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.TextBox:
                persistable             = new TextBox(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.SubReport:
                persistable             = new SubReport(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.Grouping:
                persistable = new Grouping(ConstructionPhase.Deserializing);
                break;

            case ObjectType.Sorting:
                persistable = new Sorting(ConstructionPhase.Deserializing);
                break;

            case ObjectType.ReportItemCollection:
                persistable = new ReportItemCollection();
                break;

            case ObjectType.ReportItemIndexer:
                persistable = (IPersistable)(object)default(ReportItemIndexer);
                break;

            case ObjectType.Style:
                persistable = new Style(ConstructionPhase.Deserializing);
                break;

            case ObjectType.AttributeInfo:
                persistable = new AttributeInfo();
                break;

            case ObjectType.Visibility:
                persistable = new Visibility();
                break;

            case ObjectType.ExpressionInfo:
                persistable = new ExpressionInfo();
                break;

            case ObjectType.ExpressionInfoTypeValuePair:
                persistable = new ExpressionInfoTypeValuePair();
                break;

            case ObjectType.DataAggregateInfo:
                persistable = new DataAggregateInfo();
                break;

            case ObjectType.RunningValueInfo:
                persistable = new RunningValueInfo();
                break;

            case ObjectType.Filter:
                persistable = new Filter();
                break;

            case ObjectType.DataSource:
                persistable = new DataSource();
                break;

            case ObjectType.DataSet:
                persistable = new DataSet();
                break;

            case ObjectType.ReportQuery:
                persistable = new ReportQuery();
                break;

            case ObjectType.Field:
                persistable = new Field();
                break;

            case ObjectType.ParameterValue:
                persistable = new ParameterValue();
                break;

            case ObjectType.ReportSnapshot:
                persistable = new ReportSnapshot();
                break;

            case ObjectType.DocumentMapNode:
                persistable = new DocumentMapNode();
                break;

            case ObjectType.DocumentMapBeginContainer:
                persistable = DocumentMapBeginContainer.Instance;
                break;

            case ObjectType.DocumentMapEndContainer:
                persistable = DocumentMapEndContainer.Instance;
                break;

            case ObjectType.ReportInstance:
                persistable = new ReportInstance();
                break;

            case ObjectType.ParameterInfo:
                persistable = new ParameterInfo();
                break;

            case ObjectType.ValidValue:
                persistable = new ValidValue();
                break;

            case ObjectType.ParameterDataSource:
                persistable = new ParameterDataSource();
                break;

            case ObjectType.ParameterDef:
                persistable = new ParameterDef();
                break;

            case ObjectType.ProcessingMessage:
                persistable = new ProcessingMessage();
                break;

            case ObjectType.CodeClass:
                persistable = (IPersistable)(object)default(CodeClass);
                break;

            case ObjectType.Action:
                persistable = new Action();
                break;

            case ObjectType.RenderingPagesRanges:
                persistable = (IPersistable)(object)default(RenderingPagesRanges);
                break;

            case ObjectType.IntermediateFormatVersion:
                persistable = new IntermediateFormatVersion();
                break;

            case ObjectType.ImageInfo:
                persistable = new ImageInfo();
                break;

            case ObjectType.ActionItem:
                persistable = new ActionItem();
                break;

            case ObjectType.DataValue:
                persistable = new DataValue();
                break;

            case ObjectType.CustomReportItem:
                persistable             = new CustomReportItem(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.SortFilterEventInfoMap:
                persistable = new SortFilterEventInfoMap();
                break;

            case ObjectType.SortFilterEventInfo:
                persistable = new SortFilterEventInfo();
                break;

            case ObjectType.EndUserSort:
                persistable = new EndUserSort();
                break;

            case ObjectType.ScopeLookupTable:
                persistable = new ScopeLookupTable();
                break;

            case ObjectType.Tablix:
                persistable             = new Tablix(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.TablixHeader:
                persistable = new TablixHeader();
                break;

            case ObjectType.TablixMember:
                persistable = new TablixMember();
                break;

            case ObjectType.TablixColumn:
                persistable = new TablixColumn();
                break;

            case ObjectType.TablixRow:
                persistable = new TablixRow();
                break;

            case ObjectType.TablixCornerCell:
                persistable = new TablixCornerCell();
                break;

            case ObjectType.TablixCell:
                persistable = new TablixCell();
                break;

            case ObjectType.Chart:
                persistable             = new Chart(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.ChartMember:
                persistable = new ChartMember();
                break;

            case ObjectType.ChartSeries:
                persistable = new ChartSeries();
                break;

            case ObjectType.ChartDataPoint:
                persistable = new ChartDataPoint();
                break;

            case ObjectType.ChartDataPointValues:
                persistable = new ChartDataPointValues();
                break;

            case ObjectType.ChartArea:
                persistable = new ChartArea();
                break;

            case ObjectType.ChartLegend:
                persistable = new ChartLegend();
                break;

            case ObjectType.ChartLegendTitle:
                persistable = new ChartLegendTitle();
                break;

            case ObjectType.ChartAxis:
                persistable = new ChartAxis();
                break;

            case ObjectType.ThreeDProperties:
                persistable = new ChartThreeDProperties();
                break;

            case ObjectType.ChartDataLabel:
                persistable = new ChartDataLabel();
                break;

            case ObjectType.ChartMarker:
                persistable = new ChartMarker();
                break;

            case ObjectType.ChartTitle:
                persistable = new ChartTitle();
                break;

            case ObjectType.ChartAxisScaleBreak:
                persistable = new ChartAxisScaleBreak();
                break;

            case ObjectType.ChartDerivedSeries:
                persistable = new ChartDerivedSeries();
                break;

            case ObjectType.ChartBorderSkin:
                persistable = new ChartBorderSkin();
                break;

            case ObjectType.ChartNoDataMessage:
                persistable = new ChartNoDataMessage();
                break;

            case ObjectType.ChartItemInLegend:
                persistable = new ChartItemInLegend();
                break;

            case ObjectType.ChartEmptyPoints:
                persistable = new ChartEmptyPoints();
                break;

            case ObjectType.ChartNoMoveDirections:
                persistable = new ChartNoMoveDirections();
                break;

            case ObjectType.ChartFormulaParameter:
                persistable = new ChartFormulaParameter();
                break;

            case ObjectType.ChartLegendColumn:
                persistable = new ChartLegendColumn();
                break;

            case ObjectType.ChartLegendColumnHeader:
                persistable = new ChartLegendColumnHeader();
                break;

            case ObjectType.ChartLegendCustomItem:
                persistable = new ChartLegendCustomItem();
                break;

            case ObjectType.ChartLegendCustomItemCell:
                persistable = new ChartLegendCustomItemCell();
                break;

            case ObjectType.ChartAlignType:
                persistable = new ChartAlignType();
                break;

            case ObjectType.ChartElementPosition:
                persistable = new ChartElementPosition();
                break;

            case ObjectType.ChartSmartLabel:
                persistable = new ChartSmartLabel();
                break;

            case ObjectType.ChartStripLine:
                persistable = new ChartStripLine();
                break;

            case ObjectType.ChartAxisTitle:
                persistable = new ChartAxisTitle();
                break;

            case ObjectType.ChartCustomPaletteColor:
                persistable = new ChartCustomPaletteColor();
                break;

            case ObjectType.GridLines:
                persistable = new ChartGridLines();
                break;

            case ObjectType.ChartTickMarks:
                persistable = new ChartTickMarks();
                break;

            case ObjectType.DataMember:
                persistable = new DataMember();
                break;

            case ObjectType.CustomDataRow:
                persistable = new CustomDataRow();
                break;

            case ObjectType.DataCell:
                persistable = new DataCell();
                break;

            case ObjectType.Variable:
                persistable = new Variable();
                break;

            case ObjectType.Page:
                persistable = new Page();
                break;

            case ObjectType.Paragraph:
                persistable = new Paragraph();
                break;

            case ObjectType.TextRun:
                persistable = new TextRun();
                break;

            case ObjectType.Report:
                persistable             = new Report(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.GaugePanel:
                persistable             = new GaugePanel(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.GaugeMember:
                persistable = new GaugeMember();
                break;

            case ObjectType.GaugeRow:
                persistable = new GaugeRow();
                break;

            case ObjectType.GaugeCell:
                persistable = new GaugeCell();
                break;

            case ObjectType.BackFrame:
                persistable = new BackFrame();
                break;

            case ObjectType.CapImage:
                persistable = new CapImage();
                break;

            case ObjectType.FrameBackground:
                persistable = new FrameBackground();
                break;

            case ObjectType.FrameImage:
                persistable = new FrameImage();
                break;

            case ObjectType.CustomLabel:
                persistable = new CustomLabel();
                break;

            case ObjectType.GaugeImage:
                persistable = new GaugeImage();
                break;

            case ObjectType.GaugeInputValue:
                persistable = new GaugeInputValue();
                break;

            case ObjectType.GaugeLabel:
                persistable = new GaugeLabel();
                break;

            case ObjectType.GaugePanelItem:
                persistable = new GaugePanelItem();
                break;

            case ObjectType.GaugeTickMarks:
                persistable = new GaugeTickMarks();
                break;

            case ObjectType.LinearGauge:
                persistable = new LinearGauge();
                break;

            case ObjectType.LinearPointer:
                persistable = new LinearPointer();
                break;

            case ObjectType.LinearScale:
                persistable = new LinearScale();
                break;

            case ObjectType.NumericIndicator:
                persistable = new NumericIndicator();
                break;

            case ObjectType.PinLabel:
                persistable = new PinLabel();
                break;

            case ObjectType.PointerCap:
                persistable = new PointerCap();
                break;

            case ObjectType.PointerImage:
                persistable = new PointerImage();
                break;

            case ObjectType.RadialGauge:
                persistable = new RadialGauge();
                break;

            case ObjectType.RadialPointer:
                persistable = new RadialPointer();
                break;

            case ObjectType.RadialScale:
                persistable = new RadialScale();
                break;

            case ObjectType.ScaleLabels:
                persistable = new ScaleLabels();
                break;

            case ObjectType.ScalePin:
                persistable = new ScalePin();
                break;

            case ObjectType.ScaleRange:
                persistable = new ScaleRange();
                break;

            case ObjectType.IndicatorImage:
                persistable = new IndicatorImage();
                break;

            case ObjectType.StateIndicator:
                persistable = new StateIndicator();
                break;

            case ObjectType.Thermometer:
                persistable = new Thermometer();
                break;

            case ObjectType.TickMarkStyle:
                persistable = new TickMarkStyle();
                break;

            case ObjectType.TopImage:
                persistable = new TopImage();
                break;

            case ObjectType.LookupInfo:
                persistable = new LookupInfo();
                break;

            case ObjectType.LookupDestinationInfo:
                persistable = new LookupDestinationInfo();
                break;

            case ObjectType.ReportSection:
                persistable = new ReportSection();
                break;

            case ObjectType.MapFieldDefinition:
                persistable = new MapFieldDefinition();
                break;

            case ObjectType.MapFieldName:
                persistable = new MapFieldName();
                break;

            case ObjectType.MapLineLayer:
                persistable = new MapLineLayer();
                break;

            case ObjectType.MapShapefile:
                persistable = new MapShapefile();
                break;

            case ObjectType.MapPolygonLayer:
                persistable = new MapPolygonLayer();
                break;

            case ObjectType.MapSpatialDataRegion:
                persistable = new MapSpatialDataRegion();
                break;

            case ObjectType.MapSpatialDataSet:
                persistable = new MapSpatialDataSet();
                break;

            case ObjectType.MapPointLayer:
                persistable = new MapPointLayer();
                break;

            case ObjectType.MapTile:
                persistable = new MapTile();
                break;

            case ObjectType.MapTileLayer:
                persistable = new MapTileLayer();
                break;

            case ObjectType.MapField:
                persistable = new MapField();
                break;

            case ObjectType.MapLine:
                persistable = new MapLine();
                break;

            case ObjectType.MapPolygon:
                persistable = new MapPolygon();
                break;

            case ObjectType.MapPoint:
                persistable = new MapPoint();
                break;

            case ObjectType.MapLineTemplate:
                persistable = new MapLineTemplate();
                break;

            case ObjectType.MapPolygonTemplate:
                persistable = new MapPolygonTemplate();
                break;

            case ObjectType.MapMarkerTemplate:
                persistable = new MapMarkerTemplate();
                break;

            case ObjectType.Map:
                persistable             = new Map(this.m_parentReportItem);
                this.m_parentReportItem = (ReportItem)persistable;
                break;

            case ObjectType.MapBorderSkin:
                persistable = new MapBorderSkin();
                break;

            case ObjectType.MapDataRegion:
                persistable = new MapDataRegion(this.m_parentReportItem);
                break;

            case ObjectType.MapMember:
                persistable = new MapMember();
                break;

            case ObjectType.MapRow:
                persistable = new MapRow();
                break;

            case ObjectType.MapCell:
                persistable = new MapCell();
                break;

            case ObjectType.MapLocation:
                persistable = new MapLocation();
                break;

            case ObjectType.MapSize:
                persistable = new MapSize();
                break;

            case ObjectType.MapGridLines:
                persistable = new MapGridLines();
                break;

            case ObjectType.MapBindingFieldPair:
                persistable = new MapBindingFieldPair();
                break;

            case ObjectType.MapCustomView:
                persistable = new MapCustomView();
                break;

            case ObjectType.MapDataBoundView:
                persistable = new MapDataBoundView();
                break;

            case ObjectType.MapElementView:
                persistable = new MapElementView();
                break;

            case ObjectType.MapViewport:
                persistable = new MapViewport();
                break;

            case ObjectType.MapLimits:
                persistable = new MapLimits();
                break;

            case ObjectType.MapColorScale:
                persistable = new MapColorScale();
                break;

            case ObjectType.MapColorScaleTitle:
                persistable = new MapColorScaleTitle();
                break;

            case ObjectType.MapDistanceScale:
                persistable = new MapDistanceScale();
                break;

            case ObjectType.MapTitle:
                persistable = new MapTitle();
                break;

            case ObjectType.MapLegend:
                persistable = new MapLegend();
                break;

            case ObjectType.MapLegendTitle:
                persistable = new MapLegendTitle();
                break;

            case ObjectType.MapBucket:
                persistable = new MapBucket();
                break;

            case ObjectType.MapColorPaletteRule:
                persistable = new MapColorPaletteRule();
                break;

            case ObjectType.MapColorRangeRule:
                persistable = new MapColorRangeRule();
                break;

            case ObjectType.MapCustomColorRule:
                persistable = new MapCustomColorRule();
                break;

            case ObjectType.MapCustomColor:
                persistable = new MapCustomColor();
                break;

            case ObjectType.MapLineRules:
                persistable = new MapLineRules();
                break;

            case ObjectType.MapPolygonRules:
                persistable = new MapPolygonRules();
                break;

            case ObjectType.MapSizeRule:
                persistable = new MapSizeRule();
                break;

            case ObjectType.MapMarkerImage:
                persistable = new MapMarkerImage();
                break;

            case ObjectType.MapMarker:
                persistable = new MapMarker();
                break;

            case ObjectType.MapMarkerRule:
                persistable = new MapMarkerRule();
                break;

            case ObjectType.MapPointRules:
                persistable = new MapPointRules();
                break;

            case ObjectType.PageBreak:
                persistable = new PageBreak();
                break;

            case ObjectType.DataScopeInfo:
                persistable = new DataScopeInfo();
                break;

            case ObjectType.LinearJoinInfo:
                persistable = new LinearJoinInfo();
                break;

            case ObjectType.IntersectJoinInfo:
                persistable = new IntersectJoinInfo();
                break;

            case ObjectType.BucketedDataAggregateInfos:
                persistable = new BucketedDataAggregateInfos();
                break;

            case ObjectType.DataAggregateInfoBucket:
                persistable = new DataAggregateInfoBucket();
                break;

            case ObjectType.NumericIndicatorRange:
                persistable = new NumericIndicatorRange();
                break;

            case ObjectType.IndicatorState:
                persistable = new IndicatorState();
                break;

            case ObjectType.SharedDataSetQuery:
                persistable = new SharedDataSetQuery();
                break;

            case ObjectType.DataSetCore:
                persistable = new DataSetCore();
                break;

            case ObjectType.DataSetParameterValue:
                persistable = new DataSetParameterValue();
                break;

            case ObjectType.RIFVariantContainer:
                persistable = new RIFVariantContainer();
                break;

            case ObjectType.IdcRelationship:
                persistable = new IdcRelationship();
                break;

            case ObjectType.DefaultRelationship:
                persistable = new DefaultRelationship();
                break;

            case ObjectType.JoinCondition:
                persistable = new Relationship.JoinCondition();
                break;

            case ObjectType.BandLayoutOptions:
                persistable = new BandLayoutOptions();
                break;

            case ObjectType.LabelData:
                persistable = new LabelData();
                break;

            case ObjectType.Slider:
                persistable = new Slider();
                break;

            case ObjectType.Coverflow:
                persistable = new Coverflow();
                break;

            case ObjectType.PlayAxis:
                persistable = new PlayAxis();
                break;

            case ObjectType.BandNavigationCell:
                persistable = new BandNavigationCell();
                break;

            case ObjectType.Tabstrip:
                persistable = new Tabstrip();
                break;

            case ObjectType.NavigationItem:
                persistable = new NavigationItem();
                break;

            case ObjectType.ScopedFieldInfo:
                persistable = new ScopedFieldInfo();
                break;

            default:
                Global.Tracer.Assert(false, "Unsupported object type: " + objectType.ToString());
                break;
            }
            IDOwner iDOwner = persistable as IDOwner;

            if (iDOwner != null)
            {
                iDOwner.ParentInstancePath = this.m_parentIDOwner;
                this.m_parentIDOwner       = iDOwner;
            }
            persistable.Deserialize(context);
            this.m_parentIDOwner    = parentIDOwner;
            this.m_parentReportItem = parentReportItem;
            return(persistable);
        }
Esempio n. 40
0
 public SelectedTileChangedEventArgs(MapLocation newSelected, MapTileBase selectedTile)
 {
     this.newSelected  = newSelected;
     this.selectedTile = selectedTile;
 }
Esempio n. 41
0
        public string TranslateFloor(MapLocation mapLocation)
        {
            Dictionary <MapLocation, string> StandardOverworldLocations =
                new Dictionary <MapLocation, string>
            {
                { MapLocation.Coneria, "Coneria" },
                { MapLocation.Pravoka, "Pravoka" },
                { MapLocation.Elfland, "Elfland" },
                { MapLocation.Melmond, "Melmond" },
                { MapLocation.CrescentLake, "CrescentLake" },
                { MapLocation.Gaia, "Gaia" },
                { MapLocation.Onrac, "Onrac" },
                { MapLocation.Lefein, "Lefein" },
                { MapLocation.ConeriaCastle1, "ConeriaCastle" },
                { MapLocation.ConeriaCastle2, "ConeriaCastle" },
                { MapLocation.ConeriaCastleRoom1, "ConeriaCastle" },
                { MapLocation.ConeriaCastleRoom2, "ConeriaCastle" },
                { MapLocation.ElflandCastle, "ElflandCastle" },
                { MapLocation.ElflandCastleRoom1, "ElflandCastle" },
                { MapLocation.NorthwestCastle, "NorthwestCastle" },
                { MapLocation.NorthwestCastleRoom2, "NorthwestCastle" },
                { MapLocation.CastleOrdeals1, "CastleOrdeals 1" },
                { MapLocation.CastleOrdealsMaze, "CastleOrdeals 2" },
                { MapLocation.CastleOrdealsTop, "CastleOrdeals 3" },
                { MapLocation.TempleOfFiends1, "TempleOfFiends 1" },
                { MapLocation.TempleOfFiends1Room1, "TempleOfFiends 1" },
                { MapLocation.TempleOfFiends1Room2, "TempleOfFiends 1" },
                { MapLocation.TempleOfFiends1Room3, "TempleOfFiends 1" },
                { MapLocation.TempleOfFiends1Room4, "TempleOfFiends 1" },
                { MapLocation.TempleOfFiends2, "TempleOfFiends 2" },
                { MapLocation.TempleOfFiends3, "TempleOfFiends 3" },
                { MapLocation.TempleOfFiendsChaos, "TempleOfFiends Chaos" },
                { MapLocation.TempleOfFiendsAir, "TempleOfFiends Air" },
                { MapLocation.TempleOfFiendsEarth, "TempleOfFiends Earth" },
                { MapLocation.TempleOfFiendsFire, "TempleOfFiends Fire" },
                { MapLocation.TempleOfFiendsWater, "TempleOfFiends Water" },
                { MapLocation.TempleOfFiendsPhantom, "TempleOfFiends 4" },
                { MapLocation.EarthCave1, "EarthCave 1" },
                { MapLocation.EarthCave2, "EarthCave 2" },
                { MapLocation.EarthCaveVampire, "EarthCave 3" },
                { MapLocation.EarthCave4, "EarthCave 4" },
                { MapLocation.EarthCaveLich, "EarthCave 4" },
                { MapLocation.GurguVolcano1, "Volcano 1" },
                { MapLocation.GurguVolcano2, "Volcano 2" },
                { MapLocation.GurguVolcano3, "Volcano 3" },
                { MapLocation.GurguVolcano4, "Volcano 4" },
                { MapLocation.GurguVolcano5, "Volcano 5" },
                { MapLocation.GurguVolcano6, "Volcano 6" },
                { MapLocation.GurguVolcanoKary, "Volcano Kary" },
                { MapLocation.IceCave1, "IceCave 1" },
                { MapLocation.IceCave2, "IceCave 2" },
                { MapLocation.IceCave3, "IceCave 3" },
                { MapLocation.IceCave5, "IceCave 5" },
                { MapLocation.IceCaveBackExit, "IceCave 6" },
                { MapLocation.IceCaveFloater, "IceCave 4" },
                { MapLocation.IceCavePitRoom, "IceCave 4" },
                { MapLocation.SeaShrine1, "SeaShrine 1" },
                { MapLocation.SeaShrine2, "SeaShrine Right 2" },
                { MapLocation.SeaShrine2Room2, "SeaShrine Right 2" },
                { MapLocation.SeaShrine4, "SeaShrine Left 2" },
                { MapLocation.SeaShrine5, "SeaShrine Left 3" },
                { MapLocation.SeaShrine6, "SeaShrine Left 4" },
                { MapLocation.SeaShrine7, "SeaShrine Left 5" },
                { MapLocation.SeaShrine8, "SeaShrine Left 6" },
                { MapLocation.SeaShrineKraken, "SeaShrine Kraken" },
                { MapLocation.SeaShrineMermaids, "SeaShrine Mermaids" },
                { MapLocation.Cardia1, "Cardia 1" },
                { MapLocation.Cardia2, "Cardia 2" },
                { MapLocation.BahamutCave1, "Cardia Bahamut" },
                { MapLocation.BahamutCave2, "Cardia Bahamut" },
                { MapLocation.Cardia4, "Cardia 4" },
                { MapLocation.Cardia5, "Cardia 5" },
                { MapLocation.Cardia6, "Cardia 6" },
                { MapLocation.Waterfall, "Waterfall" },
                { MapLocation.DwarfCave, "DwarfCave" },
                { MapLocation.DwarfCaveRoom3, "DwarfCave" },
                { MapLocation.MatoyasCave, "MatoyasCave" },
                { MapLocation.SardasCave, "SardasCave" },
                { MapLocation.MarshCave1, "MarshCave 1" },
                { MapLocation.MarshCave3, "MarshCave Bottom 2" },
                { MapLocation.MarshCaveBottom, "MarshCave Bottom 3" },
                { MapLocation.MarshCaveBottomRoom13, "MarshCave Bottom 3" },
                { MapLocation.MarshCaveBottomRoom14, "MarshCave Bottom 3" },
                { MapLocation.MarshCaveBottomRoom16, "MarshCave Bottom 3" },
                { MapLocation.MarshCaveTop, "MarshCave Top 2" },
                { MapLocation.MirageTower1, "MirageTower 1" },
                { MapLocation.MirageTower2, "MirageTower 2" },
                { MapLocation.MirageTower3, "MirageTower 3" },
                { MapLocation.SkyPalace1, "SkyPalace 1" },
                { MapLocation.SkyPalace2, "SkyPalace 2" },
                { MapLocation.SkyPalace3, "SkyPalace 3" },
                { MapLocation.SkyPalaceMaze, "SkyPalace 4" },
                { MapLocation.SkyPalaceTiamat, "SkyPalace Tiamat" },
                { MapLocation.TitansTunnelEast, "TitansTunnel" },
                { MapLocation.TitansTunnelWest, "TitansTunnel" },
                { MapLocation.TitansTunnelRoom, "TitansTunnel" },
            };

            return(StandardOverworldLocations.TryGetValue(mapLocation, out var text) ? text : "...");
        }
Esempio n. 42
0
 internal static Location ToLocation(this MapLocation mapLocation) =>
 new Location(mapLocation.Point.Position.Latitude, mapLocation.Point.Position.Longitude, DateTimeOffset.UtcNow);
Esempio n. 43
0
 public bool InRangeOf(MapLocation location, int range) //finds if a speific instance is in range of the instance which this instance of maplocation is part of
 {
     return(DistanceTo(location) <= range);
 }
Esempio n. 44
0
        private static void UpdatePhotos(bool newPhotos)
        {
            if (newPhotos)
            {
                if (_mapEntities != null)
                {
                    _map.Entities.Remove(_mapEntities);
                }

                _mapEntities = new MapEntityCollection();
                _map.Entities.Push(_mapEntities);

                _photoViews = new Dictionary <string, PhotoView>();
            }

            if (_model.Photos.Count == 0)
            {
                Document.Body.ClassName = MapModeClassName;
                return;
            }

            Document.Body.ClassName = PhotosModeClassName;

            _graph = new Graph();
            _model.Photos.ForEach(delegate(Photo photo) {
                MapLocation location = new MapLocation(photo.latitude, photo.longitude);
                MapPoint point       = _map.TryLocationToPixel(location, MapPointReference.Control);

                PhotoView photoView;
                if (newPhotos)
                {
                    MapPolylineOptions connectorOptions = new MapPolylineOptions();
                    connectorOptions.StrokeColor        = new MapColor(255, 0x4E, 0xD3, 0x4E);
                    connectorOptions.StrokeThickness    = 2;

                    MapInfoboxOptions calloutOptions = new MapInfoboxOptions();
                    calloutOptions.Width             = 50;
                    calloutOptions.Height            = 50;
                    calloutOptions.ShowPointer       = false;
                    calloutOptions.ShowCloseButton   = false;
                    calloutOptions.Offset            = new MapPoint(-25, 25);
                    calloutOptions.HtmlContent       =
                        "<div class=\"photoInfobox\" style=\"background-image: url(" + photo.thumbnailUrl + ")\"" +
                        " title=\"" + photo.title.HtmlEncode() + "\"></div>";
                    calloutOptions.Visible = true;

                    MapPushpinOptions pushpinOptions = new MapPushpinOptions();
                    pushpinOptions.Icon     = "/Content/Dot.png";
                    pushpinOptions.Width    = 10;
                    pushpinOptions.Height   = 10;
                    pushpinOptions.Anchor   = new MapPoint(5, 5);
                    pushpinOptions.TypeName = "locationPushpin";

                    photoView              = new PhotoView();
                    photoView.pushpin      = new MapPushpin(location, pushpinOptions);
                    photoView.connector    = new MapPolyline(new MapLocation[] { location, location }, connectorOptions);
                    photoView.callout      = new MapInfobox(location, calloutOptions);
                    photoView.callout.Data = photo;
                    _photoViews[photo.id]  = photoView;

                    _mapEntities.Insert(photoView.connector, 0);
                    _mapEntities.Insert(photoView.callout, 0);
                    _mapEntities.Insert(photoView.pushpin, 0);
                    MapEvents.AddHandler(photoView.callout, "click", delegate(MapEventArgs e) {
                        ShowPhoto(photo);
                    });
                }
                else
                {
                    photoView = _photoViews[photo.id];
                }

                photoView.pushpinNode          = new GraphNode();
                photoView.pushpinNode.x        = point.X;
                photoView.pushpinNode.y        = point.Y;
                photoView.pushpinNode.moveable = false;

                photoView.calloutNode   = new GraphNode();
                photoView.calloutNode.x = point.X;
                photoView.calloutNode.y = point.Y;

                GraphEdge connectorEdge = new GraphEdge(photoView.pushpinNode,
                                                        photoView.calloutNode,
                                                        10 + Math.Random() * 15);

                _graph.AddNode(photoView.pushpinNode);
                _graph.AddNode(photoView.calloutNode);
                _graph.AddEdge(connectorEdge);
            });

            Window.SetTimeout(UpdateLayout, 30);
        }
Esempio n. 45
0
 /// <summary>
 /// cTor.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="baseTile"></param>
 internal LocationSelectedEventArgs(MapLocation location, MapTileBase baseTile)
 {
     _location = location;
     _baseTile = baseTile;
 }
Esempio n. 46
0
        public async void getDestination2()
        {
            RouteMap.Children.Clear();
            RouteMap.Routes.Clear();
            Windows.Devices.Geolocation.Geopoint point = new Windows.Devices.Geolocation.Geopoint(new Windows.Devices.Geolocation.BasicGeoposition() { Latitude = 51.58914, Longitude = 4.74304 });

            MapLocationFinderResult result = await Windows.Services.Maps.MapLocationFinder.FindLocationsAsync(this.location, point);
            Destination = result.Locations[0];


            Canvas pin = new Canvas();
            Ellipse Ppin = new Ellipse() { Width = 25, Height = 25 };
            Ppin.Fill = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 0, 0));
            Ppin.Margin = new Thickness(-12.5, -12.5, 0, 0);
            pin.Children.Add(Ppin);

            try
            {
                // Windows.Devices.Geolocation.Geolocator.RequestAccessAsync().Completed()
                var accesStatus = await Geolocator.RequestAccessAsync();

                switch(accesStatus)
                {
                    case GeolocationAccessStatus.Allowed:
                        {


                            Geolocator geolocator = new Geolocator { DesiredAccuracy = 0 };

                            Geoposition pos = await geolocator.GetGeopositionAsync();
                            RouteMap.Children.Add(pin);
                            Windows.UI.Xaml.Controls.Maps.MapControl.SetLocation(pin, new Geopoint(new BasicGeoposition() { Latitude = pos.Coordinate.Latitude, Longitude = pos.Coordinate.Longitude }));
                            Windows.UI.Xaml.Controls.Maps.MapControl.SetNormalizedAnchorPoint(pin, new Point(0.5, 0.5));

                            currentLocation =  new Geopoint(new BasicGeoposition() { Latitude = pos.Coordinate.Latitude, Longitude = pos.Coordinate.Longitude });

                            

                            MapRouteFinderResult x = await MapRouteFinder.GetDrivingRouteAsync(currentLocation, Destination.Point);
                            Windows.UI.Xaml.Controls.Maps.MapRouteView route = new Windows.UI.Xaml.Controls.Maps.MapRouteView(x.Route);
                           
                            RouteMap.Routes.Add(route);


                            break;
                        }
                }
                    
            }
            catch (Exception ex)
            {

            }



            //Windows.Devices.Geolocation.Geolocator.RequestAccessAsync().Completed( 


            Canvas pin2 = new Canvas();
            Ellipse Ppin2 = new Ellipse() { Width = 20, Height = 20 };
            Ppin2.Fill = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 0, 0));
            Ppin2.Margin = new Thickness(-12.5, -12.5, 0, 0);
            pin2.Children.Add(Ppin2);



            RouteMap.Children.Add(pin2);
            Windows.UI.Xaml.Controls.Maps.MapControl.SetLocation(pin2, result.Locations[0].Point);
            Windows.UI.Xaml.Controls.Maps.MapControl.SetNormalizedAnchorPoint(pin2, new Point(0.5, 0.5));
            RouteMap.ZoomLevel = 12;
            RouteMap.Center = result.Locations[0].Point;
            
        }
 public void ChangeMapLocation(MapLocation mapLocation)
 {
     MapLocation = mapLocation;
 }
Esempio n. 48
0
        void BuildMap()
        {
            if (isloading)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            clusters.Clear();
            dgFacts.DataSource = null;
            List <IDisplayFact> displayFacts            = new List <IDisplayFact>();
            List <Individual>   list                    = new List <Individual>();
            List <Tuple <FactLocation, int> > locations = new List <Tuple <FactLocation, int> >();

            foreach (TreeNode node in tvPlaces.SelectedNodes)
            {
                Tuple <FactLocation, int> location = new Tuple <FactLocation, int>((FactLocation)node.Tag, node.Level);
                list.AddRange(ft.GetIndividualsAtLocation(location.Item1, location.Item2));
                locations.Add(location);
            }
            if (list.Count == 0)
            {
                Cursor = Cursors.Default;
                RefreshClusters();
                return;
            }
            int count = 0;

            progressbar.Visible = true;
            progressbar.Maximum = list.Count;
            foreach (Individual ind in list)
            {
                foreach (DisplayFact dispfact in ind.AllGeocodedFacts)
                {
                    foreach (Tuple <FactLocation, int> location in locations)
                    {
                        if (dispfact.Location.CompareTo(location.Item1, location.Item2) == 0)
                        {
                            displayFacts.Add(dispfact);
                            MapLocation loc = new MapLocation(ind, dispfact.Fact, dispfact.FactDate);
                            loc.AddFeatureDataRow(clusters.FactLocations);
                            break;
                        }
                    }
                }
                progressbar.Value = ++count;
                txtCount.Text     = "Processed " + count + " Individuals from list of " + list.Count;
                Application.DoEvents();
            }
            progressbar.Visible = false;
            txtCount.Text       = "Downloading map tiles and computing clusters for " + displayFacts.Count + " facts. Please wait";
            Application.DoEvents();
            dgFacts.DataSource = new SortableBindingList <IDisplayFact>(displayFacts);

            Envelope expand = mh.GetExtents(clusters.FactLocations);

            mapBox1.Map.ZoomToBox(expand);
            mapBox1.ActiveTool = SharpMap.Forms.MapBox.Tools.Pan;
            RefreshClusters();
            txtCount.Text = dgFacts.RowCount + " Geolocated fact(s) displayed";
            Cursor        = Cursors.Default;
        }
Esempio n. 49
0
        public void MapLocationInequality()
        {
            Location loc1 = new MapLocation (new Map (), new Point (1, 1));
            Location loc2 = new MapLocation (new Map (), new Point (1, 2));

            Assert.IsFalse (loc1.Equals (loc2));
            Assert.IsFalse (loc1 == loc2);
            Assert.IsTrue (loc1 != loc2);
        }
        private static string getCompleteAddress(MapLocation mapLocation)
        {
            string houseNumber = mapLocation.Information.Address.HouseNumber;
            string street = mapLocation.Information.Address.Street;
            string Address = "";
            string region = MapHelper.getRegion(mapLocation);
            string city = mapLocation.Information.Address.City;
            string country = mapLocation.Information.Address.Country;

            if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(city) && string.IsNullOrEmpty(country))
                Address = "";
            else if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(city))
                Address = country;
            else if (string.IsNullOrEmpty(region) && string.IsNullOrEmpty(country))
                Address = city;
            else if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(country))
                Address = region;
            else if (string.IsNullOrEmpty(region))
                Address = string.Format("{0}, {1} ", city, country);
            else if (string.IsNullOrEmpty(city))
                Address = string.Format("{0}, {1} ", region, country);
            else if (string.IsNullOrEmpty(country))
                Address = string.Format("{0}, {1} ", city, region);
            else if (string.IsNullOrEmpty(houseNumber) && string.IsNullOrEmpty(street))
                Address = string.Format("{0}, {1}, {2} ", city, region, country);
            else if (string.IsNullOrEmpty(houseNumber))
                Address = string.Format("{0}, {1}, {2}, {3}", street, city, region, country);
            else if (string.IsNullOrEmpty(street))
                Address = string.Format("{0}, {1}, {2}, {3}", houseNumber, city, region, country);
            else
                Address = string.Format("{0}, {1}, {2}, {3}, {4}", houseNumber, street, city, region, country);

            return Address;
        }
Esempio n. 51
0
 public LongRangeTower(MapLocation location) : base(location)
 {
 }
Esempio n. 52
0
        public static void SaveMappings(Mappings whichMappings = Mappings.CurrentBootMappings, MapLocation whereToSave = MapLocation.LocalMachineKeyboardLayout)
        {
            Collection<KeyMapping> maps;

            switch (whichMappings)
            {
                case Mappings.CurrentBootMappings:
                    maps = mappings;
                    break;
                case Mappings.SavedBootMappings:
                    maps = savedBootMappings;
                    break;
                default:
                    return;
            }

            RegistryHive hive = 0;
            string keyname = "", valuename = "";

            RegistryProvider.GetRegistryLocation(whereToSave, ref hive, ref keyname, ref valuename);

            RegistryKey registry = null;

            // Need write access so prepare to fail
            try
            {
                if (hive == RegistryHive.LocalMachine)
                {
                    registry = Registry.LocalMachine.OpenSubKey(keyname, true);
                }
                else if (hive == RegistryHive.CurrentUser)
                {
                    registry = Registry.CurrentUser.OpenSubKey(keyname, true);
                }
            }
            catch (SecurityException ex)
            {
                if (hive == RegistryHive.CurrentUser)
                {
                    // Would expect to be able to write to HKCU
                    Console.WriteLine("Unexpected failure {2} opening {0} on {1} for write access", keyname, Enum.GetNames(typeof(Mappings))[(int)whichMappings], ex.Message);
                }

                return;
            }

            if (registry == null)
            {
                // Key doesn't exist. TODO Shouldn't this be logged?
                return;
            }

            if (maps.Count == 0)
            {
                registry.SetValue(valuename, new byte[0]);
            }
            else
            {
                registry.SetValue(valuename, GetMappingsAsByteArray(maps));
            }
        }
Esempio n. 53
0
 public void AddLocation(MapLocation mapLocation)
 {
     locationsList.Add(mapLocation.number, mapLocation);
 }
Esempio n. 54
0
        public static void SaveMappings(Mappings whichMappings, MapLocation whereToSave)
        {
            Collection <KeyMapping> maps;

            switch (whichMappings)
            {
            case Mappings.CurrentBootMappings:
                maps = _bootMappings;
                break;

            case Mappings.CurrentUserMappings:
                maps = _userMappings;
                break;

            case Mappings.SavedBootMappings:
                maps = _savedBootMappings;
                break;

            case Mappings.SavedUserMappings:
                maps = _savedUserMappings;
                break;

            default:
                return;
            }

            RegistryHive hive = 0;
            string       keyname = "", valuename = "";

            RegistryProvider.GetRegistryLocation(whereToSave, ref hive, ref keyname, ref valuename);

            RegistryKey registry = null;

            // Need write access so prepare to fail
            try
            {
                if (hive == RegistryHive.LocalMachine)
                {
                    registry = Registry.LocalMachine.OpenSubKey(keyname, true);
                }
                else if (hive == RegistryHive.CurrentUser)
                {
                    registry = Registry.CurrentUser.OpenSubKey(keyname, true);
                }
            }
            catch (SecurityException ex)
            {
                if (hive == RegistryHive.CurrentUser)
                {
                    // Would expect to be able to write to HKCU
                    Console.WriteLine("Unexpected failure {2} opening {0} on {1} for write access",
                                      keyname, Enum.GetNames(typeof(Mappings))[(int)whichMappings], ex.Message);
                }

                return;
            }

            if (registry == null)
            {
                // Key doesn't exist
                return;
            }

            if (maps.Count == 0)
            {
                registry.SetValue(valuename, new byte[0]);
            }
            else
            {
                registry.SetValue(valuename, GetMappingsAsByteArray(maps));
            }
        }
Esempio n. 55
0
 public void RemoveLocation(MapLocation mapLocation)
 {
     locationsList.Remove(mapLocation.number);
 }
Esempio n. 56
0
 public PowerfulTower(MapLocation location) : base(location)
 {
 }
 public ItemShopSlot(int address, string name, MapLocation mapLocation, Item item, byte shopIndex)
     : base(address, name, mapLocation, item)
 {
     ShopIndex = shopIndex;
 }
Esempio n. 58
0
            /**
             *
             * @param from
             *            unit's current location
             * @param to
             *            the destination
             * @param isHillPassable
             *            true if unit can fly, otherwise false
             * @return a valid plan for the unit to follow (barring movement barriers),
             *         or an empty list of coords if no valid plan is found
             */
            public List<Coords> calculateMovementPlan(Graph g, Coords from, Coords to)
            {
                // run A*
                //Console.WriteLine("Calculating path from " + from + " to " + to);
                AStar astar = new AStar ();
                MapLocation start = new MapLocation (from);
                /*
                List<Connection> conns = g.getConnections(start);
                foreach (Connection conn in conns) {
                    Console.WriteLine("conn from start: " + conn);
                    List<Connection> nextConns = g.getConnections(conn.getToNode());
                    foreach(Connection c2 in nextConns) {
                        Console.WriteLine("second level connections " + c2);
                    }
                }
                */
                MapLocation goal = new MapLocation (to);
                ManhattanHeuristic heuristic = new ManhattanHeuristic (goal);
                List<Connection> path = astar.pathfindAStar (g, start, goal, heuristic);
                // localize plan
                List<Coords> coords = new List<Coords> ();
                if (path != null) {
                    coords = localization (path);
                    /*
                    Console.Write ("Found path: ");
                    foreach(Coords coord in coords) {
                        Console.Write (coord);
                    }
                    Console.WriteLine();
                    */
                } else {
                    Console.WriteLine("no path found");
                }

                return coords;
            }
Esempio n. 59
0
        private void AddBlocker(int x, int y)
        {
            var location = new MapLocation(_data, x, y);

            location.AddThing(Actor.TableWithChairs.ClassName);
        }