/// <summary> /// Checks is point has valid\inited values. /// </summary> /// <param name="point">Point object to check.</param> /// <returns>TRUE if all properties of point is valid.</returns> private bool _IsPointValid(ESRISDSGeometry.MapPoint point) { return (!double.IsNaN(point.X) && !double.IsNaN(point.Y) && !double.IsInfinity(point.X) && !double.IsInfinity(point.Y) && (double.MinValue != point.X) && (double.MinValue != point.Y) && (double.MaxValue != point.X) && (double.MaxValue != point.Y)); }
/// <summary> /// Method converts ESRI ArcGIS MapPoint object to ESRI ArcLogistics Point object. /// </summary> /// <param name="mapPoint">MapPoint to convert.</param> /// <returns>ESRI ArcLogistics Point object.</returns> private ArcLogistics.Geometry.Point _ConvertToArcLogisticsPoint( ESRISDSGeometry.MapPoint mapPoint) { Debug.Assert(mapPoint != null); var point = new ArcLogistics.Geometry.Point(); if(_IsPointValid(mapPoint)) point = new ArcLogistics.Geometry.Point( mapPoint.X, mapPoint.Y); return point; }
/// <summary> /// Method converts ESRI ArcGIS Polyline object to ESRI ArcLogistics Polyline object. /// </summary> /// <param name="polyline">Polyline to convert.</param> /// <returns>ESRI ArcLogistics Polyline object.</returns> private ESRI.ArcLogistics.Geometry.Polyline _ConvertToArcLogisticsPolyline( ESRISDSGeometry.Polyline polyline) { Debug.Assert(polyline != null); var groups = new List<int>(); var points = new List<ESRI.ArcLogistics.Geometry.Point>(); for (int i = 0; i < polyline.Paths.Count; i++) { // Fill current group by count of Points in it. groups.Add(polyline.Paths[i].Count); var collection = polyline.Paths[i]; // Get all points. foreach (var point in collection) { points.Add(_ConvertToArcLogisticsPoint(point)); } } var newPolyline = new ESRI.ArcLogistics.Geometry.Polyline( groups.ToArray(), points.ToArray()); return newPolyline; }
/// <summary> /// Method converts ESRI ArcGIS Envelope object to ESRI ArcLogistics Envelope object. /// </summary> /// <param name="envelope">Envelope to covert.</param> /// <returns>ESRI ArcLogistics Envelope object.</returns> private ESRI.ArcLogistics.Geometry.Envelope _ConvertToArcLogisticsEnvelope( ESRISDSGeometry.Envelope envelope) { Debug.Assert(envelope != null); var geometry = new ESRI.ArcLogistics.Geometry.Envelope( envelope.XMin, envelope.YMax, envelope.XMax, envelope.YMin); return geometry; }