コード例 #1
0
ファイル: FloorExit.cs プロジェクト: dxd391285004/DeepDive
        public async Task <bool> Run()
        {
            if (Target.Type != PoiType.Wait)
            {
                return(false);
            }

            //let the navigator handle movement if we are far away
            if (Target.Location.Distance2D(Core.Me.Location) > 3)
            {
                return(false);
            }

            // move closer plz
            if (Target.Location.Distance2D(Core.Me.Location) >= 2)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Floor Exit"), 0.5f, true);

                return(true);
            }

            await CommonTasks.StopMoving();

            var _level = DeepDungeonManager.Level;
            await Coroutine.Wait(-1,
                                 () => Core.Me.InCombat || _level != DeepDungeonManager.Level || CommonBehaviors.IsLoading ||
                                 QuestLogManager.InCutscene);

            Poi.Clear("Floor has changed or we have entered combat");
            Navigator.Clear();
            return(true);
        }
コード例 #2
0
 internal void loadMedia(Poi poi)
 {
     if (poi.isMediaFree())
     {
         this.poiMapperHdd.loadMedia(poi, getPoiSubDir(poi, this.currentNamedArea));
     }
 }
コード例 #3
0
        public async Task <bool> Run()
        {
            if (!Constants.InDeepDungeon)
            {
                return(false);
            }

            if (Target == null)
            {
                return(false);
            }

            if (AvoidanceManager.IsRunningOutOfAvoid)
            {
                return(false);
            }

            if (Navigator.InPosition(Core.Me.Location, Target.Location, 3f) &&
                Target.Type == (PoiType)PoiTypes.ExplorePOI)
            {
                Poi.Clear("We have reached our destination");
                return(true);
            }

            var status =
                $"Current Level {DeepDungeonManager.Level}. Level Status: {PortalPercent}% \"Done\": {DDTargetingProvider.Instance.LevelComplete}";

            TreeRoot.StatusText = status;

            if (ActionManager.IsSprintReady && Target.Location.Distance2D(Core.Me.Location) > 5 &&
                MovementManager.IsMoving)
            {
                ActionManager.Sprint();
                return(true);
            }

            var res = await CommonTasks.MoveAndStop(
                new MoveToParameters(Target.Location, "Moving toward POTD Objective"), 1.5f);

            if (res == false)
            {
                if (Poi.Current.Unit != null)
                {
                    DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, $"Move Failed: Blacklisted {Poi.Current.Unit.EnglishName}");
                }

                Poi.Clear("Clearing poi: Move Failed");
            }

            //if (Target.Unit != null)
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Unit.Name}\" LOS: {Target.Unit.InLineOfSight()}");
            //}
            //else
            //{
            //    Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Name}\" ");
            //}

            return(res);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: lukinfx/Horizont_Final
        static void SplitNameAndAltitude(Poi poi)
        {
            string regexpPattern  = "(.*)\\(([0 - 9]{ 1,4}) m\\.n\\.m\\.\\)(.*)";
            string regexpPattern2 = "(.*)\\(([0-9]{1,4}).*\\).*";

            Regex regex   = new Regex(regexpPattern2);
            var   matches = regex.Matches(poi.Name);

            if (matches.Count == 1)
            {
                var match = matches[0];
                if (match.Groups.Count == 3)
                {
                    if (Int32.TryParse(match.Groups[2].Value, out var alt))
                    {
                        poi.Name     = match.Groups[1].Value;
                        poi.Altitude = alt;
                    }
                    else
                    {
                        Console.WriteLine($"Wrong altitude - {poi.Name}");
                    }
                }
                else
                {
                    Console.WriteLine($"Wrong name - {poi.Name}");
                }
            }
            else
            {
                Console.WriteLine($"No match - {poi.Name}");
            }
        }
