Example #1
0
 public void RemoveBuilding(RhitLocation location)
 {
     if (Buildings.Contains(location))
     {
         Buildings.Remove(location);
     }
 }
Example #2
0
        private void UpdateLayers(ICollection <RhitLocation> locations)
        {
            LabeledLocations.Clear();
            Outlines.Clear();
            PolygonLayer.Children.Clear();
            TextLayer.Children.Clear();

            foreach (RhitLocation location in locations)
            {
                MapPolygon polygon = location.OutLine;
                if (polygon.Locations == null || polygon.Locations.Count <= 0)
                {
                    continue;
                }
                PolygonLayer.Children.Add(polygon);
                if (!AreOutlinesVisible)
                {
                    RhitLocation.HideOutline(polygon);
                }
                polygon.MouseLeftButtonUp += new MouseButtonEventHandler(Outline_Tap);
                Outlines[polygon]          = location;
                LabeledLocations[location] = location.GetLabel();
                if (ShouldShowLabel(location))
                {
                    TextLayer.Children.Add(LabeledLocations[location]);
                }
            }
        }
Example #3
0
 public void AddBuilding(RhitLocation location)
 {
     if (!Buildings.Contains(location))
     {
         Buildings.Add(location);
     }
 }
Example #4
0
 private bool ShouldShowLabel(RhitLocation location)
 {
     //TODO: Add logic to handle maps with text on them already
     if (!AreLabelsVisible)
     {
         return(false);
     }
     //if(Controller.MapControl.ZoomLevel < location.MinZoomLevel) return false;
     return(true);
 }
Example #5
0
        public RhitLocation ToRhitLocation()
        {
            LocationCollection locations = new LocationCollection();

            if (LocationData != null && LocationData.Locations != null)
            {
                foreach (GeoCoordinate_DC coordinate in LocationData.Locations)
                {
                    locations.Add(coordinate.ToGeoCoordinate());
                }
            }
            Dictionary <string, string> links = new Dictionary <string, string>();

            if (Links != null)
            {
                foreach (Link_DC link in Links)
                {
                    links[link.Name] = link.Url;
                }
            }

            RhitLocation location = new RhitLocation()
            {
                Center       = Center.ToGeoCoordinate(),
                Locations    = locations,
                Id           = Id,
                Description  = Description,
                Label        = Label,
                Type         = ConvertTypeKeyToType(Type),
                Links        = links,
                IsDepartable = IsDepartable,
                AltNames     = AltNames,
                ParentId     = ParentId,
            };

            if (LocationData != null)
            {
                location.MinZoomLevel  = LocationData.MinZoomLevel;
                location.LabelOnHybrid = LocationData.LabelOnHybrid;
            }
            return(location);
        }
Example #6
0
        private void AddNode(RhitLocation location)
        {
            if (location.Id < 0)
            {
                return;
            }
            if (TempDict.ContainsKey(location.Id))
            {
                return;
            }
            LocationNode node = new LocationNode()
            {
                Name = location.Label,
                Id   = location.Id,
            };

            if (location.ParentId <= 0)
            {
                LocationTree.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            if (TempDict.ContainsKey(location.ParentId))
            {
                TempDict[location.ParentId].ChildLocations.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            if (Locations.ContainsKey(location.ParentId))
            {
                AddNode(Locations[location.ParentId]);
                TempDict[location.ParentId].ChildLocations.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            LocationTree.Add(node);
            TempDict[location.Id] = node;
        }
Example #7
0
        public void SelectLocation(RhitLocation location)
        {
            LocationEventArgs args = new LocationEventArgs();

            args.OldLocation = CurrentLocation;
            CurrentLocation  = location;
            args.NewLocation = CurrentLocation;

            InnerLocations.Clear();
            List <RhitLocation> locations = DataCollector.Instance.GetChildLocations(null, CurrentLocation.Id);

            if (locations != null)
            {
                foreach (RhitLocation child in locations)
                {
                    InnerLocations.Add(child);
                }
            }

            OnCurrentLocationChanged(args);
        }
Example #8
0
 private void UpdatePolygons()
 {
     if (Outlines == null)
     {
         return;
     }
     if (AreOutlinesVisible)
     {
         foreach (MapPolygon polygon in Outlines.Keys)
         {
             RhitLocation.ShowOutline(polygon);
         }
     }
     else
     {
         foreach (MapPolygon polygon in Outlines.Keys)
         {
             RhitLocation.HideOutline(polygon);
         }
     }
 }
Example #9
0
 private void CurrentLocationChanged(object sender, LocationEventArgs e)
 {
     if (!AreOutlinesVisible)
     {
         if (e.NewLocation == null)
         {
             RhitLocation.HideOutline(e.OldLocation.OutLine);
         }
         else
         {
             if (e.OldLocation != null)
             {
                 RhitLocation.HideOutline(e.OldLocation.OutLine);
             }
             RhitLocation.ShowOutline(e.NewLocation.OutLine);
         }
     }
     if (e.NewLocation != null)
     {
         MapControl.Center = e.NewLocation.Center;
     }
 }
Example #10
0
 public void GetLocationDescription(Dispatcher dispatcher, RhitLocation location)
 {
     GetLocationDescription(dispatcher, location.Id);
 }
Example #11
0
 public List <RhitLocation> GetChildLocations(Dispatcher dispatcher, RhitLocation parent)
 {
     return(GetChildLocations(dispatcher, parent.Id));
 }