protected override void MyMoveTo(SLatLong point) { m_gpsPoint.Latitude = point.Latitude; m_gpsPoint.Longitude = point.Longitude; m_gpsPoint.UpdateMapItems(MapDataBase, new List <IMapItem>()); Point = point; }
//------------------------------------------------- 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 void MoveTo(SLatLong point) { if (ItemSurMap != null) { ItemSurMap.Latitude = point.Latitude; ItemSurMap.Longitude = point.Longitude; } MyMoveTo(point); }
public IEnumerable <IMapItem> CreateMapItems(CMapLayer layer) { List <IMapItem> lstItems = new List <IMapItem>(); CGPSLineTrace trace = DetailLigne; SLatLong lastPoint = trace.PointDepart; foreach (CGPSLineSegment segment in trace.Segments) { CMapItemPath path = new CMapItemPath(layer); path.Points = new SLatLong[] { lastPoint, segment.PointDestination }; path.LineColor = segment.Couleur; path.LineWidth = segment.Width; path.Tag = segment; path.ToolTip = segment.Libelle; path.EnableClick = true; lstItems.Add(path); lastPoint = segment.PointDestination; } return(lstItems.AsReadOnly()); }
//--------------------------------------------------------------------------- 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()); }
//--------------------------------------------------------- public CResultAErreur MajChamps() { CResultAErreur result = CResultAErreur.True; if (m_gestionnaireModeEdition.ModeEdition && m_segmentEdite != null) { try { UpdateVisuel(); m_segmentEdite.Libelle = m_txtLibelle.Text; SLatLong pt = m_segmentEdite.PointDestination; if (m_txtLongitude.UnitValue != null) { pt.Latitude = m_txtLatitude.UnitValue.ConvertTo("°").Valeur; } if (m_txtLatitude.UnitValue != null) { pt.Longitude = m_txtLongitude.UnitValue.ConvertTo("°").Valeur; } m_segmentEdite.PointDestination = pt; m_segmentEdite.TypeLigne = m_txtTypeLigne.ElementSelectionne as CGPSTypeLigne; if (m_segmentEdite.TypeLigne != null) { m_segmentEdite.Couleur = m_segmentEdite.TypeLigne.DefaultColor; m_segmentEdite.Width = m_segmentEdite.TypeLigne.DefaultWidth; } else { m_segmentEdite.Couleur = m_selectLineColor.SelectedColor; m_segmentEdite.Width = (int)m_wndLineWidth.Value; } } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } } return(result); }
//-------------------------------------------------------------- protected override void MyMoveTo(SLatLong point) { m_line.DetailLigne.PointDepart = point; m_line.UpdateMapItems(MapDataBase, new List <IMapItem>()); }
public CPointGPS(SLatLong latLong) { m_latLong = latLong; }
//-------------------------------------------------------------- protected override void MyMoveTo(SLatLong point) { m_segment.PointDestination = point; m_line.UpdateMapItems(MapDataBase, new List <IMapItem>()); }
//------------------------------------------------- protected abstract void MyMoveTo(SLatLong point);
//------------------------------------------------- public CMoveablePoint(CMapDatabase database, SLatLong latLong) : this(database) { m_point = latLong; }
//--------------------------------------------- public CResultAErreur GenereItems(CMapDatabase database, CContexteDonnee ctxDonnee) { CResultAErreur result = CResultAErreur.True; //Calcule les éléments à générer DataTable table = Query.GetTable(NomTableSource, m_listeSources); double? fLastLat = null; double? fLastLong = null; CMapLayer layer = database.GetLayer(Generator.LayerId, true); if (table != null) { DataColumn colLat = null; DataColumn colLong = null; DataColumn colLib = null; DataColumn colElt = null; foreach (DataColumn col in table.Columns) { if (col.ColumnName == ChampCleElement) { colElt = col; } if (col.ColumnName == ChampLatitude) { colLat = col; } if (col.ColumnName == ChampLibelle) { colLib = col; } if (col.ColumnName == ChampLongitude) { colLong = col; } } if (colLong == null || colLat == null) { result.EmpileErreur(I.T("Can not find columns @1 and @2 in data source|20024", ChampLongitude, ChampLatitude)); } Dictionary <object, List <DataRow> > dicRowsParElement = new Dictionary <object, List <DataRow> >(); if (colElt != null) { object lastElt = null; List <DataRow> lstRows = null; foreach (DataRow row in table.Rows) { object v = row[colElt]; if (v != lastElt || lstRows == null) { lastElt = v; if (!dicRowsParElement.TryGetValue(v, out lstRows)) { lstRows = new List <DataRow>(); dicRowsParElement[v] = lstRows; } } lstRows.Add(row); } } else { List <DataRow> lstRows = new List <DataRow>(); foreach (DataRow row in table.Rows) { lstRows.Add(row); } dicRowsParElement[DBNull.Value] = lstRows; } foreach (KeyValuePair <object, List <DataRow> > kv in dicRowsParElement) { List <DataRow> lstRows = kv.Value; List <SLatLong> lstPoints = new List <SLatLong>(); int nNb = kv.Value.Count; int nIndex = 0; foreach (DataRow row in kv.Value) { try { double fLat = Convert.ToDouble(row[colLat]); double fLong = Convert.ToDouble(row[colLong]); string strLabel = colLib != null ?row[colLib] as string:null; if (strLabel == null || strLabel.Length == 0) { strLabel = ""; } bool bPrendre = true; if (strLabel == "" && fLastLong != null && fLastLat != null && MetresEntrePoints > 0) { //contrôle la distance double fDist = GetGpsDist(fLastLong.Value, fLong, fLastLat.Value, fLat); bPrendre = fDist >= MetresEntrePoints; } if (nIndex == nNb - 1) { bPrendre = true; } if (bPrendre) { fLastLat = fLat; fLastLong = fLong; SLatLong pt = new SLatLong(fLat, fLong); lstPoints.Add(pt); } if (strLabel != null && strLabel.Trim().Length > 0) { CMapItemSimple item = new CMapItemSimple(layer, fLat, fLong, EMapMarkerType.blue_dot); item.ToolTip = strLabel; layer.AddItem(item); } } catch { } } CMapItemPath path = new CMapItemPath(layer); path.Points = lstPoints.ToArray(); layer.AddItem(path); } } return(result); }