コード例 #5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Description")] Poi poi)
        {
            if (id != poi.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(poi);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PoiExists(poi.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(poi));
        }
コード例 #6
0
ファイル: EnableFlight.cs プロジェクト: unfaiyted/ExBuddy
        private async Task <bool> HandleDeath()
        {
            if (Poi.Current.Type != PoiType.Death)
            {
                // We are not dead, continue
                return(false);
            }

            var returnStrategy = Behaviors.GetReturnStrategy();

            await Coroutine.Wait(3000, () => ClientGameUiRevive.ReviveState == ReviveState.Dead);

            var ticks = 0;

            while (ClientGameUiRevive.ReviveState == ReviveState.Dead && ticks++ < 5)
            {
                ClientGameUiRevive.Revive();
                await Coroutine.Wait(5000, () => ClientGameUiRevive.ReviveState != ReviveState.Dead);
            }

            await Coroutine.Wait(15000, () => ClientGameUiRevive.ReviveState == ReviveState.None);

            Poi.Clear("We live!, now to get back to where we were. Using return strategy -> " + returnStrategy);

            await returnStrategy.ReturnToZone();

            if (EnableFlightSettings.Instance.ReturnToLocationOnDeath)
            {
                await returnStrategy.ReturnToLocation();
            }

            return(false);
        }
コード例 #7
0
ファイル: PoiMapperHdd.cs プロジェクト: mitice/foo
        /**
         * Loads Poi media data: media files and main details.
         */
        public void loadMedia(Poi poi, string poiSubDir)
        {
            //Debug.WriteLine("loadMedia: poi sub dir: " + poiSubDir, ToString());
            // load xml document
            XmlDocument poiXmlDoc  = new XmlDocument();
            string      poiXmlPath = getPoiXmlPath(poiSubDir);

            poiXmlDoc.Load(poiXmlPath);
            // get media files
            XmlNode mediaFilesNode = poiXmlDoc.SelectSingleNode("/poi/media_files");

            if (mediaFilesNode != null)
            {
                MediaFilesXmlAdapter mfxa = new MediaFilesXmlAdapter(poi.getMediaFiles());
                mfxa.parse(mediaFilesNode);
            }
            // get main details
            XmlNode mainDetailsNode = poiXmlDoc.SelectSingleNode("/poi/details");

            if (mainDetailsNode != null)
            {
                MainDetailsXmlAdapter mdxa = new MainDetailsXmlAdapter(poi.getMainDetails());
                mdxa.parse(mainDetailsNode);
            }
            string poiMediaFilesPath = getPoiMediaFilesPath(poiSubDir);

            if (poiMediaFilesPath != null)
            {
                loadMediaFiles(poi.getAllMediaFiles(), poiMediaFilesPath);
            }
        }
コード例 #8
0
ファイル: PoiMapperHdd.cs プロジェクト: mitice/foo
        /**
         * Loads Poi basic data: descr, lang and type from xml file
         */
        public void loadData(Poi poi, string poiSubDir)
        {
            //Debug.WriteLine("loadData: poi sub dir: " + poiSubDir, ToString());
            string descr = "";
            string lang  = "";
            string type  = "";
            // load xml document
            XmlDocument poiXmlDoc  = new XmlDocument();
            string      poiXmlPath = getPoiXmlPath(poiSubDir);

            poiXmlDoc.Load(poiXmlPath);
            // get descr
            XmlNode descrNode = poiXmlDoc.SelectSingleNode("/poi/descr");

            descr = descrNode.InnerText;
            // get lang
            XmlNode langNode = poiXmlDoc.SelectSingleNode("/poi/lang");

            lang = langNode.InnerText;
            // get type
            XmlNode typeNode = poiXmlDoc.SelectSingleNode("/poi/type");

            type = typeNode.InnerText;
            // insert data into poi
            poi.insertData(descr, lang, type);
        }
コード例 #9
0
        public async Task <bool> Run()
        {
            if (Target.Type != PoiType.Collect)
            {
                return(false);
            }

            //let the navigation task handle moving toward the object if we are too far away.
            if (Target.Location.Distance2D(Core.Me.Location) > 3)
            {
                return(false);
            }

            if (Target.Unit == null)
            {
                Poi.Clear("Target not found at location");
                return(true);
            }

            //let the user know we are trying to run a treasure task
            TreeRoot.StatusText = "Treasure";
            if (Target.Unit?.NpcId == EntityNames.Hidden)
            {
                return(await HandleCacheOfTheHoard());
            }

            //treasure... or an "exit"...
            return(await TreasureOrExit());
        }
コード例 #10
0
 protected Composite Behavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => QuestId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId,
                              new Action(r =>
     {
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     })
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance,
                              new Action(ret =>
     {
         MovementManager.MoveForwardStop();
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     }
                                         )
                              ),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(ret => Talk.Next())
                              ),
                new Decorator(ret => !UseMesh,
                              new Action(ret => Navigator.PlayerMover.MoveTowards(Position))
                              ),
                new Decorator(ret => UseMesh,
                              CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)
                              ),
                new ActionAlwaysSucceed()
                ));
 }
