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

Commit 64fd0e1

Browse files
authored
Merge pull request #653 from Esri/dev
March 2019 Release
2 parents 136ec8b + 3b02189 commit 64fd0e1

9 files changed

Lines changed: 99 additions & 9 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ Follow the links below to select the desired development/deployment environment.
5555
* [Military Tools for ArcGIS Solutions Pages](http://solutions.arcgis.com/defense/help/military-tools/)
5656
* [ArcGIS for Defense Downloads](http://appsforms.esri.com/products/download/#ArcGIS_for_Defense)
5757
* [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/)
58-
* ![Twitter](https://g.twimg.com/twitter-bird-16x16.png)[@EsriDefense](http://twitter.com/EsriDefense)
5958
* [ArcGIS Solutions Website](http://solutions.arcgis.com/military/)
6059

6160
## New to Github

source/addins/ArcMapAddinDistanceAndDirection/ArcMapAddinDistanceAndDirection/ViewModels/TabBaseViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ internal virtual void OnNewMapPointEvent(object obj)
818818
{
819819
MessageBox.Show(
820820
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
821-
DistanceAndDirectionLibrary.Properties.Resources.DistanceDirectionLabel,
821+
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
822822
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
823823
return;
824824
}

source/addins/DistanceAndDirectionLibrary/Properties/Resources.Designer.cs

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/addins/DistanceAndDirectionLibrary/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@
324324
<data name="LabelInterval" xml:space="preserve">
325325
<value>Interval Between Rings</value>
326326
</data>
327+
<data name="LabelLineType" xml:space="preserve">
328+
<value>Line Type</value>
329+
</data>
327330
<data name="LabelMajorAxis" xml:space="preserve">
328331
<value>Major</value>
329332
</data>
@@ -366,6 +369,9 @@
366369
<data name="LabelRate" xml:space="preserve">
367370
<value>Rate</value>
368371
</data>
372+
<data name="LabelRingType" xml:space="preserve">
373+
<value>Ring Type</value>
374+
</data>
369375
<data name="LabelSaveAs" xml:space="preserve">
370376
<value>Save As</value>
371377
</data>

source/addins/DistanceAndDirectionLibrary/Views/LinesView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<Grid x:Name="mainControl">
4141
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
4242
<StackPanel>
43-
43+
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelLineType}" />
4444
<ComboBox x:Name="cmbLineType"
4545
Height="Auto"
4646
Margin="3,3,0,0"

source/addins/DistanceAndDirectionLibrary/Views/RangeView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<Grid x:Name="mainControl">
2727
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
2828
<StackPanel>
29-
29+
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelRingType}" />
3030
<ComboBox x:Name="cmbRingType"
3131
Height="Auto"
3232
Margin="3,3,0,0"

source/addins/ProAppDistanceAndDirectionModule/ProAppDistanceAndDirectionModule/ViewModels/ProTabBaseViewModel.cs

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,15 @@ public string Point1Formatted
246246
{
247247
// only format if the Point1 data was generated from a mouse click
248248
string outFormattedString = string.Empty;
249-
CoordinateConversionLibrary.Models.CoordinateType ccType = CoordinateConversionLibrary.Helpers.ConversionUtils.GetCoordinateString(GetFormattedPoint(Point1), out outFormattedString);
249+
CoordinateConversionLibrary.Models.CoordinateType ccType =
250+
CoordinateConversionLibrary.Helpers.ConversionUtils.
251+
GetCoordinateString(GetFormattedPoint(Point1), out outFormattedString);
252+
253+
// TRICKY: if point can't be formatted, then it is invalid/out of bounds
254+
if ((ccType == CoordinateConversionLibrary.Models.CoordinateType.Unknown) &&
255+
(string.IsNullOrEmpty(outFormattedString)))
256+
HasPoint1 = false;
257+
250258
return outFormattedString;
251259
}
252260
return string.Empty;
@@ -315,7 +323,15 @@ public string Point2Formatted
315323
{
316324
// only format if the Point1 data was generated from a mouse click
317325
string outFormattedString = string.Empty;
318-
CoordinateConversionLibrary.Models.CoordinateType ccType = CoordinateConversionLibrary.Helpers.ConversionUtils.GetCoordinateString(GetFormattedPoint(Point2), out outFormattedString);
326+
CoordinateConversionLibrary.Models.CoordinateType ccType =
327+
CoordinateConversionLibrary.Helpers.ConversionUtils.
328+
GetCoordinateString(GetFormattedPoint(Point2), out outFormattedString);
329+
330+
// TRICKY: if point can't be formatted, then it is invalid/out of bounds
331+
if ((ccType == CoordinateConversionLibrary.Models.CoordinateType.Unknown) &&
332+
(string.IsNullOrEmpty(outFormattedString)))
333+
HasPoint2 = false;
334+
319335
return outFormattedString;
320336
}
321337
return string.Empty;
@@ -652,11 +668,50 @@ private bool IsValid(System.Windows.DependencyObject obj)
652668
.All(IsValid);
653669
}
654670

671+
/// <summary>
672+
/// Method to check to see point is withing the map area of interest
673+
/// </summary>
674+
/// <param name="point">IPoint to validate</param>
675+
/// <returns></returns>
676+
internal async Task<bool> IsValidPoint(MapPoint point)
677+
{
678+
if ((point != null) && (MapView.Active != null) && (MapView.Active.Map != null))
679+
{
680+
Envelope env = null;
681+
await QueuedTask.Run(() =>
682+
{
683+
env = MapView.Active.Map.CalculateFullExtent();
684+
});
685+
686+
bool isValid = false;
687+
688+
if (env != null)
689+
{
690+
try
691+
{
692+
// Workaround for 2.1, map point SR was not set to same as map
693+
Geometry geo = GeometryEngine.Instance.Project(point, env.SpatialReference);
694+
// Now check if point is within Map Extent
695+
isValid = GeometryEngine.Instance.Contains(env, geo);
696+
}
697+
catch (Exception ex)
698+
{
699+
// This just checks the point is in the map extent so allow the check to pass even if this excepts
700+
isValid = true;
701+
System.Diagnostics.Debug.WriteLine(ex.Message);
702+
}
703+
}
704+
705+
return isValid;
706+
}
707+
return false;
708+
}
709+
655710
/// <summary>
656711
/// Handler for the new map point click event
657712
/// </summary>
658713
/// <param name="obj">IPoint</param>
659-
internal virtual void OnNewMapPointEvent(object obj)
714+
internal virtual async void OnNewMapPointEvent(object obj)
660715
{
661716
if (!IsActiveTab)
662717
return;
@@ -666,6 +721,16 @@ internal virtual void OnNewMapPointEvent(object obj)
666721
if (point == null)
667722
return;
668723

724+
bool isPointValid = await IsValidPoint(point);
725+
if (!isPointValid)
726+
{
727+
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(
728+
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
729+
DistanceAndDirectionLibrary.Properties.Resources.MsgOutOfAOI,
730+
System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation);
731+
return;
732+
}
733+
669734
if (!HasPoint1)
670735
{
671736
// clear temp graphics
@@ -798,6 +863,7 @@ private string GetFormattedPoint(MapPoint point)
798863
catch(Exception ex)
799864
{
800865
System.Diagnostics.Debug.WriteLine(ex.Message);
866+
result = string.Empty;
801867
}
802868
return result;
803869
}

source/addins/ProAppDistanceAndDirectionModule/ProAppDistanceAndDirectionModule/Views/ProLinesView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<Grid x:Name="mainControl">
4242
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
4343
<StackPanel>
44-
44+
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelLineType}" />
4545
<ComboBox x:Name="cmbLineType"
4646
Height="Auto"
4747
Margin="3,3,0,0"

source/addins/ProAppDistanceAndDirectionModule/ProAppDistanceAndDirectionModule/Views/ProRangeView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<Grid x:Name="mainControl">
2828
<ScrollViewer Padding="0,0,3,0" VerticalScrollBarVisibility="Auto">
2929
<StackPanel>
30+
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelRingType}" />
3031
<ComboBox x:Name="cmbRingType"
3132
Height="Auto"
3233
Margin="3,3,0,0"

0 commit comments

Comments
 (0)