Inheritance: PropertyChangedBase, IContent, IComparable, IConvertibleGeoJson, ITextSearchable
Ejemplo n.º 1
0
        public static void LoadImage(byte[] imageData, BaseContent c)
        {

            BitmapSource bs = new BitmapImage();
            LoadImage(imageData, ref bs);
            Execute.OnUIThread(() =>
            {
                c.Style.Picture = c.NEffectiveStyle.Picture = bs;
                c.TriggerUpdated();

            });
        }
Ejemplo n.º 2
0
 public void SetPriority(BaseContent c, FrameworkElement b)
 {
     var m = GetMenu(b);
     for (int i = 1; i < 4; i++)
     {
         
         var mi = m.AddMenuItem(i.ToString());
         mi.FontSize = 34;
         var v = i;
         mi.Click += (s, e) =>
         {
             c.PoiPriority = v;
             
         };
     }
    
     AppState.Popups.Add(m);
 }
Ejemplo n.º 3
0
 public void SetLocation(BaseContent poi, string city, string zipCode, string street, string houseNumber,
     string country = "NL")
 {
     if (canUseBag)
     {
         double[] position = LatLongLookup.FromZipCode(zipCode, houseNumber);
         if (position != null)
         {
             poi.Position = new Position(position[0], position[1]);
             return;
         }
     }
     try
     {
         Thread.Sleep(1000);
         GoogleAddress address =
             GeoCoder.GeoCode(string.Format("{0} {1}, {2}, {3}", street, houseNumber, city, country))
                 .FirstOrDefault();
         if (address == null) return;
         poi.Position = new Position(address.Coordinates.Longitude, address.Coordinates.Latitude);
     }
     catch (Exception)
     {
         try
         {
             Thread.Sleep(3000);
             GoogleAddress address =
                 GeoCoder.GeoCode(string.Format("{0} {1}, {2}, {3}", street, houseNumber, city, country))
                     .FirstOrDefault();
             if (address == null) return;
             poi.Position = new Position(address.Coordinates.Longitude, address.Coordinates.Latitude);
         }
         catch (Exception e)
         {
             AppStateSettings.Instance.TriggerNotification(e.Message);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Calculate the center of a polygon PoI and set its position accordingly.
 /// </summary>
 /// <param name="poi"></param>
 /// <returns></returns>
 private static Position CalculateCenter(BaseContent poi)
 {
     var points = poi.Points;
     if (points == null || points.Count == 0) return new Position(0, 0);
     var x = points.Average(p => p.X);
     var y = points.Average(p => p.Y);
     poi.Position = new Position(x, y);
     return poi.Position;
 }
Ejemplo n.º 5
0
 private void ConvertPointsToPolygon(BaseContent p, PoiGraphic g)
 {
     var pc = ConvertPointsToPointCollection(p);
     if (pc == null) return;
     var polygon = new Polygon();
     pc.Add(pc[0]); // Close the loop
     polygon.Rings.Add(pc);
     g.SetGeometry(polygon);
 }
Ejemplo n.º 6
0
 public new void UpdatePosition(BaseContent p) {
     if (p.Position == null) return;
     try
     {
         base.UpdatePosition(p);
         if (!p.NEffectiveStyle.Visible.Value) return;
         var m = mercator.FromGeographic(p.Position.ToMapPoint()) as MapPoint;
         if (!p.Data.ContainsKey("graphic")) return;
         Execute.OnUIThread(() =>
         {
             var sg = ((StaticGraphic)p.Data["graphic"]);
             sg.SetGeometry(m);
             if (sg.ImageGraphic == null) return;
             var pms = (PictureMarkerSymbol) sg.ImageGraphic.Symbol;
             sg.ImageGraphic.Geometry = m;
             if (p.Position != null && Math.Abs(pms.Angle - p.Position.Course) > 0.001) pms.Angle = p.Position.Course;
         });
     }
     catch (SystemException e) {
         Logger.Log("dsStaticLayer.UpdatePosition", "Unhandled exception", e.Message, Logger.Level.Error);                
     }
 }
Ejemplo n.º 7
0
 private static TrackPoiType GetTrackPoiType(BaseContent poi)
 {
     TrackPoiType trackPoiType;
     Enum.TryParse(poi.ContentId, out trackPoiType);
     return trackPoiType;
 }
Ejemplo n.º 8
0
        private async void OnPoiDeleted(BaseContent poi, TrackPoiType trackPoiType)
        {
            if (isDeleting) return;
            AppState.TriggerDeleteNotification(notification);

            switch (trackPoiType)
            {
                default:
                    isDeleting = true;
                    await RemoveRoute(poi);
                    isDeleting = false;
                    break;
                case TrackPoiType.WayPoint:
                    var wayPoint = WayPoints.FirstOrDefault(w => w.Id == poi.Id);
                    if (wayPoint != null) WayPoints.Remove(wayPoint);
                    ResetPath();
                    DrawRoute();
                    break;
            }
        }
Ejemplo n.º 9
0
 private static bool CanPoiBeEvaluated(BaseContent poi)
 {
     return poi.Labels.Any(label => label.Key.StartsWith(LabelKey));
 }
Ejemplo n.º 10
0
 private static double GetSensorValue(BaseContent bc, string key)
 {
     var fvalue = 0d;
     if (bc.Sensors.Count > 0 && bc.Sensors.ContainsKey(key))
         fvalue = bc.Sensors[key].FocusValue;
     return fvalue;
 }
Ejemplo n.º 11
0
        public virtual void CalculateResult(BaseContent bc)
        {
            switch (HighlighterType)
            {
                case HighlighterTypes.Direct:
                    break;
                case HighlighterTypes.FilterThreshold:
                    double fvalue = 0;
                    var svalue = string.Empty;
                    if (UsesMultipleCriteria) {
                        fvalue = CalculateResultUsingMultipleCriteria(bc);
                    }
                    else {
                        switch (SelectionType)
                        {
                            case SelectionTypes.Label:
                                try
                                {
                                    switch (ValueType)
                                    {
                                        case ValueTypes.Number:
                                            fvalue = ParseLabelToDouble(bc, SelectionCriteria);
                                            break;
                                        case ValueTypes.String:
                                            if (!bc.Labels.ContainsKey(SelectionCriteria)) break;
                                            if (ValueType == ValueTypes.String) svalue = bc.Labels[SelectionCriteria];
                                            break;
                                    }                                    
                                }
                                catch (SystemException e)
                                {
                                    Console.WriteLine(e.Message);
                                }
                                break;
                            case SelectionTypes.Sensor:
                                fvalue = GetSensorValue(bc, SelectionCriteria);
                                break;
                        }
                    }

                    switch (ValueType)
                    {
                        case ValueTypes.Number:
                            switch (ThresholdType)
                            {
                                case ThresholdTypes.LessOrEqual:
                                    bc.NAnalysisStyle.Visible = fvalue <= ThresHoldValue;
                                    break;
                                case ThresholdTypes.GreaterOrEqual:
                                    bc.NAnalysisStyle.Visible = fvalue > ThresHoldValue;
                                    break;
                                case ThresholdTypes.NotEqual:
                                    bc.NAnalysisStyle.Visible = Math.Abs(fvalue - ThresHoldValue) > 0.000001;
                                    break;
                                case ThresholdTypes.Equal:
                                    bc.NAnalysisStyle.Visible = Math.Abs(fvalue - ThresHoldValue) < 0.000001;
                                    break;
                                case ThresholdTypes.Greater:
                                    bc.NAnalysisStyle.Visible = fvalue > ThresHoldValue;
                                    break;
                                case ThresholdTypes.Less:
                                    bc.NAnalysisStyle.Visible = fvalue < ThresHoldValue;
                                    break;
                            }
                            break;
                        case ValueTypes.String:
                            switch (ThresholdType)
                            {
                                case ThresholdTypes.Equal:
                                    bc.NAnalysisStyle.Visible = string.Equals(svalue, StringValue, StringComparison.InvariantCultureIgnoreCase);
                                    break;
                                case ThresholdTypes.NotEqual:
                                    bc.NAnalysisStyle.Visible = !string.Equals(svalue, StringValue, StringComparison.InvariantCultureIgnoreCase);
                                    break;
                                case ThresholdTypes.Greater:
                                    bc.NAnalysisStyle.Visible = String.CompareOrdinal(svalue, StringValue) > 0;
                                    break;
                                case ThresholdTypes.GreaterOrEqual:
                                    bc.NAnalysisStyle.Visible = String.CompareOrdinal(svalue, StringValue) >= 0;
                                    break;
                                case ThresholdTypes.Less:
                                    bc.NAnalysisStyle.Visible = String.CompareOrdinal(svalue, StringValue) < 0;
                                    break;
                                case ThresholdTypes.LessOrEqual:
                                    bc.NAnalysisStyle.Visible = String.CompareOrdinal(svalue, StringValue) <= 0;
                                    break;
                                case ThresholdTypes.Contains:
                                    bc.NAnalysisStyle.Visible = svalue.Contains(StringValue);
                                    break;
                                case ThresholdTypes.DoesNotContain:
                                    bc.NAnalysisStyle.Visible = !svalue.Contains(StringValue);
                                    break;
                            }
                            break;
                    }
                    break;
                case HighlighterTypes.Highlight:
                    double value = 0;
                    if (UsesMultipleCriteria)
                        value = CalculateResultUsingMultipleCriteria(bc);
                    else {
                        if (SelectionCriteria != null)
                        {
                            switch (SelectionType)
                            {
                                case SelectionTypes.Label:
                                    value = ParseLabelToDouble(bc, SelectionCriteria);
                                    break;
                                case SelectionTypes.Selected:
                                    var poi = bc as DataServer.PoI;
                                    if (poi == null) break;
                                    value = poi.IsSelected ? MaxValue : MinValue;
                                    if (VisualType == VisualTypes.StrokeWidth)
                                        value = (value / 10 - 0.1) * MaxValue;
                                    // Compensate for weird GetStrokeWidth function 
                                    break;
                                case SelectionTypes.Sensor:
                                    value = GetSensorValue(bc, SelectionCriteria);
                                    break;
                            }
                        }
                    }

                    switch (VisualType)
                    {
                        case VisualTypes.FillColor:
                            if (ValueType == ValueTypes.String && SelectionCriteria != null  && bc.Labels.ContainsKey(SelectionCriteria))
                                bc.NAnalysisStyle.FillColor = GetStringHighlightColor(this, bc.Labels[SelectionCriteria]);
                            else
                                bc.NAnalysisStyle.FillColor = GetHighlightColor(this, value);
                            break;
                        case VisualTypes.Opacity:
                            bc.NAnalysisStyle.StrokeOpacity = bc.NAnalysisStyle.FillOpacity = GetOpacity(this, value);
                            break;
                        case VisualTypes.Icon:
                            if (SelectionCriteria != null && bc.Labels.ContainsKey(SelectionCriteria))
                            {
                                var newIcon = GetIcon(this, bc.Labels[SelectionCriteria]);
                                if (File.Exists(Path.Combine(bc.Service.MediaFolder, newIcon))) bc.NAnalysisStyle.Icon = newIcon;
                                else 
                                {
                                    // Icon (newIcon) not found in media directory, create default error icon (to show on the map)
                                    try
                                    {
                                        var icon_not_found = "icon_not_found_" + newIcon;
                                        if (!File.Exists(Path.Combine(bc.Service.MediaFolder, icon_not_found)))
                                        {
                                            
                                            var errorIcon =
                                                new BitmapImage(
                                                    new Uri(
                                                        "pack://application:,,,/csCommon;component/Resources/Icons/IconNotFound.png"));

                                            var encoder = new PngBitmapEncoder();
                                            encoder.Frames.Add(BitmapFrame.Create((BitmapImage)errorIcon));
                                            using (
                                                var filestream =
                                                    new FileStream(
                                                        Path.Combine(bc.Service.MediaFolder, icon_not_found),
                                                        FileMode.Create)) encoder.Save(filestream);
                                        }
                                        bc.NAnalysisStyle.Icon = icon_not_found;
                                    }
                                    catch (Exception)
                                    {
                                        // Dont care
                                    }

                                    
                                }
                            }
                            break;
                        case VisualTypes.StrokeWidth:
                            bc.NAnalysisStyle.StrokeWidth = GetStrokeWidth(this, value);
                            break;
                        case VisualTypes.StrokeColor:
                            bc.NAnalysisStyle.StrokeColor = GetHighlightColor(this, value);
                            break;
                        case VisualTypes.SymbolSize:
                            bc.NAnalysisStyle.IconHeight = bc.NAnalysisStyle.IconWidth = GetSymbolSize(this, value);
                            break;
                    }
                    break;
            }
        }
Ejemplo n.º 12
0
 public override void CalculateResult(BaseContent bc)
 {
     string userIdentity;
     if (!bc.Labels.TryGetValue(SelectionCriteria, out userIdentity)) return;
     if (userIdentity.ToLower().Contains(StringValue))
         bc.NAnalysisStyle.Visible = false;
 }
Ejemplo n.º 13
0
        public KeywordFilter(BaseContent bc, string label, string keyword, string title = "Keyword filter")
        {
            StringValue = keyword.ToLower();
            SelectionCriteria = label;

            Title = title;
            HighlighterType = HighlighterTypes.FilterThreshold;
            PoiType = bc.ContentId;
            SelectionType = SelectionTypes.Label;
            ValueType = ValueTypes.String;
            VisualType = VisualTypes.Icon;
            ThresholdType = ThresholdTypes.DoesNotContain;
            MaxValue = double.MaxValue; // Set to prevent the filter from calculating the min and max.
        }
Ejemplo n.º 14
0
 private void s_PingReceived(Service s, BaseContent b)
 {
     var wm = new WebMercator();
     var pos = (MapPoint)wm.FromGeographic(new MapPoint(b.Position.Longitude, b.Position.Latitude));
     var pcov = new PingCallOutViewModel { Ping = b };
     var callOut = new MapCallOutViewModel
     {
         Width = 250,
         TimeOut = new TimeSpan(0, 0, 0, 5),
         CanClose = false,
         ForegroundBrush = Brushes.White,
         BackgroundBrush = Brushes.Red,
         ViewModel = pcov,
         Point = pos
     };
     AppState.Popups.Add(callOut);
     //AppState.TriggerNotification();
     AppState.ViewDef.ZoomAndPoint(new Point(b.Position.Longitude, b.Position.Latitude));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Update the PoI's style, optionally triggering a label changed and position changed.
 /// </summary>
 /// <param name="poiType"></param>
 /// <param name="triggerLabelChanged"></param>
 /// <param name="triggerUpdatePosition"></param>
 public void UpdateStyle(BaseContent poiType, bool triggerLabelChanged = false, bool triggerUpdatePosition = false)
 {
     if (poiType == null) return;
     PoiTypeId = poiType.ContentId;
     PoiType = poiType;
     foreach (var label in poiType.Labels)
     {
         Labels[label.Key] = label.Value;
     }
     foreach (var data in poiType.Data)
     {
         Data[data.Key] = data.Value;
     }
     ForceUpdate(triggerLabelChanged, triggerUpdatePosition);
 }
Ejemplo n.º 16
0
 public static void GetEffectiveAnalysis(BaseContent p, ref AnalysisMetaInfo a)
 {
     if (p.PoiType != null) GetEffectiveAnalysis(p.PoiType, ref a);
     if (p.Style != null && p.Style.Analysis != null) a.Highlights.AddRange(p.Style.Analysis.Highlights);
     if (p.RuntimeHighlights.Any()) a.Highlights.AddRange(p.RuntimeHighlights);
 }
Ejemplo n.º 17
0
 private void DownloadMedia(BaseContent task) {
     if (task == null || task.AllMedia.Count == 0) return;
     foreach (var media in task.AllMedia) {
         var store = service.store;
         media.LocalPath = store.GetLocalUrl(service.Folder, media.Id);
         if (!store.HasFile(media.LocalPath)) {
             service.RequestData(media.Id, MediaReceived);
         }
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Try to parse the label to a double using either the invariant or the Dutch culture.
 /// </summary>
 /// <param name="bc"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 private static double ParseLabelToDouble(BaseContent bc, string key)
 {
     if (!bc.Labels.ContainsKey(key)) return 0;
     double fvalue;
     if (double.TryParse(bc.Labels[key], NumberStyles.Any, CultureInfo.InvariantCulture, out fvalue)) return fvalue;
     double.TryParse(bc.Labels[key], NumberStyles.Any, new CultureInfo("NL-nl"), out fvalue);
     return fvalue;
 }
Ejemplo n.º 19
0
        private void FollowPoiPosition(BaseContent poi)
        {
            var trackPoiType = GetTrackPoiType(poi);

            poi.Deleted += (sender, e) => OnPoiDeleted(poi, trackPoiType);

            var posChanged = Observable.FromEventPattern<PositionEventArgs>(ev => poi.PositionChanged += ev, ev => poi.PositionChanged -= ev);
            posChanged.Throttle(TimeSpan.FromMilliseconds(250)).Subscribe(k =>
            {
                ResetPath();
                var newPoint = new Point(poi.Position.Longitude, poi.Position.Latitude);
                switch (trackPoiType)
                {
                    case TrackPoiType.Start:
                        start = newPoint;
                        break;
                    case TrackPoiType.End:
                        end = newPoint;
                        break;
                    case TrackPoiType.WayPoint:
                        var wayPoint = WayPoints.FirstOrDefault(w => w.Id == poi.Id);
                        if (wayPoint == null)
                        {
                            wayPoint = new WayPoint(newPoint, poi.Id);
                            WayPoints.Add(wayPoint);
                        }
                        else
                            wayPoint.Point = newPoint;
                        break;
                }
                DrawRoute();
            });
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes the multiple criteria and creates an initial MCA function (weigthed values) 
 /// for the evaluation.
 /// </summary>
 /// <param name="p"></param>
 public void UpdateMultipleCriteria(BaseContent p) {
     criteria.Clear();
     mathFormula = string.Empty;
     RemoveMetaInfo(p);
     if (CreateCriteria(p)) return;
     UsesMultipleCriteria = criteria.Count > 0;
     if (!usesMultipleCriteria) return;
     // For example: 0.333*a+0.333*b+0.333*c
     UpdateMathFormula();
     InMcaMode = true;
     CreateMetaInfo(p);
 }
Ejemplo n.º 21
0
 private Task RemoveRoute(BaseContent poi)
 {
     return new TaskFactory().StartNew(() =>
     {
         var remove = RelatedPois.ToList();
         remove.Add(Poi);
         remove.Remove(poi);
         Execute.OnUIThread(() =>
         {
             try
             {
                 foreach (var p in remove) Model.Service.PoIs.Remove(p);
             }
             catch (SystemException e)
             {
                 Logger.Log("PathEditorPoi", "Error deleting PoI", e.Message, Logger.Level.Error, true);
             }
         });
     });
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Create the multiple criteria based on the SelectionCriteria.
 /// </summary>
 /// <param name="p"></param>
 /// <returns>True if there is only a single criterion.</returns>
 private bool CreateCriteria(BaseContent p)
 {
     var crit = SelectionCriteria.Split(new[] {' ', '\r', '\n'}, StringSplitOptions.RemoveEmptyEntries).ToList();
     var usesMultiple = crit.Count > 1;
     if (!usesMultiple) return true;
     var w = 1d/crit.Count;
     foreach (var criterion in crit)
     {
         var mi = p.MetaInfo.FirstOrDefault(i => string.Equals(i.Label, criterion, StringComparison.InvariantCultureIgnoreCase));
         if (mi == null) continue;
         criteria.Add(new PoiProperty
         {
             Name = criterion,
             Weight = w,
             Type = mi.Type == MetaTypes.sensor ? SelectionTypes.Sensor : SelectionTypes.Label
         });
     }
     return false;
 }
Ejemplo n.º 23
0
 public void OpenPoiPopup(BaseContent c)
 {
 }
Ejemplo n.º 24
0
 private void RemoveMetaInfo(BaseContent bc) {
     var mi = bc.MetaInfo.FirstOrDefault(m => string.Equals(m.Label, LabelTitle, StringComparison.InvariantCultureIgnoreCase));
     if (mi != null) bc.MetaInfo.Remove(mi);
 }
Ejemplo n.º 25
0
        /*
        private BitmapImage LoadImageFromResource(string pResourceUrl)
        {

            var assembly = Assembly.GetExecutingAssembly();
            var resources = assembly.GetManifestResourceNames();
            using (Stream stream = assembly.GetManifestResourceStream(pResourceUrl))
            {

                    var bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.StreamSource = stream;
                    bitmap.CacheOption = BitmapCacheOption.OnLoad;
                    bitmap.EndInit();
                    bitmap.Freeze();
                return bitmap;
            }
        }*/

        #region ConvertPoints helpers

        private PointCollection ConvertPointsToPointCollection(BaseContent p)
        {
            if (p.Points == null || p.Points.Count == 0) return null;
            var pc = new PointCollection();
            foreach (var po in p.Points)
            {
                pc.Add(mercator.FromGeographic(new MapPoint(po.X, po.Y)) as MapPoint);
            }
            return pc;
        }
Ejemplo n.º 26
0
 private void CreateMetaInfo(BaseContent bc) {
     bc.MetaInfo.Add(new MetaInfo { Label = LabelTitle, Title = Title, IsEditable = false, Section = "Results", Type = MetaTypes.number, StringFormat = "{0:0.00}", VisibleInCallOut = true });
 }
Ejemplo n.º 27
0
 private void ConvertPointsToPolyline(BaseContent p, PoiGraphic g)
 {
     var pc = ConvertPointsToPointCollection(p);
     if (pc == null) return;
     var pol = new Polyline();
     pol.Paths.Add(pc);
     g.SetGeometry(pol);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Calculate the results using the created formula.
 /// Note that you can have up to 8 parameters.
 /// </summary>
 /// <param name="bc"></param>
 /// <returns>The computed result.</returns>
 private double CalculateResultUsingMultipleCriteria(BaseContent bc) {
     var parameters = new double[criteria.Count];
     for (var i = 0; i < criteria.Count; i++) {
         var criterion = criteria[i];
         parameters[i] = criterion.Type == SelectionTypes.Label
             ? ParseLabelToDouble(bc, criterion.Name)
             : GetSensorValue(bc, criterion.Name);
     }
     var result = 0d;
     switch (parameters.Length) {
         case 2: {
             var formula = resultFormula as Func<double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1]);
             break;
         }
         case 3: {
             var formula = resultFormula as Func<double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2]);
             break;
         }
         case 4: {
             var formula = resultFormula as Func<double, double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3]);
             break;
         }
         case 5: {
             var formula = resultFormula as Func<double, double, double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
             break;
         }
         case 6: {
             var formula = resultFormula as Func<double, double, double, double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5]);
             break;
         }
         case 7: {
             var formula = resultFormula as Func<double, double, double, double, double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6]);
             break;
         }
         case 8: {
             var formula = resultFormula as Func<double, double, double, double, double, double, double, double, double>;
             result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6], parameters[7]);
             break;
         }
     }
     bc.Labels[LabelTitle] = result.ToString(CultureInfo.InvariantCulture);
     //bc.TriggerLabelChanged("Results are updated", string.Empty, string.Empty);
     return result;
 }
Ejemplo n.º 29
0
        public void OpenPoiPopup(BaseContent poI)
        {
            if (poI.Data.ContainsKey("FloatingElement") && AppState.FloatingItems.Contains((FloatingElement)poI.Data["FloatingElement"]))
                return;
            var pp = new PoiPopupViewModel { PoI = poI, Layer = this, Service = poI.Service as PoiService };
            var s = new Size(300, 500);
            var kmlpoint = new KmlPoint(poI.Position.Longitude, poI.Position.Latitude);
            var p = AppState.ViewDef.MapPoint(kmlpoint);

            if (p.X <= AppState.MainBorder.ActualWidth / 2)
                p.X += s.Width / 2 + 25;
            else
                p.X -= s.Width / 2 + 25;

            var fe = FloatingHelpers.CreateFloatingElement(poI.Name, p, s, pp);
            fe.AssociatedPoint = kmlpoint;
            poI.Data["FloatingElement"] = fe;

            AppState.FloatingItems.AddFloatingElement(fe);
        }
Ejemplo n.º 30
0
 public void Zoom(BaseContent p)
 {
     if (p.Position == null) return;
     AppState.ViewDef.ZoomAndPoint(new Point(p.Position.Longitude,p.Position.Latitude));
     
 }