コード例 #11
0
        public async Task <bool> Run()
        {
            if (Target.Type != PoiType.Wait)
            {
                return(false);
            }

            //let the navigator handle movement if we are far away
            if (Target.Location.Distance2D(Core.Me.Location) > 3)
            {
                return(false);
            }

            // move closer plz
            if (Target.Location.Distance2D(Core.Me.Location) >= 2)
            {
                await CommonTasks.MoveAndStop(new MoveToParameters(Target.Location, "Floor Exit"), 0.5f, true);

                return(true);
            }

            await CommonTasks.StopMoving();

            int _level = DeepDungeonManager.Level;

            _moveTimer.Reset();
            await Coroutine.Wait(-1,
                                 () => Core.Me.InCombat || _level != DeepDungeonManager.Level || CommonBehaviors.IsLoading ||
                                 QuestLogManager.InCutscene || _moveTimer.IsFinished);

            if (_moveTimer.IsFinished)
            {
                if (Poi.Current.Unit != null)
                {
                    if (!Poi.Current.Unit.IsValid)
                    {
                        Logger.Debug("Waited 5 minutes at exit: Blacklisting current exit for 10min not valid");
                        DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, TimeSpan.FromMinutes(10),
                                                                    "Waited at exit(not valid) for 5 minutes");
                    }
                    else
                    {
                        Logger.Debug("Waited 5 minutes at exit: Blacklisting current exit for 5 min");
                        DDTargetingProvider.Instance.AddToBlackList(Poi.Current.Unit, TimeSpan.FromMinutes(5),
                                                                    "Waited at exit for 5 minutes");
                    }
                }
                else
                {
                    Logger.Debug("Waited 5 minutes at exit but poi is null");
                }
                blackList.Add(location);
            }

            GameObjectManager.Update();
            location = Vector3.Zero;
            Poi.Clear("Floor has changed or we have entered combat");
            Navigator.Clear();
            return(true);
        }
コード例 #12
0
        public ServiceResponse PostFile()
        {
            return(new ServiceResponse("Poiler yüklenemedi",
                                       delegate()
            {
                var httpRequest = HttpContext.Current.Request;
                if (httpRequest.Files.Count == 1)
                {
                    var postedFile = httpRequest.Files[0];
                    string extension = postedFile.FileName.Split('.').Last();
                    if (extension != "csv")
                    {
                        return "Lütfen bir .csv dosyası seçiniz!";
                    }
                    CultureInfo ci = new CultureInfo("en-US");

                    var str = new StreamReader(postedFile.InputStream, Encoding.Default).ReadToEnd().Replace("\r", "");
                    var lines = str.Split(new string[1] {
                        "\n"
                    }, StringSplitOptions.None);
                    var keys = lines[0].Split(new string[1] {
                        "\n"
                    }, StringSplitOptions.None);
                    for (int i = 1; i < lines.Length; i++)
                    {
                        var temp = lines[i].Split(';');
                        Category cat = m_CategoryOperations.GetCategory(temp[1]) as Category;
                        if (cat == null)
                        {
                            cat = new Category()
                            {
                                IconID = 1,
                                ListOrder = 999,
                                RenderOrder = 999,
                                Name = temp[1]
                            };
                            cat = m_CategoryOperations.CreateCategory(cat) as Category;
                        }
                        Poi poi = new Poi();
                        poi.CustomID = temp[0];
                        poi.CategoryID = cat.ID;
                        poi.ProvinceID = Int32.Parse(temp[2], ci);
                        poi.DistrictID = Int32.Parse(temp[3], ci);
                        poi.NeighborhoodID = Int32.Parse(temp[4], ci);
                        poi.TableName = temp[5];
                        poi.Longitude = double.Parse(temp[6].Replace(',', '.'), ci);
                        poi.Longitude = double.Parse(temp[7].Replace(',', '.'), ci);
                        poi.Address = temp[8];
                        m_PoiOperations.CreatePoi(poi);
                    }

                    return "";
                }
                else
                {
                    return "Lütfen bir dosya seçiniz";
                }
            }));
        }
