예제 #1
0
        //---------------------------------------------------------------------------
        public IEnumerable <IMapItem> FindMapItems(CMapDatabase database)
        {
            CMapItemPoint mapItem = database.FindItemFromTag(this) as CMapItemPoint;

            if (mapItem != null)
            {
                return new IMapItem[] { mapItem }
            }
            ;
            return(new IMapItem[0]);
        }
예제 #2
0
        //---------------------------------------------------------------------------
        public IEnumerable <IMapItem> UpdateMapItems(CMapDatabase database, List <IMapItem> itemsToDelete)
        {
            CMapItemPoint mapItem = database.FindItemFromTag(this) as CMapItemPoint;

            if (mapItem != null)
            {
                CMapLayer layer = mapItem.Layer;

                //Vérifie le type du mapItem
                if (TypePoint != null && TypePoint.Image != null)
                {
                    if (!(mapItem is CMapItemImage))
                    {
                        itemsToDelete.Add(mapItem);
                        mapItem.Layer.RemoveItem(mapItem);
                        layer.Database.AddImage(TypePoint.IdUniversel, TypePoint.Image);
                        mapItem = new CMapItemImage(layer, Latitude, Longitude, TypePoint.IdUniversel);
                    }
                    ((CMapItemImage)mapItem).ImageId = TypePoint.IdUniversel;
                }
                else
                {
                    if (!(mapItem is CMapItemSimple))
                    {
                        itemsToDelete.Add(mapItem);
                        mapItem.Layer.RemoveItem(mapItem);
                        mapItem = new CMapItemSimple(layer, Latitude, Longitude, MarkerType);
                    }
                    ((CMapItemSimple)mapItem).SimpleMarkerType = MarkerType == EMapMarkerType.none?EMapMarkerType.blue_dot:MarkerType;
                }

                mapItem.Tag              = this;
                mapItem.Latitude         = Latitude;
                mapItem.Longitude        = Longitude;
                mapItem.ToolTip          = Libelle;
                mapItem.PermanentToolTip = PermanentToolTip;
                return(new IMapItem[] { mapItem });
            }
            return(new IMapItem[0]);
        }
예제 #3
0
        //---------------------------------------------------------------------------
        public IEnumerable <IMapItem> CreateMapItems(CMapLayer layer)
        {
            CMapItemPoint point = null;

            if (MarkerType == EMapMarkerType.none)
            {
                if (TypePoint != null && TypePoint.Image != null)
                {
                    layer.Database.AddImage(TypePoint.IdUniversel, TypePoint.Image);
                    point = new CMapItemImage(layer, Latitude, Longitude, TypePoint.IdUniversel);
                }
            }
            if (point == null)
            {
                EMapMarkerType type = MarkerType == EMapMarkerType.none ? EMapMarkerType.blue_dot : MarkerType;
                point = new CMapItemSimple(layer, Latitude, Longitude, type);
            }
            point.ToolTip          = Libelle;
            point.PermanentToolTip = PermanentToolTip;
            point.Tag = this;
            return(new IMapItem[] { point });
        }