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 #435 from Esri/dev
Browse files Browse the repository at this point in the history
Merging dev into master for June release
  • Loading branch information
Avi Cueva authored Jul 5, 2017
2 parents aaffd86 + 93136dd commit b1182ae
Show file tree
Hide file tree
Showing 24 changed files with 300 additions and 171 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The add-in provides the ability to create geodesic features such as lines, circl
* Creates geodesy lines, circles, ellipses and range rings.
* Inputs can be entered manually or via a known coordinate.
* Features can be exported to a file geodatabase, shapefile, or KML.
* Addin for ArcMap 10.3.1
* Addin for ArcMap and ArcGIS Pro

## Sections

Expand All @@ -25,22 +25,23 @@ The add-in provides the ability to create geodesic features such as lines, circl

### Developers

* Visual Studio 2013
* ArcGIS Desktop SDK for .NET 10.3.1
* Visual Studio 2015
* ArcGIS Desktop SDK for .NET 10.3.1+
* [ArcGIS Desktop for .NET Requirements](https://desktop.arcgis.com/en/desktop/latest/get-started/system-requirements/arcobjects-sdk-system-requirements.htm)
* ArcGIS Pro 2.0+ SDK

### ArcGIS for Desktop Users

* [ArcGIS Desktop 10.3.1](http://desktop.arcgis.com/en/arcmap/10.3/get-started/system-requirements/arcgis-desktop-system-requirements.htm)
* ArcGIS Pro 2.0+

## Instructions

###New to Github
### New to Github

* [New to Github? Get started here.](http://htmlpreview.github.com/?https://github.com/Esri/esri.github.com/blob/master/help/esri-getting-to-know-github.html)
* [New to Github? Get started here.](https://github.com/Esri/esri.github.com/blob/master/help/esri-getting-to-know-github.html)

### Working with the Add-In

## Development Environment

* Building
Expand All @@ -60,7 +61,7 @@ The add-in provides the ability to create geodesic features such as lines, circl
* Running the add-in
* To run from a stand-alone deployment
* ArcMap
* Install the add-in from the latest Release on Github (https://github.com/Esri/distance-direction-addin-dotnet/releases)
* Install the add-in from the [latest Release](http://solutions.arcgis.com/defense/help/distance-direction)
* Add the add-in command to a toolbar via menu option
* **Customize** -> **Customize mode**
* Select **Commands** Tab
Expand All @@ -69,7 +70,7 @@ The add-in provides the ability to create geodesic features such as lines, circl
* Close customize mode
* Open tool by clicking the **Show Distance and Direction** command you just added
* Dockable *Distance and Direction* tool appears
* If you add this to a toolbar that you contstantly use the add-in will stay. To remove the add-in delete your [Normal.MXT](https://geonet.esri.com/thread/78692) file
* If you add this to a toolbar that you continually use the add-in will stay. To remove the add-in delete your [Normal.MXT](https://geonet.esri.com/thread/78692) file
## Workflows

Expand Down Expand Up @@ -161,6 +162,11 @@ The add-in provides the ability to create geodesic features such as lines, circl

## Resources

* [ArcGIS for Defense Distance and Direction Component](http://solutions.arcgis.com/defense/help/distance-direction/)
* [Military Tools for ArcGIS](https://esri.github.io/military-tools-desktop-addins/)
* [Military Tools for ArcGIS Solutions Pages](http://solutions.arcgis.com/defense/help/military-tools/)
* [ArcGIS for Defense Solutions Website](http://solutions.arcgis.com/defense)
* [ArcGIS for Defense Downloads](http://appsforms.esri.com/products/download/#ArcGIS_for_Defense)
* [ArcGIS 10.3 Help](http://resources.arcgis.com/en/help/)
* [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/)
* ![Twitter](https://g.twimg.com/twitter-bird-16x16.png)[@EsriDefense](http://twitter.com/EsriDefense)
Expand Down Expand Up @@ -189,7 +195,7 @@ Anyone and everyone is welcome to contribute. Please see our [guidelines for con

## Licensing

Copyright 2016 Esri
Copyright 2016-2017 Esri

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Name>Distance and Direction</Name>
<AddInID>{3e1d78f8-72a5-4463-ad11-0524a5913c9d}</AddInID>
<Description>Create Lines, Circles, Ellipses and Range Rings</Description>
<Version>2.1</Version>
<Version>2.1.1</Version>
<Image>Images\ArcMapAddinDistanceAndDirection.png</Image>
<Author>Esri</Author>
<Company>Esri</Company>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,22 @@ private IGeometry CreateCircle()
{
construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), Distance, esriCurveDensifyMethod.esriCurveDensifyByAngle, 0.01);
IDictionary<String, System.Object> circleAttributes = new Dictionary<String, System.Object>();
circleAttributes.Add("radius", Distance);
circleAttributes.Add("disttype", CircleType.ToString());
circleAttributes.Add("centerx", Point1.X);
circleAttributes.Add("centery", Point1.Y);
circleAttributes.Add("distanceunit", LineDistanceType.ToString());
var color = new RgbColorClass() { Red = 255 } as IColor;
this.AddGraphicToMap(construct as IGeometry, color, attributes: circleAttributes);
double dist = 0.0;
if (CircleType == CircleFromTypes.Diameter)
dist = Distance * 2;
else
dist = Distance;

//circleAttributes.Add("radius", dist);
//circleAttributes.Add("disttype", CircleType.ToString());
//circleAttributes.Add("centerx", Point1.X);
//circleAttributes.Add("centery", Point1.Y);
//circleAttributes.Add("distanceunit", LineDistanceType.ToString());
//var color = new RgbColorClass() { Red = 255 } as IColor;
//this.AddGraphicToMap(construct as IGeometry, color, attributes: circleAttributes);

//Construct a polygon from geodesic polyline

var newPoly = this.PolylineToPolygon((IPolyline)construct);
if (newPoly != null)
{
Expand Down Expand Up @@ -928,14 +935,23 @@ private IGeometry CreateCircle()
{
distanceLabel = (TrimPrecision(convertedDistance, LineDistanceType, false)).ToString("N" + roundingFactor.ToString());
}

dist = convertedDistance;
//Add text using centroid point
this.AddTextToMap(area.Centroid, string.Format("{0}:{1} {2}",
circleTypeLabel,
distanceLabel,
unitLabel));
}

circleAttributes.Add("radius", dist);
circleAttributes.Add("disttype", CircleType.ToString());
circleAttributes.Add("centerx", Point1.X);
circleAttributes.Add("centery", Point1.Y);
if(IsDistanceCalcExpanded)
circleAttributes.Add("distanceunit", RateUnit.ToString());
else
circleAttributes.Add("distanceunit", LineDistanceType.ToString());
var color = new RgbColorClass() { Red = 255 } as IColor;
this.AddGraphicToMap(construct as IGeometry, color, attributes: circleAttributes);
Point2 = null;
HasPoint2 = false;
ResetFeedback();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using ESRI.ArcGIS.Display;
using DistanceAndDirectionLibrary;
using System.Collections.Generic;
using System.Threading;

namespace ArcMapAddinDistanceAndDirection.ViewModels
{
Expand Down Expand Up @@ -50,6 +51,8 @@ public LineFromTypes LineFromType

// stop feedback when from type changes
ResetFeedback();
Reset(false);
RaisePropertyChanged(() => DistanceBearingReady);
}
}

Expand Down Expand Up @@ -81,6 +84,7 @@ public override IPoint Point1
}

UpdateFeedback();
RaisePropertyChanged(() => DistanceBearingReady);
}
}

Expand Down Expand Up @@ -400,13 +404,14 @@ internal override void OnNewMapPointEvent(object obj)
if(LineFromType == LineFromTypes.BearingAndDistance)
{
ClearTempGraphics();
Point1 = point;
HasPoint1 = true;
var color = new RgbColorClass() { Green = 255 } as IColor;
System.Collections.Generic.IDictionary<String, System.Object> ptAttributes = new System.Collections.Generic.Dictionary<String, System.Object>();
ptAttributes.Add("X", Point1.X);
ptAttributes.Add("Y", Point1.Y);
this.AddGraphicToMap(Point1, color, true, esriSimpleMarkerStyle.esriSMSCircle, esriRasterOpCode.esriROPNOP, ptAttributes );
ptAttributes.Add("X", point.X);
ptAttributes.Add("Y", point.Y);
this.AddGraphicToMap(point, color, true, esriSimpleMarkerStyle.esriSMSCircle, esriRasterOpCode.esriROPNOP, ptAttributes );
HasPoint1 = true;

Point1 = point;
return;
}

Expand Down Expand Up @@ -512,5 +517,18 @@ internal override void Reset(bool toolReset)
Azimuth = 0.0;
}


public bool DistanceBearingReady
{

get
{
if (LineFromType == LineFromTypes.BearingAndDistance && Point1 != null)
return true;
else
return false;
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private void DrawRadials()
var color = new RgbColorClass() { Red = 255 } as IColor;
IDictionary<String, System.Object> rrAttributes = new Dictionary<String, System.Object>();
rrAttributes.Add("rings", NumberOfRings);
rrAttributes.Add("distance", Distance);
rrAttributes.Add("distance", radialLength);
rrAttributes.Add("distanceunit", lineDistanceType.ToString());
rrAttributes.Add("radials", NumberOfRadials);
rrAttributes.Add("centerx", Point1.X);
Expand Down Expand Up @@ -280,7 +280,7 @@ private IGeometry DrawRings()
var color = new RgbColorClass() { Red = 255 } as IColor;
IDictionary<String, System.Object> rrAttributes = new Dictionary<String, System.Object>();
rrAttributes.Add("rings", NumberOfRings);
rrAttributes.Add("distance", Distance);
rrAttributes.Add("distance", radius);
rrAttributes.Add("distanceunit", lineDistanceType.ToString());
rrAttributes.Add("radials", NumberOfRadials);
rrAttributes.Add("centerx", Point1.X);
Expand Down Expand Up @@ -424,14 +424,18 @@ private void ConstructGeoCircle()
rrAttributes.Add("rings", NumberOfRings);
rrAttributes.Add("distance", Distance);
rrAttributes.Add("radials", NumberOfRadials);
rrAttributes.Add("centerx", Point1.X);
rrAttributes.Add("centery", Point1.Y);
rrAttributes.Add("distanceunit", lineDistanceType.ToString());

construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), Distance, esriCurveDensifyMethod.esriCurveDensifyByAngle, 0.45);
Point2 = (construct as IPolyline).ToPoint;
this.AddGraphicToMap(construct as IGeometry, color, attributes: rrAttributes);
maxDistance = Math.Max(Distance, maxDistance);

// Use negative Distance to get the location for the distance label
construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), -Distance, esriCurveDensifyMethod.esriCurveDensifyByAngle, 0.45);
this.AddTextToMap(construct as IGeometry, String.Format("{0} {1}{2}", Math.Round(Distance, 2).ToString(), GetLinearUnit().Name, "s"));
this.AddTextToMap(construct as IGeometry, String.Format("{0} {1}", Math.Round(Distance, 2).ToString(), lineDistanceType.ToString()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public virtual bool IsToolActive
{
get
{
if (ArcMap.Application.CurrentTool != null)
if ((ArcMap.Application != null) && (ArcMap.Application.CurrentTool != null))
return ArcMap.Application.CurrentTool.Name == MAP_TOOL_NAME;

return false;
Expand Down Expand Up @@ -974,7 +974,7 @@ private void OnKeypressEscape(object obj)
{
// Special handling required for ellipses
if (this is EllipseViewModel)
{
{
// User has activated the Map Point tool but not created a point
// Or User has previously finished creating a graphic
// Either way, assume they want to disable the Map Point tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<!-- store here your styles -->
<Style TargetType="ComboBox">
<Style TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
Expand All @@ -51,5 +51,13 @@
<Setter Property="Command" Value="{Binding EditPropertiesDialogCommand}" />
<Setter Property="ToolTip" Value="{x:Static prop:Resources.TooltipEditProperties}" />
</Style>

<Style x:Key="textboxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="IsEnabled" Value="True" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsRunning}" Value="True">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="textblockStyle" TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"/>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
ItemsSource="{Binding Source={StaticResource circleFromData}}"
SelectedItem="{Binding Path=CircleType,
Mode=TwoWay}" >
<ComboBox.ItemContainerStyle>
<!--<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="Black" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox.ItemContainerStyle>-->
</ComboBox>
<TextBlock Margin="3,3,0,0" Text="{x:Static prop:Resources.LabelCenterPoint}" />
<Grid>
Expand Down Expand Up @@ -89,7 +89,7 @@
Path=.}" />
</TextBox.InputBindings>
<TextBox.Style>
<Style TargetType="TextBox">
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsDistanceCalcExpanded}" Value="False">
<Setter Property="IsEnabled" Value="True" />
Expand All @@ -106,22 +106,31 @@
Margin="3,3,0,0"
ItemsSource="{Binding Source={StaticResource lineDistanceData}}"
SelectedItem="{Binding Path=LineDistanceType,
Mode=TwoWay, ValidatesOnExceptions=True}" >
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="Black" />
</Style>
</ComboBox.ItemContainerStyle>
Mode=TwoWay, ValidatesOnExceptions=True}" >

<!--<ComboBox.Style>
<Style TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}"/>
</ComboBox.Style>-->




</ComboBox>
<Expander Margin="0,3,0,0"
Header="{x:Static prop:Resources.LabelDistanceCalculator}"
IsExpanded="{Binding IsDistanceCalcExpanded,
Mode=OneWayToSource}">


<StackPanel>

<TextBlock
<Label
Margin="3,3,0,0"
Text="{x:Static prop:Resources.LabelTime}" />
Content="{x:Static prop:Resources.LabelTime}" >

</Label>


<TextBox
Margin="3,3,0,0"
Text="{Binding Path=TravelTimeString,
Expand All @@ -146,15 +155,10 @@
CommandParameter="{Binding ElementName=mainControl,
Path=.}" />
</ComboBox.InputBindings>
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="Black" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBlock
<Label
Margin="3,3,0,0"
Text="{x:Static prop:Resources.LabelRate}" />
Content="{x:Static prop:Resources.LabelRate}" />
<TextBox
Margin="3,3,0,0"
Text="{Binding Path=TravelRateString,
Expand All @@ -180,13 +184,14 @@
CommandParameter="{Binding ElementName=mainControl,
Path=.}" />
</ComboBox.InputBindings>
<ComboBox.ItemContainerStyle>
<!--<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="Black" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox.ItemContainerStyle>-->
</ComboBox>
</StackPanel>

</Expander>
<StackPanel Margin="3,3,0,0"
HorizontalAlignment="Right"
Expand Down
Loading

0 comments on commit b1182ae

Please sign in to comment.