コード例 #13
0
        public void MergeFrom(GameEntity other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Poi:
                if (Poi == null)
                {
                    Poi = new global::WUProtos.Data.Client.ClientMapPoi();
                }
                Poi.MergeFrom(other.Poi);
                break;

            case TypeOneofCase.Trace:
                if (Trace == null)
                {
                    Trace = new global::WUProtos.Data.Client.ClientMapTrace();
                }
                Trace.MergeFrom(other.Trace);
                break;

            case TypeOneofCase.Landmark:
                if (Landmark == null)
                {
                    Landmark = new global::WUProtos.Data.Client.ClientMapLandmark();
                }
                Landmark.MergeFrom(other.Landmark);
                break;

            case TypeOneofCase.PotionIngredient:
                if (PotionIngredient == null)
                {
                    PotionIngredient = new global::WUProtos.Data.Client.ClientMapPotionIngredient();
                }
                PotionIngredient.MergeFrom(other.PotionIngredient);
                break;

            case TypeOneofCase.Weather:
                if (Weather == null)
                {
                    Weather = new global::WUProtos.Data.Client.ClientWeather();
                }
                Weather.MergeFrom(other.Weather);
                break;

            case TypeOneofCase.EnvironmentTags:
                if (EnvironmentTags == null)
                {
                    EnvironmentTags = new global::WUProtos.Data.Client.ClientEnvironmentTags();
                }
                EnvironmentTags.MergeFrom(other.EnvironmentTags);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
コード例 #14
0
ファイル: PoiBrowser.cs プロジェクト: mitice/foo
 private void removeTarget(Object sender, EventArgs args)
 {
     if (this.targetToRemove != null)
     {
         this.listBoxTargets.Items.Remove(this.targetToRemove);
         this.targetToRemove = null;
     }
 }
コード例 #15
0
        public ActionResult DeleteConfirmed(int id)
        {
            Poi poi = db.Poi.Find(id);

            db.Poi.Remove(poi);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #16
0
ファイル: PoiMapperHdd.cs プロジェクト: mitice/foo
        public Poi get(string poiSubDir)
        {
            Poi poi = getEmpty(poiSubDir);

            loadData(poi, poiSubDir);
            loadMedia(poi, poiSubDir);
            return(poi);
        }
コード例 #17
0
ファイル: PoiViewItem.cs プロジェクト: lukinfx/Horizont_Final
 public PoiViewItem(Poi poi)
 {
     Poi         = poi;
     GpsLocation = new GpsLocation()
     {
         Latitude = this.Poi.Latitude, Longitude = this.Poi.Longitude, Altitude = this.Poi.Altitude
     };
 }
コード例 #18
0
        public async Task <bool> Run()
        {
            if (!Constants.InDeepDungeon)
            {
                return(false);
            }

            if (Target == null)
            {
                return(false);
            }

            /*
             * if (!Core.Me.InCombat && Target.Type == PoiType.Quest && DeepDungeonManager.BossFloor)
             * {
             *  Poi.Clear("QUEST_POI");
             *  Navigator.Clear();
             *  foreach (Avoid a in AvoidanceManager.Avoids)
             *      AvoidanceManager.RemoveAvoid(a.AvoidInfo);
             *
             *  AvoidanceManager.ResetNavigation();
             *  Navigator.NavigationProvider.ClearStuckInfo();
             *  GameObjectManager.Update();
             *
             * }
             */
            if (Navigator.InPosition(Core.Me.Location, Target.Location, 3f) &&
                Target.Type == (PoiType)PoiTypes.ExplorePOI)
            {
                Poi.Clear("We have reached our destination");
                return(true);
            }

            string status = string.Format("Current Level {0}. Level Status: {1}% \"Done\": {2}",
                                          DeepDungeonManager.Level,
                                          PortalPercent, DDTargetingProvider.Instance.LevelComplete);

            TreeRoot.StatusText = status;

            if (ActionManager.IsSprintReady && Target.Location.Distance2D(Core.Me.Location) > 5 &&
                MovementManager.IsMoving)
            {
                ActionManager.Sprint();
                return(true);
            }

            bool res = await CommonTasks.MoveAndStop(
                new MoveToParameters(Target.Location, $"Moving toward HoH Objective: {Target.Name}"), 1.5f);

            //            if (Target.Unit != null)
            //                Logger.Verbose(
            //                    $"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Unit.Name}\" LOS: {Target.Unit.InLineOfSight()}");
            //            else
            //                Logger.Verbose($"[PotdNavigator] Move Results: {res} Moving To: \"{Target.Name}\" ");


            return(res);
        }
コード例 #19
0
ファイル: Billboard.cs プロジェクト: dokuhl/mapmo-ar-core
    public void init(double bb_lat, double bb_lon, double bb_bearing, Poi poi)
    {
        transform           = GetComponent <Transform>();
        mainCameraTransform = Camera.main.transform;
        transform.name      = poi.basic_poi.original_name;

        this.poi = poi;
        //this.h_signboard = poi.signboard.GetComponent<Signboard>().h;
        lat     = bb_lat;
        lon     = bb_lon;
        bearing = bb_bearing;
        if (map == null)
        {
            map = GameObject.Find("Map").GetComponent <Map>();
        }



        //initialize view & content
        if (!gameObject.activeSelf)
        {
            return;
        }
        loadImage(poi.basic_poi.bv_image);
        billboardColor = map.poi_handler.GetComponent <PoiHandler>().getColorForCategory(poi.basic_poi.super_categories);
        GetComponent <Image>().color   = billboardColor;
        GetComponent <Light>().color   = billboardColor;
        GetComponent <Light>().enabled = false;

        ColorBlock cbBtn = transform.Find("detail_panel/btn_expand").gameObject.GetComponent <Button>().colors;

        cbBtn.normalColor = billboardColor;
        transform.Find("detail_panel/btn_expand").gameObject.GetComponent <Button>().colors = cbBtn;
        transform.Find("basic_panel/btn_expand").gameObject.GetComponent <Button>().colors  = cbBtn;

        transform.Find("detail_panel/btn_expand/title_bar/txt_title").gameObject.GetComponent <Text>().text = poi.basic_poi.original_name;
        transform.Find("basic_panel/btn_expand/txt_title").gameObject.GetComponent <Text>().text            = poi.basic_poi.original_name;

        if (poi.basic_poi.icon != null && !poi.basic_poi.icon.Equals(""))
        {
            Texture2D texture = Resources.Load("icons/" + poi.basic_poi.icon.Substring(0, poi.basic_poi.icon.Length - 4), typeof(Texture2D)) as Texture2D;
            if (texture != null)
            {
                transform.Find("basic_panel/btn_expand/img_pictogram").gameObject.GetComponent <UnityEngine.UI.Image>().sprite            = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
                transform.Find("icon_panel/btn_expand/img_pictogram").gameObject.GetComponent <UnityEngine.UI.Image>().sprite             = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
                transform.Find("detail_panel/btn_expand/title_bar/img_pictogram").gameObject.GetComponent <UnityEngine.UI.Image>().sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0));
            }
        }


        //rotate billboard

        angle = 180 - map.horizontalFov / 2 - 90;
        transform.localScale = new Vector3(initialScale, initialScale, initialScale);
        transform.Rotate(Vector3.up, (float)bb_bearing - 270f);

        updateBillboard();
    }
