public InfoGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
     : base(geometry, styleSpecification, map, layer)
 {
     //must have at least one EnhancedMapPoint to show label and launch balloon.
     foreach (var mapObject in mapObjects)
     {
         if (mapObject is EnhancedMapPoint)
         {
             var mapPoint = (EnhancedMapPoint)mapObject;
             if (mainPoint == null)
             {
                 mainPoint = mapPoint;
             }
             mapPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID });
         }
     }
     if (mainPoint == null)
     {
         //TODO: create one, invisible at centre of first object
         var point = geometry.Centroid;
         mainPoint = createPoint(point, layer);
         mainPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID });
     }
     Selected += InfoGeometry_Selected;
 }
 public BaseGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
 {
     Geometry = geometry;
     StyleSpecification = styleSpecification;
     mapInstance = map;
     mapLayer = layer;
     mapObjects = new ObservableCollection<Control>();
     if (mapLayer != null)
     {
         createGeometry(mapLayer, Geometry);
     }
 }
 public BaseGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
 {
     Geometry           = geometry;
     StyleSpecification = styleSpecification;
     mapInstance        = map;
     mapLayer           = layer;
     mapObjects         = new ObservableCollection <Control>();
     if (mapLayer != null)
     {
         createGeometry(mapLayer, Geometry);
     }
 }
        public SelectGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map,
                              EnhancedMapLayer layer)
            : base(geometry, styleSpecification, map, layer)
        {
            //default is the inverse of the style colours + 50% larger icon.
            SelectedSpecification                = styleSpecification.Clone();
            SelectedSpecification.IconScale      = styleSpecification.IconScale * 1.5;
            SelectedSpecification.LineColour     = Utilities.InvertColorFromHexString(styleSpecification.LineColour);
            SelectedSpecification.PolyFillColour = Utilities.InvertColorFromHexString(styleSpecification.PolyFillColour);

            foreach (Control mapObject in mapObjects)
            {
                mapObject.MouseLeftButtonDown += SelectGeometry_MouseLeftButtonDown;
                mapObject.MouseEnter          += SelectGeometry_MouseEnter;
                mapObject.MouseLeave          += SelectGeometry_MouseLeave;
            }

            mapObjects.CollectionChanged += mapObjects_CollectionChanged;

            EnableSelection = true;
        }
        public SelectGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map,
                              EnhancedMapLayer layer)
            : base(geometry, styleSpecification, map, layer)
        {
            //default is the inverse of the style colours + 50% larger icon.
            SelectedSpecification = styleSpecification.Clone();
            SelectedSpecification.IconScale = styleSpecification.IconScale * 1.5;
            SelectedSpecification.LineColour = Utilities.InvertColorFromHexString(styleSpecification.LineColour);
            SelectedSpecification.PolyFillColour = Utilities.InvertColorFromHexString(styleSpecification.PolyFillColour);

            foreach (Control mapObject in mapObjects)
            {
                mapObject.MouseLeftButtonDown += SelectGeometry_MouseLeftButtonDown;
                mapObject.MouseEnter += SelectGeometry_MouseEnter;
                mapObject.MouseLeave += SelectGeometry_MouseLeave;
            }

            mapObjects.CollectionChanged += mapObjects_CollectionChanged;

            EnableSelection = true;
        }
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            timer.Duration = new TimeSpan(0, 0, 0, 0,500);
            Dtimer.Duration = new TimeSpan(0, 0, 0, 20);
            Ltimer.Duration = new TimeSpan(0, 0, 0, 55);
            //Ltimer.Begin();
            ml.Name = "routing";
            realml.Name = "realroads";
            this.ctlMap.Mode = new MercatorMode();
            wms = new WMSTileSourse();
            mtl.CacheMode = null;
            mtl.TileSources.Add(wms);
            var fiverealwms = new fiveleveroadsTileSourse();
            var fourRealWms = new fourleveroadsTileSourse();
            var threerealwms = new threeleveroadsTileSourse();
            var twoRealWms = new twoleveroadsTileSourse();

            realwms.laynum = 0;
            mtl.TileSources.Add(realwms);
            //mtl.TileSources.Add(fiverealwms);
            //mtl.TileSources.Add(fourRealWms);
            //mtl.TileSources.Add(threerealwms);
            //mtl.TileSources.Add(twoRealWms);

            ctlMap.Children.Add(mtl);
            ctlMap.Center = new Location(31.64, 120.31);
            ctlMap.ZoomLevel = 10;

            var styles = new Dictionary<string, StyleSpecification>
                             {
                                 {
                                     "defaultstyle", new StyleSpecification
                                                         {
                                                             ID = "style1",
                                                             LineColour = "FF1B0AA5",
                                                             LineWidth = 2,
                                                             PolyFillColour = "88677E1E",
                                                             ShowFill = true,
                                                             ShowLine = true,
                                                             IconURL = "http://soulsolutions.com.au/Images/pin.png",
                                                             IconScale = 1,
                                                             //IconOffsetX = 70, //35.41666666666667,
                                                             //IconOffsetY = -90 //-45.83333333333333
                                                         }
                                     }
                             };

            layer = new EnhancedMapLayer(ctlMap)
                        {
                            Styles = styles,
                            LayerDefinition = new LayerDefinition
                                                  {
                                                      CurrentVersion = DateTime.Now,
                                                      IsEditable = false,
                                                      LabelOn = true,
                                                      LayerAlias = "Sample Layer",
                                                      LayerID = "1",
                                                      LayerStyleName = "style3",
                                                      LayerTimeout = -1,
                                                      LayerType = 1,
                                                      MaxDisplayLevel = 100,
                                                      MBR = new byte[0],
                                                      MinDisplayLevel = 1,
                                                      PermissionToEdit = false,
                                                      Selected = true,
                                                      Tags = "Test Group",
                                                      ZIndex = 30,
                                                      Temporal = true,
                                                      IconURI = "http://soulsolutions.com.au/Images/pin.png",
                                                      ObjectAttributes =
                                                          new Dictionary<int, LayerObjectAttributeDefinition>()
                                                  },
                            EnableBalloon = false,
                            EnableClustering = true,
                            ID = "routing",
                        };
            ctlMap.Children.Add(layer);
            ctlMap.Children.Add(ml);
            //ctlMap.Children.Add(realml);
            ctlMap.Children.Add(carml);
            //Getrealtimeroad("11", "3");
            InitCar();
        }
 public InfoGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
     : base(geometry, styleSpecification, map, layer)
 {
     //must have at least one EnhancedMapPoint to show label and launch balloon.
     foreach (var mapObject in mapObjects)
     {
         if (mapObject is EnhancedMapPoint)
         {
             var mapPoint = (EnhancedMapPoint)mapObject;
             if (mainPoint == null)
             {
                 mainPoint = mapPoint;
             }
             mapPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs {
                 LayerID = layer.ID, ItemID = ItemID
             });
         }
     }
     if (mainPoint == null)
     {
         //TODO: create one, invisible at centre of first object
         var point = geometry.Centroid;
         mainPoint          = createPoint(point, layer);
         mainPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs {
             LayerID = layer.ID, ItemID = ItemID
         });
     }
     Selected += InfoGeometry_Selected;
 }