Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #653 from Esri/dev
Browse files Browse the repository at this point in the history
March 2019 Release
  • Loading branch information
dfoll authored Mar 21, 2019
2 parents 136ec8b + 3b02189 commit 64fd0e1
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Follow the links below to select the desired development/deployment environment.
* [Military Tools for ArcGIS Solutions Pages](http://solutions.arcgis.com/defense/help/military-tools/)
* [ArcGIS for Defense Downloads](http://appsforms.esri.com/products/download/#ArcGIS_for_Defense)
* [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/)
* ![Twitter](https://g.twimg.com/twitter-bird-16x16.png)[@EsriDefense](http://twitter.com/EsriDefense)
* [ArcGIS Solutions Website](http://solutions.arcgis.com/military/)

## New to Github
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ internal virtual void OnNewMapPointEvent(object obj)
{
MessageBox.Show(
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
DistanceAndDirectionLibrary.Properties.Resources.DistanceDirectionLabel,
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@
<data name="LabelInterval" xml:space="preserve">
<value>Interval Between Rings</value>
</data>
<data name="LabelLineType" xml:space="preserve">
<value>Line Type</value>
</data>
<data name="LabelMajorAxis" xml:space="preserve">
<value>Major</value>
</data>
Expand Down Expand Up @@ -366,6 +369,9 @@
<data name="LabelRate" xml:space="preserve">
<value>Rate</value>
</data>
<data name="LabelRingType" xml:space="preserve">
<value>Ring Type</value>
</data>
<data name="LabelSaveAs" xml:space="preserve">
<value>Save As</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Grid x:Name="mainControl">
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
<StackPanel>

<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelLineType}" />
<ComboBox x:Name="cmbLineType"
Height="Auto"
Margin="3,3,0,0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Grid x:Name="mainControl">
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
<StackPanel>

<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelRingType}" />
<ComboBox x:Name="cmbRingType"
Height="Auto"
Margin="3,3,0,0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,15 @@ public string Point1Formatted
{
// only format if the Point1 data was generated from a mouse click
string outFormattedString = string.Empty;
CoordinateConversionLibrary.Models.CoordinateType ccType = CoordinateConversionLibrary.Helpers.ConversionUtils.GetCoordinateString(GetFormattedPoint(Point1), out outFormattedString);
CoordinateConversionLibrary.Models.CoordinateType ccType =
CoordinateConversionLibrary.Helpers.ConversionUtils.
GetCoordinateString(GetFormattedPoint(Point1), out outFormattedString);

// TRICKY: if point can't be formatted, then it is invalid/out of bounds
if ((ccType == CoordinateConversionLibrary.Models.CoordinateType.Unknown) &&
(string.IsNullOrEmpty(outFormattedString)))
HasPoint1 = false;

return outFormattedString;
}
return string.Empty;
Expand Down Expand Up @@ -315,7 +323,15 @@ public string Point2Formatted
{
// only format if the Point1 data was generated from a mouse click
string outFormattedString = string.Empty;
CoordinateConversionLibrary.Models.CoordinateType ccType = CoordinateConversionLibrary.Helpers.ConversionUtils.GetCoordinateString(GetFormattedPoint(Point2), out outFormattedString);
CoordinateConversionLibrary.Models.CoordinateType ccType =
CoordinateConversionLibrary.Helpers.ConversionUtils.
GetCoordinateString(GetFormattedPoint(Point2), out outFormattedString);

// TRICKY: if point can't be formatted, then it is invalid/out of bounds
if ((ccType == CoordinateConversionLibrary.Models.CoordinateType.Unknown) &&
(string.IsNullOrEmpty(outFormattedString)))
HasPoint2 = false;

return outFormattedString;
}
return string.Empty;
Expand Down Expand Up @@ -652,11 +668,50 @@ private bool IsValid(System.Windows.DependencyObject obj)
.All(IsValid);
}

/// <summary>
/// Method to check to see point is withing the map area of interest
/// </summary>
/// <param name="point">IPoint to validate</param>
/// <returns></returns>
internal async Task<bool> IsValidPoint(MapPoint point)
{
if ((point != null) && (MapView.Active != null) && (MapView.Active.Map != null))
{
Envelope env = null;
await QueuedTask.Run(() =>
{
env = MapView.Active.Map.CalculateFullExtent();
});

bool isValid = false;

if (env != null)
{
try
{
// Workaround for 2.1, map point SR was not set to same as map
Geometry geo = GeometryEngine.Instance.Project(point, env.SpatialReference);
// Now check if point is within Map Extent
isValid = GeometryEngine.Instance.Contains(env, geo);
}
catch (Exception ex)
{
// This just checks the point is in the map extent so allow the check to pass even if this excepts
isValid = true;
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}

return isValid;
}
return false;
}

/// <summary>
/// Handler for the new map point click event
/// </summary>
/// <param name="obj">IPoint</param>
internal virtual void OnNewMapPointEvent(object obj)
internal virtual async void OnNewMapPointEvent(object obj)
{
if (!IsActiveTab)
return;
Expand All @@ -666,6 +721,16 @@ internal virtual void OnNewMapPointEvent(object obj)
if (point == null)
return;

bool isPointValid = await IsValidPoint(point);
if (!isPointValid)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation);
return;
}

if (!HasPoint1)
{
// clear temp graphics
Expand Down Expand Up @@ -798,6 +863,7 @@ private string GetFormattedPoint(MapPoint point)
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
result = string.Empty;
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Grid x:Name="mainControl">
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
<StackPanel>

<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelLineType}" />
<ComboBox x:Name="cmbLineType"
Height="Auto"
Margin="3,3,0,0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<Grid x:Name="mainControl">
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
<StackPanel>
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelRingType}" />
<ComboBox x:Name="cmbRingType"
Height="Auto"
Margin="3,3,0,0"
Expand Down

0 comments on commit 64fd0e1

Please sign in to comment.