internal LinearUnit GetLinearUnit(DistanceTypes dtype) { LinearUnit result = LinearUnit.Meters; switch (dtype) { case DistanceTypes.Feet: case DistanceTypes.SurveyFoot: result = LinearUnit.Feet; break; case DistanceTypes.Kilometers: result = LinearUnit.Kilometers; break; case DistanceTypes.NauticalMile: result = LinearUnit.NauticalMiles; break; case DistanceTypes.Meters: default: result = LinearUnit.Meters; break; } return(result); }
internal override async void UpdateFeedback() { CurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); if (LineFromType == LineFromTypes.Points) { if (Point1 == null || Point2 == null) { return; } var segment = QueuedTask.Run(() => { return(LineBuilder.CreateLineSegment(Point1, Point2)); }).Result; UpdateAzimuth(segment.Angle); await UpdateFeedbackWithGeoLine(segment, curveType, lu); } else { UpdateManualFeedback(); } }
private Geometry CreatePolyline() { if (Point1 == null || Point2 == null) { return(null); } CurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); try { // create line var polyline = QueuedTask.Run(() => { var segment = LineBuilder.CreateLineSegment(Point1, Point2); return(PolylineBuilder.CreatePolyline(segment)); }).Result; Geometry newline = GeometryEngine.GeodeticDensifyByLength(polyline, 0, lu, curveType); AddGraphicToMap(newline); ResetPoints(); return(newline as Geometry); } catch (Exception ex) { // do nothing return(null); } }
public LinearUnit DeriveUnit(DistanceTypes distType) { LinearUnit lu = LinearUnit.Meters; if (distType == DistanceTypes.Feet) { lu = LinearUnit.Feet; } else if (distType == DistanceTypes.Kilometers) { lu = LinearUnit.Kilometers; } else if (distType == DistanceTypes.Meters) { lu = LinearUnit.Meters; } else if (distType == DistanceTypes.Miles) { lu = LinearUnit.Miles; } else if (distType == DistanceTypes.NauticalMiles) { lu = LinearUnit.NauticalMiles; } else if (distType == DistanceTypes.Yards) { lu = LinearUnit.Yards; } return(lu); }
public SearchFADialog(DataSource targetDataSource, int BufferDistance, LinearUnit BufferUnit) : this() { //Set the default selected data source TargetDataSource = targetDataSource == null?OperationsDashboard.Instance.DataSources.FirstOrDefault(d => d.IsSelectable) : targetDataSource; DSSelector.SelectedDataSource = TargetDataSource; //Set buffer distance if (BufferDistance > 0) { Distance = BufferDistance; } //Set the available units List <LinearUnit> units = new List <LinearUnit>() { LinearUnit.Kilometer, LinearUnit.Meter, LinearUnit.SurveyMile, LinearUnit.SurveyYard }; Units = units; //Set the unit of the buffer radius if (BufferUnit == 0) { SelectedUnit = Units[0]; } else { SelectedUnit = BufferUnit; } }
private LinearUnit EncodeLinearUnit(string linearUnitString) { LinearUnit result = LinearUnit.Meter; switch (linearUnitString.ToLower()) { case "meters": result = LinearUnit.Meter; break; case "kilometers": result = LinearUnit.Kilometer; break; case "feet": result = LinearUnit.Foot; break; case "miles": result = LinearUnit.StatuteMile; break; default: break; } return(result); }
public SearchNearbyFeatureActionDialog(string targetDataSourceId, int BufferDistance, LinearUnit BufferUnit) : this() { //Set the available data sources and the selected data source SelectableDataSourceNames = GetSelectableMapDataSources(); if (SelectableDataSourceNames != null && SelectableDataSourceNames.Count() > 0) TargetDataSourceId = string.IsNullOrEmpty(targetDataSourceId) ? OperationsDashboard.Instance.DataSources.Where(d => d.IsSelectable).FirstOrDefault().Id : targetDataSourceId; string selectedName = string.Empty; foreach (ESRI.ArcGIS.OperationsDashboard.DataSource ds in OperationsDashboard.Instance.DataSources) { if (ds.Id == TargetDataSourceId) selectedName = ds.Name; } if (!string.IsNullOrEmpty(selectedName)) cmbLayer.SelectedValue = selectedName; //set the selected value in the layer combo to the selectedname //Set buffer distance if (BufferDistance > 0) Distance = BufferDistance; //Set the available units List<LinearUnit> units = new List<LinearUnit>() { LinearUnit.Kilometer, LinearUnit.Meter, LinearUnit.SurveyMile, LinearUnit.SurveyYard }; Units = units; //Set the unit of the buffer radius if (BufferUnit == 0) SelectedUnit = Units[0]; else SelectedUnit = BufferUnit; }
/// <summary> /// Returns a IUnit given a piece of WKT. /// </summary> /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param> /// <returns>An object that implements the IUnit interface.</returns> private static GeoAPI.CoordinateSystems.IUnit ReadUnit(GisSharpBlog.NetTopologySuite.IO.WktStreamTokenizer tokenizer) { //UNIT["degree",0.01745329251994433,AUTHORITY["EPSG","9102"]] GeoAPI.CoordinateSystems.IUnit unit = null; tokenizer.ReadToken("["); string unitName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double unitsPerUnit = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority = String.Empty; long authorityCode = -1; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); switch (unitName) { // take into account the different spellings of the word meter/metre. case "meter": case "metre": unit = new LinearUnit(unitsPerUnit, String.Empty, authority, authorityCode, unitName, String.Empty, String.Empty); break; case "degree": case "radian": unit = new AngularUnit(unitsPerUnit, String.Empty, authority, authorityCode, unitName, String.Empty, String.Empty); break; default: throw new NotImplementedException(String.Format("{0} is not recognized is a unit of measure.", unitName)); } return(unit); }
public static ILinearUnit ReadLinearUnit(XmlTextReader reader) { if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_LinearUnit")) { throw new ParseException(String.Format("Expected a CS_LinearUnit but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition)); } double metersPerUnit = XmlConvert.ToDouble(reader.GetAttribute("MetersPerUnit")); string authority = "", authorityCode = "", abbreviation = "", name = ""; /*while (reader.NodeType != XmlNodeType.EndElement) * { * XmlNodeType nodetype = reader.NodeType; * string nodeValue = reader.Value; * string nodeName = reader.Name; * reader.Read(); * } * * while (reader.NodeType != XmlNodeType.Element) * { * reader.Read(); * }*/ reader.Read(); ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name); reader.Read(); LinearUnit linearUnit = new LinearUnit(metersPerUnit, "", authority, authorityCode, name, "", abbreviation); return(linearUnit); }
public double CalculateDistance(Geometry CurrentGeometry, LinearUnit OutUnitType) { //https://www.esri.com/arcgis-blog/products/js-api-arcgis/uncategorized/geometryengine-part-2-measurement/?rmedium=redirect&rsource=blogs.esri.com/esri/arcgis/2015/09/16/geometryengine-part-2-measurement //https://community.esri.com/thread/179549 Polyline currentPolyline = (Polyline)CurrentGeometry; double totalDistance = 0; for (int i = 1; i < currentPolyline.Points.Count; i++) { MapPoint start = currentPolyline.Points[i - 1]; MapPoint end = currentPolyline.Points[i]; double twoPointDistance = GeometryEngine.Instance.GeodesicDistance(start, end); totalDistance += twoPointDistance; } // double shapeArea = GeometryEngine.Instance.GeodesicDistance(CurrentGeometry); if (OutUnitType.FactoryCode == LinearUnit.Kilometers.FactoryCode) { totalDistance = totalDistance / 1000; } else if (OutUnitType.FactoryCode == LinearUnit.NauticalMiles.FactoryCode) { totalDistance = totalDistance / 1852; } return(totalDistance); //this.ShapePreservingDistance = "Shape Preserving:" + Environment.NewLine + shapeArea + string.Empty + " square meter"; }
private async void UpdateManualFeedback() { if (LineFromType == LineFromTypes.BearingAndDistance && Azimuth.HasValue && HasPoint1 && Point1 != null) { GeodeticCurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); // update feedback var segment = QueuedTask.Run(() => { var mpList = new List <MapPoint>() { Point1 }; // get point 2 // SDK Bug, GeometryEngine.GeodesicMove seems to not honor the LinearUnit passed in, always does Meters var tempDistance = ConvertFromTo(LineDistanceType, DistanceTypes.Meters, Distance); var results = GeometryEngine.Instance.GeodeticMove(mpList, MapView.Active.Map.SpatialReference, tempDistance, LinearUnit.Meters /*GetLinearUnit(LineDistanceType)*/, GetAzimuthAsRadians().Value, GetCurveType()); foreach (var mp in results) { // WORKAROUND: For some odd reason GeodeticMove is removing the Z attribute of the point // so need to put it back so all points will have a consistent Z. // This is important when storing to feature class with Z if (mp == null) { continue; } if (Double.IsNaN(mp.Z)) { MapPointBuilder mb = new MapPointBuilder(mp.X, mp.Y, 0.0, mp.SpatialReference); Point2 = mb.ToGeometry(); } else { Point2 = mp; } } if (Point2 != null) { var point2Proj = GeometryEngine.Instance.Project(Point2, Point1.SpatialReference); return(LineBuilder.CreateLineSegment(Point1, (MapPoint)point2Proj)); } else { return(null); } }).Result; if (segment != null) { await UpdateFeedbackWithGeoLine(segment, curveType, lu); } } else { ClearTempGraphics(); // if not, or no longer, valid clear } }
/// <summary> /// /// </summary> /// <param name="range"></param> /// <param name="linearUnit"></param> /// <param name="azimuth"></param> /// <param name="elevation"></param> /// <param name="angularUnit"></param> public void SetCoordinate(double range, LinearUnit linearUnit, double azimuth, double elevation, AngularUnit angularUnit) { Range = range; LinearUnit = linearUnit; Azimuth = new Angle(azimuth, angularUnit); Elevation = new Angle(elevation, angularUnit); }
public SphericalPoint(LinearUnit radius, AngularUnit HorizontalAngle, AngularUnit verticalAngle) { this.m_Radius = radius.ChangeTo <TLinear>(); this.m_HorizontalAngle = HorizontalAngle.ChangeTo <TAngular>(); this.m_VerticalAngle = verticalAngle.ChangeTo <TAngular>(); }
public Cartesian3DPoint(LinearUnit x, LinearUnit y, LinearUnit z) { this.m_X = x.ChangeTo <T>(); this.m_Y = y.ChangeTo <T>(); this.m_Z = z.ChangeTo <T>(); }
public Ellipsoid(string name, LinearUnit semiMajorAxis, double inverseFlattening, int srid) : this(name, semiMajorAxis, inverseFlattening, new Cartesian3DPoint <TLinear>(new TLinear(), new TLinear(), new TLinear()), new OrientationParameter(new Radian(), new Radian(), new Radian()), srid) { }
public Proj4LinearUnit(LinearUnit core) { if (core == null) { throw new ArgumentNullException("core"); } Contract.EndContractBlock(); Core = core; }
public Ellipsoid(string name, LinearUnit semiMajorAxis, LinearUnit semiMinorAxis, ICartesian3DPoint datumTranslation, OrientationParameter datumMisalignment, int srid) : this(name, semiMajorAxis, 1.0 / ((semiMajorAxis.Subtract(semiMinorAxis)).Divide(semiMajorAxis)).Value, datumTranslation, datumMisalignment, srid) { }
public Aoi(string strName, string strFilePath) { m_strName = strName; m_strFilePath = strFilePath; m_dblMinElev = Constants.VALUE_NO_DATA_9999; m_dblMaxElev = Constants.VALUE_NO_DATA_9999; m_elevationUnits = LinearUnit.Meters; m_aoiBatchState = AoiBatchState.Waiting.ToString(); m_aoiBatchIsSelected = true; }
static Proj4LinearUnit() { KnownUnits = Array.ConvertAll(KnownUnitCodes, uomCode => { var result = new LinearUnit(); result.ReadCode(uomCode); return(result); }); MetersUnit = KnownUnits.Single(x => x.Meters == 1.0); MetersUnitWrapped = new Proj4LinearUnit(MetersUnit); }
/// <summary> /// 创建包裹对象 /// </summary> /// <param name="length">包裹长度</param> /// <param name="width">包裹宽度</param> /// <param name="height">包裹高度</param> /// <param name="weight">包裹重量</param> /// <param name="insuredValue">保险费用</param> /// <param name="weiUnit">重量单位</param> /// <param name="linearUnit">长度单位</param> /// <param name="currency">货币</param> public Package(decimal length, decimal width, decimal height, decimal weight, decimal insuredValue, WeightUnit weiUnit = WeightUnit.KG, LinearUnit linearUnit = LinearUnit.CM, string currency = "CNY") { Length = length; Width = width; Height = height; Weight = weight; InsuredValue = insuredValue; ShipWeightUnit = weiUnit; ShipLinearUnit = linearUnit; Currency = currency; }
public void Test_Constructor() { ILinearUnit linearunit = new LinearUnit(1.0, "remarks", "authority", "authoritycode", "name", "alias", "abbreviation"); Assertion.AssertEquals("ctor 1. ", "abbreviation", linearunit.Abbreviation); Assertion.AssertEquals("ctor 2. ", "alias", linearunit.Alias); Assertion.AssertEquals("ctor 1. ", "authority", linearunit.Authority); Assertion.AssertEquals("ctor 1. ", "authoritycode", linearunit.AuthorityCode); Assertion.AssertEquals("ctor 1. ", "name", linearunit.Name); Assertion.AssertEquals("ctor 1. ", 1.0, linearunit.MetersPerUnit); Assertion.AssertEquals("ctor 1. ", "remarks", linearunit.Remarks); }
private Geometry CreatePolyline() { if (Point1 == null || Point2 == null) { return(null); } var nameConverter = new EnumToFriendlyNameConverter(); GeodeticCurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); try { // create line var polyline = QueuedTask.Run(() => { var point2Proj = GeometryEngine.Instance.Project(Point2, Point1.SpatialReference); var segment = LineBuilder.CreateLineSegment(Point1, (MapPoint)point2Proj); return(PolylineBuilder.CreatePolyline(segment)); }).Result; Geometry newline = GeometryEngine.Instance.GeodeticDensifyByLength(polyline, 0, lu, curveType); var displayValue = nameConverter.Convert(LineDistanceType, typeof(string), new object(), CultureInfo.CurrentCulture); // Hold onto the attributes in case user saves graphics to file later LineAttributes lineAttributes = new LineAttributes() { mapPoint1 = Point1, mapPoint2 = Point2, distance = distance, angle = (double)azimuth, angleunit = LineAzimuthType.ToString(), distanceunit = displayValue.ToString(), originx = Point1.X, originy = Point1.Y, destinationx = Point2.X, destinationy = Point2.Y }; CreateLineFeature(newline, lineAttributes); ResetPoints(); return((Geometry)newline); } catch (Exception ex) { // do nothing System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }
private BufferParameters CreateBufferParameters(SpatialReference spRef, double Distance, LinearUnit Unit) { BufferParameters bufferParameters = new BufferParameters() { Unit = Unit, BufferSpatialReference = spRef, OutSpatialReference = spRef, UnionResults = false, //We want a separate buffer for each SourceFeatures, so UnionResults = false }; bufferParameters.Distances.AddRange(new List<double> { Distance }); bufferParameters.Features.AddRange(SourceFeatures); return bufferParameters; }
void mnuRadius_Click(object sender, RoutedEventArgs e) { RadiusMapConfigDialog dialog = new RadiusMapConfigDialog(); System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { selectedColor = dialog.SelectedColor; selectedRadius = dialog.Radius; selectedUnit = dialog.Unit; AddBufferedPoint(); } }
internal double ConvertFromTo(DistanceTypes fromType, DistanceTypes toType, double input) { double result = 0.0; var linearUnitFrom = GetLinearUnit(fromType); var linearUnitTo = GetLinearUnit(toType); var unit = LinearUnit.CreateLinearUnit(linearUnitFrom.FactoryCode); result = unit.ConvertTo(input, linearUnitTo); return(result); }
internal override async void OnMouseMoveEvent(object obj) { GeodeticCurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); if (!IsActiveTab) { return; } var point = obj as MapPoint; if (point == null) { return; } if (LineFromType == LineFromTypes.BearingAndDistance) { return; } if (HasPoint1 && !HasPoint2) { // update azimuth from segment var segment = QueuedTask.Run(() => { try { var pointProj = GeometryEngine.Instance.Project(point, Point1.SpatialReference); return(LineBuilder.CreateLineSegment(Point1, (MapPoint)pointProj)); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }).Result; if (segment == null) { return; } UpdateAzimuth(segment.Angle); await UpdateFeedbackWithGeoLine(segment, curveType, lu); } base.OnMouseMoveEvent(obj); }
public void TestCreateHorizontalDatum1() { ILinearUnit linearUnit = new LinearUnit(1); IEllipsoid ellipsoid = _csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit); WGS84ConversionInfo wgs = new WGS84ConversionInfo(); wgs.Dx = 1; IHorizontalDatum horizontalDatum = _csFactory.CreateHorizontalDatum("name", DatumType.IHD_Geocentric, ellipsoid, wgs); Assertion.AssertEquals("ctor 1", "name", horizontalDatum.Name); Assertion.AssertEquals("ctor 2", DatumType.IHD_Geocentric, horizontalDatum.DatumType); Assertion.AssertEquals("ctor 3", ellipsoid, horizontalDatum.Ellipsoid); Assertion.AssertEquals("ctor 4", wgs, horizontalDatum.WGS84Parameters); }
public GeodeticPoint(IEllipsoid ellipsoid, LinearUnit height, AngularUnit longitude, AngularUnit latitude) { if (latitude.Range != AngleRange.MinusPiTOPi) { latitude.Range = AngleRange.MinusPiTOPi; } this.m_Datum = ellipsoid.ChangeTo <TLinear, TAngular>(); this.m_Height = height.ChangeTo <TLinear>(); this.m_Latitude = latitude.ChangeTo <TAngular>(); this.m_Longitude = longitude.ChangeTo <TAngular>(); }
//Select the query method to use based on spatialOperator public void ExecuteQuery(SpatialOperator spatialOperator, double distance, LinearUnit unit) { //Cancel any existing async task. This can happen if user Hit the Select button multiple times //before the existing operation finishes geometryService.CancelAsync(); if (spatialOperator.Operator == Operator.WithinDistanceOfSourceLayer) Select_WithinDistanceOfSourceLayer(distance, unit); else if (spatialOperator.Operator == Operator.IntersectSourceLayer) Select_IntersectSourceLayer(); else if (spatialOperator.Operator == Operator.CompletelyWithinSourceLayer) Select_CompletelyWithinSourceLayer(); else if (spatialOperator.Operator == Operator.TouchBoundaryOfSourceLayer) Select_TouchBoundaryOfSourceLayer(); }
/// <summary> /// Create an earth ellipsoid /// </summary> /// <param name="a">semi-major axis</param> /// <param name="unit">unit of semi-major axis</param> /// <param name="ivf">inverse of flattening</param> /// <param name="name">name of ellipsoid</param> /// <param name="alias">abbreviated alias of ellipsoid</param> public Ellipsoid(double a, LinearUnit unit, double ivf, string name = "", string alias = "") : base(a, a * (1 - 1 / ivf)) { AngularVelocity = double.NaN; GM = double.NaN; Unit = unit; Name = name; Alias = alias; //计算并存储两个偏心率,因为使用较多,所以就单独存储了 _ivf = ivf; _es = 2 / _ivf - 1 / _ivf / _ivf; _ses = _es / (1 - _es); }
/// <summary> /// 货物fed物流信息 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public ShipmentEx GetShipmentByOrder(long orderId) { ShipmentEx shipEx = null; try { //shipEx = new ShipmentEx(); Shipment ship = context.Shipment.FirstOrDefault(x => x.OrderId == orderId); if (ship != null) { ShipmentAddress orgAddress = context.ShipmentAddress.FirstOrDefault(x => (x.ShipmentId == ship.Id) && (x.State == "Origin")); ShipmentAddress destAddress = context.ShipmentAddress.FirstOrDefault(x => (x.ShipmentId == ship.Id) && (x.State == "Dest")); List <ShipmentPackage> pkgList = context.ShipmentPackage.Where(x => x.ShipmentId == ship.Id).ToList(); Address orgAddressEx = new Address(orgAddress.Line1, orgAddress.Line2, orgAddress.Line3, orgAddress.City, "", orgAddress.PostalCode, orgAddress.CountryCode); orgAddressEx.CountryName = orgAddress.CountryName; Address destAddressEx = new Address(destAddress.Line1, destAddress.Line2, destAddress.Line3, destAddress.City, "", destAddress.PostalCode, destAddress.CountryCode); destAddressEx.CountryName = destAddress.CountryName; List <Package> pkgExList = new List <Package>(); Package package = null; string packType = string.Empty; foreach (ShipmentPackage item in pkgList) { WeightUnit wUnit = item.ShipWeightUnit == "KG" ? WeightUnit.KG : WeightUnit.LB; LinearUnit lUnit = item.ShipLinearUnit == "CM" ? LinearUnit.CM : LinearUnit.IN; package = new Package(item.Length, item.Width, item.Height, item.Weight, item.InsuredValue, wUnit, lUnit); dicList.TryGetValue(item.PackageType, out packType); dicList.TryGetValue(item.PackageType, out packType); package.PackageType = packType; pkgExList.Add(package); } Rate rate = new Rate(ship.RateProvider, ship.RateProviderCode, ship.RateName, ship.TotalCharges, ship.GurDeliveryDate); shipEx = new ShipmentEx(orgAddressEx, destAddressEx, pkgExList); shipEx.RateValue = rate; } } catch { } return(shipEx); }
public SearchNearbyFeatureActionDialog(string targetDataSourceId, int BufferDistance, LinearUnit BufferUnit) : this() { //Set the available data sources and the selected data source SelectableDataSourceNames = GetSelectableMapDataSources(); if (SelectableDataSourceNames != null && SelectableDataSourceNames.Count() > 0) { TargetDataSourceId = string.IsNullOrEmpty(targetDataSourceId) ? OperationsDashboard.Instance.DataSources.Where(d => d.IsSelectable).FirstOrDefault().Id : targetDataSourceId; } string selectedName = string.Empty; foreach (ESRI.ArcGIS.OperationsDashboard.DataSource ds in OperationsDashboard.Instance.DataSources) { if (ds.Id == TargetDataSourceId) { selectedName = ds.Name; } } if (!string.IsNullOrEmpty(selectedName)) { cmbLayer.SelectedValue = selectedName; //set the selected value in the layer combo to the selectedname } //Set buffer distance if (BufferDistance > 0) { Distance = BufferDistance; } //Set the available units List <LinearUnit> units = new List <LinearUnit>() { LinearUnit.Kilometer, LinearUnit.Meter, LinearUnit.SurveyMile, LinearUnit.SurveyYard }; Units = units; //Set the unit of the buffer radius if (BufferUnit == 0) { SelectedUnit = Units[0]; } else { SelectedUnit = BufferUnit; } }
public void TestCreateHorizontalDatum2() { ILinearUnit linearUnit = new LinearUnit(1); IEllipsoid ellipsoid = _csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit); WGS84ConversionInfo wgs = new WGS84ConversionInfo(); wgs.Dx = 1; try { IHorizontalDatum horizontalDatum = _csFactory.CreateHorizontalDatum("name", DatumType.IHD_Geocentric, null, wgs); Assertion.Fail("Should throw a ArgumentNullException."); } catch (ArgumentNullException) { } }
//Creates buffers using the buffer distance around the source features and returns all the target features intersecting the buffer zones. //This method calculates a buffer, then use the intersect method to retrieve features private async void Select_WithinDistanceOfSourceLayer(double distance, LinearUnit unit) { #region Create buffer polygons //Define the params to pass to the buffer operation BufferParameters bufferParameters = CreateBufferParameters(MapWidget.Map.SpatialReference, distance, unit); //Use the service to the buffer BufferResult bufferResult = await geometryService.BufferTaskAsync(bufferParameters); if (bufferResult == null || bufferResult.Results == null || bufferResult.Results.Count == 0) return; //For each feature there will be one result IEnumerable<Graphic> buffers = bufferResult.Results; #endregion Select_IntersectSourceLayer(buffers); }
public SearchFADialog(DataSource targetDataSource, int BufferDistance, LinearUnit BufferUnit) : this() { //Set the default selected data source TargetDataSource = targetDataSource == null ? OperationsDashboard.Instance.DataSources.FirstOrDefault(d => d.IsSelectable) : targetDataSource; DSSelector.SelectedDataSource = TargetDataSource; //Set buffer distance if (BufferDistance > 0) Distance = BufferDistance; //Set the available units List<LinearUnit> units = new List<LinearUnit>() { LinearUnit.Kilometer, LinearUnit.Meter, LinearUnit.SurveyMile, LinearUnit.SurveyYard }; Units = units; //Set the unit of the buffer radius if (BufferUnit == 0) SelectedUnit = Units[0]; else SelectedUnit = BufferUnit; }
public SearchUnit(LinearUnit unit) { Unit = unit; }