/// <summary> /// Convert Polyline Barrier into GPFeature. /// </summary> /// <param name="barrier">Barrier to convert</param> /// <returns>Barrier GPFeature</returns> private GPFeature _ConvertToPolylineFeature(Barrier barrier) { Debug.Assert(barrier != null); GPFeature feature = new GPFeature(); feature.Geometry = new GeometryHolder(); // Convert geometry. feature.Geometry.Value = GPObjectHelper.PolylineToGPPolyline( (Polyline)barrier.Geometry); // Fill attributes. feature.Attributes = _GetAttributes(barrier, BarrierGeometryType.Polyline); return(feature); }
/// <summary> /// Converts the specified geometry object to corresponding GP Geometry object. /// </summary> /// <param name="geometry">A reference to the geometry object to be converted.</param> /// <returns>A new <see cref="GeometryHolder"/> with corresponding GP Geometry object /// or null reference if <paramref name="geometry"/> is null.</returns> private static GPGeometry _ConvertGeometryToGPGeometry(object geometry) { if (geometry == null) { return(null); } var gpGeometry = new GPGeometry(); if (geometry.GetType().IsAssignableFrom(typeof(Point))) { gpGeometry = GPObjectHelper.PointToGPPoint((Point)geometry); } else if (geometry.GetType().IsAssignableFrom(typeof(Polyline))) { gpGeometry = GPObjectHelper.PolylineToGPPolyline((Polyline)geometry); } else if (geometry.GetType().IsAssignableFrom(typeof(Polygon))) { gpGeometry = GPObjectHelper.PolygonToGPPolygon((Polygon)geometry); } return(gpGeometry); }