コード例 #20
0
        private async void ExecuteSave(object obj)
        {
            var   store = AppStore.Instance;
            Place tmp   = null;

            switch (Type)
            {
            case PlaceType.CampingPlace:
                tmp = new CampingPlace();
                break;

            case PlaceType.Hotel:
                tmp = new Hotel();
                break;

            case PlaceType.MotorhomePlace:
                tmp = new MotorhomePlace();
                break;

            case PlaceType.Restaurant:
                tmp = new Restaurant();
                break;

            case PlaceType.Poi:
                tmp = new Poi();
                break;
            }

            tmp.Latitude    = Latitude;
            tmp.Longitude   = Longitude;
            tmp.Rating      = Rating;
            tmp.Altitude    = Altitude;
            tmp.Created     = DateTimeOffset.Now;
            tmp.Description = Description;
            tmp.Name        = Name;
            tmp.PlaceId     = Guid.NewGuid();
            tmp.Trip        = store.CurrentTrip;
            tmp.TripId      = store.CurrentTrip.TripId;

            var trips   = store.User.Trips;
            var tripIdx = trips.IndexOf(store.CurrentTrip);

            // Add new Place to local Collection
            store.User.Trips[tripIdx].Places.Add(tmp);

            // Save to CloudStore
            var tmpPlace = await PlaceStore.AddItemAsync(tmp);

            if (tmpPlace != null)
            {
                SavePlaceSuccessCallback?.Invoke(true);
            }
            else
            {
                SavePlaceSuccessCallback?.Invoke(false);
            }
        }
