Beispiel #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]);
        }
Beispiel #2
0
        //---------------------------------------------------------------------------
        public IEnumerable <IMapItem> FindMapItems(CMapDatabase database)
        {
            CGPSLineTrace   trace    = DetailLigne;
            List <IMapItem> lstPaths = new List <IMapItem>();

            foreach (CGPSLineSegment segment in trace.Segments)
            {
                CMapItemPath path = database.FindItemFromTag(segment) as CMapItemPath;
                if (path != null)
                {
                    lstPaths.Add(path);
                }
            }
            return(lstPaths.AsReadOnly());
        }
Beispiel #3
0
     //---------------------------------------------------------
     public IEnumerable <IMapItem> DeleteSegment(CMapDatabase database, CGPSLineSegment segment)
     {
         if (segment != null && m_listeSegments.Count() > 1)
         {
             IMapItem item = database.FindItemFromTag(segment);
             m_listeSegments.Remove(segment);
             if (item != null)
             {
                 return new IMapItem[] { item }
             }
             ;
         }
         return(new IMapItem[0]);
     }
 }
Beispiel #4
0
 //---------------------------------------------------------
 public IEnumerable <IMapItem> DeleteStartPoint(CMapDatabase database)
 {
     if (m_listeSegments.Count() > 1)
     {
         //Trouve l'item correspondant au segment 0
         CGPSLineSegment segment = m_listeSegments.ElementAt(0);
         IMapItem        item    = database.FindItemFromTag(segment);
         PointDepart = segment.PointDestination;
         m_listeSegments.RemoveAt(0);
         if (item != null)
         {
             return new IMapItem[] { item }
         }
         ;
     }
     return(new IMapItem[0]);
 }
Beispiel #5
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]);
        }
Beispiel #6
0
        //---------------------------------------------------------------------------
        public IEnumerable <IMapItem> UpdateMapItems(CMapDatabase database, List <IMapItem> itemsToDelete)
        {
            CGPSLineTrace   trace     = DetailLigne;
            SLatLong        lastPoint = trace.PointDepart;
            List <IMapItem> lstPaths  = new List <IMapItem>();

            foreach (CGPSLineSegment segment in trace.Segments)
            {
                CMapItemPath path = database.FindItemFromTag(segment) as CMapItemPath;
                if (path != null)
                {
                    path.Points    = new SLatLong[] { lastPoint, segment.PointDestination };
                    path.LineColor = segment.Couleur;
                    path.LineWidth = segment.Width;
                    path.Tag       = segment;
                    path.ToolTip   = segment.Libelle;
                    lstPaths.Add(path);
                    lastPoint = segment.PointDestination;
                }
            }
            return(lstPaths.AsReadOnly());
        }