//------------------------------------------------- internal void DiviseSegment(CGPSLineSegment segmentToDivise) { List <CGPSLineSegment> lstSegments = new List <CGPSLineSegment>(); SLatLong lastPoint = PointDepart; foreach (CGPSLineSegment segment in Segments) { if (segment == segmentToDivise) { SLatLong pt = new SLatLong( (lastPoint.Latitude + segment.PointDestination.Latitude) / 2, (lastPoint.Longitude + segment.PointDestination.Longitude) / 2); CGPSLineSegment newSeg = new CGPSLineSegment(this); newSeg.PointDestination = pt; newSeg.Libelle = segment.Libelle; newSeg.Width = segment.Width; newSeg.Couleur = segment.Couleur; newSeg.TypeLigne = segment.TypeLigne; lstSegments.Add(newSeg); lstSegments.Add(segment); } else { lstSegments.Add(segment); } lastPoint = segment.PointDestination; } Segments = lstSegments; }
public CMoveablePointForLineSegment(CMapDatabase database, CGPSLine line, CGPSLineSegment segment) : base(database, segment.PointDestination) { m_segment = segment; m_line = line; m_listeItems.AddRange(line.FindMapItems(database)); }
//--------------------------------------------------------- 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]); } }
//--------------------------------------------------------- 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]); }
//------------------------------------------------- public void AddSegment(CGPSLineSegment segment) { m_listeSegments.Add(segment); }