コード例 #21
0
ファイル: MapViewBuilder.cs プロジェクト: mitice/foo
        public void loadTarget()
        {
            double latitude      = this.currentGpsLocation.getLatitude();
            double longitude     = this.currentGpsLocation.getLongitude();
            Poi    currentTarget = this.targets.getCurrent(latitude, longitude);

            Debug.WriteLine("updateCurrentTarget: " + currentTarget, this.ToString());
            this.currentMapVeiw.setTarget(currentTarget);
        }
コード例 #22
0
        internal static void ClearPoi(string reason, bool sendLog)
        {
            if (sendLog)
            {
                Logger.SendLog(reason);
            }

            Poi.Clear(reason);
        }
コード例 #23
0
ファイル: PoiDatabase.cs プロジェクト: lukinfx/Horizont_Final
        public int UpdateItem(Poi item)
        {
            item.NameNoAccent = item.Name.RemoveDiacritics().ToLower();

            var task = Database.UpdateAsync(item);

            task.Wait();
            return(task.Result);
        }
コード例 #24
0
 public void Delete(Poi poi)
 {
     if (_context.Entry(poi).State == EntityState.Detached)
     {
         dbSet.Attach(poi);
     }
     dbSet.Remove(poi);
     _context.SaveChanges();
 }
コード例 #25
0
ファイル: Targets.cs プロジェクト: mitice/foo
 public void remove(Poi target)
 {
     Debug.WriteLine("remove: " + target, this.ToString());
     lock (targets)
     {
         targets.Remove(target);
         targetsAreas.Remove(target);
     }
 }
コード例 #26
0
ファイル: Targets.cs プロジェクト: mitice/foo
        private Area createTargetArea(Poi target)
        {
            double topLeftLat     = target.getLatitude() + maxLatitudeToTarget;
            double topLeftLon     = target.getLongitude() - maxLongitudeToTarget;
            double bottomRightLat = target.getLatitude() - maxLatitudeToTarget;
            double bottomRightLon = target.getLongitude() + maxLongitudeToTarget;

            return(new Area(topLeftLat, topLeftLon, bottomRightLat, bottomRightLon));
        }
コード例 #27
0
ファイル: PoiDatabase.cs プロジェクト: lukinfx/Horizont_Final
        public int InsertItemAsync(Poi item)
        {
            item.NameNoAccent = item.Name.RemoveDiacritics().ToLower();

            var task = Database.InsertAsync(item);

            task.Wait();
            return(task.Result);
        }
コード例 #28
0
            public override void OnClickedMapPoi(BMKMapView mapView, BMKMapPoi mapPoi)
            {
                Poi poi = new Poi {
                    Coordinate  = mapPoi.Pt.ToUnity(),
                    Description = mapPoi.Description
                };

                map.Map.SendPoiClicked(poi);
            }
コード例 #29
0
 public async Task <IActionResult> Create([Bind("Id,Description,Lat,Long,Name")] Poi poi)
 {
     if (ModelState.IsValid)
     {
         _poiIRepository.Create(poi);
         _poiIRepository.Save();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(poi));
 }
コード例 #30
0
 public static DomainItineraryItem ToDomainItineraryItem(DbItineraryItem it, Poi poi)
 {
     return(new DomainItineraryItem
     {
         ItineraryItemId = it.ItineraryItemId,
         Description = it.Description,
         Title = it.Title,
         Poi = poi
     });
 }
コード例 #31
0
 public Poi MakeTestPoi()
 {
     var poi = new Poi(new PoIAttributes());
     poi.l = new Point3f(new[] { 35.915426, -78.743379, 0 });
     poi.Name.Value = "Shannon";
     poi.Description.Value = "This is a test point";
     poi.Minaccuracy.Value = 100;
     poi.Maxdistance.Value = 500;
     poi.Mimetype.Value = Mimetype.image_png;
     poi.Mainresource.Value =
         "http://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/PNG_transparency_demonstration_2.png/280px-PNG_transparency_demonstration_2.png";
     poi.Thumbnail.Value =
         "http://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/PNG_transparency_demonstration_2.png/280px-PNG_transparency_demonstration_2.png";
     poi.Homepage.Value = new Uri("http://www.prototypic.net");
     return poi;
 }
コード例 #32
0
 private void HandleElements(Poi result, XElement poiNode)
 {
     poiNode.Add(MakeElement("name", result.Name.Value, true));
     poiNode.Add(MakeElement("description", result.Description.Value,true));
     poiNode.Add(MakeElement("date", result.Date.Value));
     poiNode.Add(MakeElement("l", result.l.Value));
     poiNode.Add(MakeElement("o", result.o.Value));
     poiNode.Add(MakeElement("minaccuracy", result.Minaccuracy.Value));
     poiNode.Add(MakeElement("maxdistance", result.Maxdistance.Value));
     poiNode.Add(MakeElement("mime-type", result.Mimetype.Value.ToString().Replace('_','/')));
     poiNode.Add(MakeElement("mainresource", result.Mainresource.Value));
     poiNode.Add(MakeElement("thumbnail", result.Thumbnail.Value));
     poiNode.Add(MakeElement("icon", result.Icon.Value));
     poiNode.Add(MakeElement("phone", result.Phone.Value));
     poiNode.Add(MakeElement("mail", result.Mail.Value));
     poiNode.Add(MakeElement("homepage", result.Homepage.Value));
 }
コード例 #33
0
 public Results MakeResult(Poi poi)
 {
     var result = new Results(poi);
     return result;
 }
コード例 #34
0
 public void Poi_CreatesValueOfItself()
 {
     var poi = new Poi();
     poi.Value.Should().Be(poi);
 }
コード例 #35
0
 public void Poi_WithAttributesInConstructor_ResultsInAttributesDefinedInPoiResult()
 {
     var poi = new Poi(new PoIAttributes("someID", InteractionFeedbackType.Click));
     poi.AttributeCollection.IdAttr.Should().Be("someID");
     poi.AttributeCollection.InteractionFeedbackAttr.Should().Be(InteractionFeedbackType.Click);
 }
コード例 #36
0
 public void Poi_WithNoAttributesDefined_ResultsInDefaults()
 {
     var poi = new Poi();
     poi.AttributeCollection.IdAttr.Should().NotBeNullOrEmpty();
     poi.AttributeCollection.InteractionFeedbackAttr.Should().Be(InteractionFeedbackType.None);
 }
コード例 #37
0
        public void fillPois(Company company)
        {
            foreach (User user in company.Users) {
                List<Poi> pois = new List<Poi>();
                try {
                    mysqlConnection = new MySqlConnection(database.getConnectionString());

                    mysqlConnection.Open();

                    string sql =
                        "SELECT * " +
                        "FROM cmp_" + company.DatabaseName + ".poi_" + user.DatabaseName + ";";

                    MySqlCommand mySqlCommand = new MySqlCommand(sql, mysqlConnection);

                    MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();

                    if (!mySqlDataReader.HasRows) {
                        mySqlDataReader.Dispose();
                    } else {
                        while (mySqlDataReader.Read()) {
                            //Poi poi = new Poi();
                            //poi.id = mySqlDataReader.GetInt32("poi_id");
                            //poi.name = mySqlDataReader.GetString("poi_name");
                            //poi.description = mySqlDataReader.GetString("poi_desc");
                            //poi.image = mySqlDataReader.GetString("poi_img");
                            //poi.location = new Coordinate(double.Parse(mySqlDataReader.GetString("poi_lat")),
                            //                            double.Parse(mySqlDataReader.GetString("poi_lon")));
                            //pois.Add(poi);
                            Poi poi = new Poi();
                            poi.Id = mySqlDataReader.GetInt32("poi_id");
                            poi.Name = mySqlDataReader.GetString("poi_name");
                            poi.Description = mySqlDataReader.GetString("poi_desc");
                            poi.Image = mySqlDataReader.GetString("poi_img");

                            string poiLatitude = mySqlDataReader.GetString("poi_lat");
                            string potLongitude = mySqlDataReader.GetString("poi_lon");

                            if (!String.IsNullOrEmpty(poiLatitude) || !String.IsNullOrEmpty(potLongitude)) {
                                poi.Coordinate = new Coordinate(
                                        double.Parse(poiLatitude),
                                        double.Parse(potLongitude)
                                        );
                            }

                            pois.Add(poi);
                        }

                        user.Pois = pois;
                        mySqlDataReader.Dispose();
                    }
                } catch (MySqlException mySqlException) {
                    throw new QueryException(1, mySqlException.Message);
                } catch (QueryException queryException) {
                    throw queryException;
                } catch (Exception exception) {
                    throw new QueryException(1, exception.Message);
                } finally {
                    mysqlConnection.Close();
                }
            }
        }