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 #301 from Esri/dev
Browse files Browse the repository at this point in the history
August 2018 Release
  • Loading branch information
Lyle Wright authored Aug 9, 2018
2 parents 77d9f2f + f4e390f commit 2476a4a
Show file tree
Hide file tree
Showing 19 changed files with 2,826 additions and 669 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@
<DependentUpon>Config.esriaddinx</DependentUpon>
</Compile>
<Compile Include="Models\AddInPoint.cs" />
<Compile Include="Models\AddInPointObject.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Models\AMGraphic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions source/addins/ArcMapAddinVisibility/Models/AddInPointObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ArcMapAddinVisibility.Models
{
public class AddInPointObject
{
private int _id;

public int ID
{
get { return _id; }
set { _id = value; }
}
private AddInPoint _addInPoint;

public AddInPoint AddInPoint
{
get { return _addInPoint; }
set { _addInPoint = value; }
}

}
}
384 changes: 267 additions & 117 deletions source/addins/ArcMapAddinVisibility/ViewModels/LLOSViewModel.cs

Large diffs are not rendered by default.

559 changes: 536 additions & 23 deletions source/addins/ArcMapAddinVisibility/ViewModels/LOSBaseViewModel.cs

Large diffs are not rendered by default.

490 changes: 280 additions & 210 deletions source/addins/ArcMapAddinVisibility/ViewModels/RLOSViewModel.cs

Large diffs are not rendered by default.

98 changes: 55 additions & 43 deletions source/addins/ArcMapAddinVisibility/ViewModels/TabBaseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public TabBaseViewModel()
CancelCommand = new RelayCommand(OnCancelCommand);

// Mediator
Mediator.Register(Constants.NEW_MAP_POINT, OnMapClickEvent);
Mediator.Register(Constants.NEW_MAP_POINT, OnNewMapPointEvent);
Mediator.Register(Constants.MOUSE_MOVE_POINT, OnMouseMoveEvent);
Mediator.Register(Constants.TAB_ITEM_SELECTED, OnTabItemSelected);
Expand All @@ -68,7 +69,7 @@ protected virtual void OnActiveToolChanged(object obj)
{
string currentActiveToolName = obj as string;

if ((currentActiveToolName == ThisAddIn.IDs.MapPointTool))
if ((currentActiveToolName == ThisAddIn.IDs.MapPointTool))
return;

lastActiveToolName = currentActiveToolName;
Expand Down Expand Up @@ -292,6 +293,7 @@ public virtual bool CanCreateElement
public VisibilityLibrary.Helpers.RelayCommand ActivateToolCommand { get; set; }
public VisibilityLibrary.Helpers.RelayCommand EnterKeyCommand { get; set; }
public VisibilityLibrary.Helpers.RelayCommand CancelCommand { get; set; }
public bool IsMapClick { get; set; }

internal void OnCancelCommand(object obj)
{
Expand Down Expand Up @@ -411,7 +413,7 @@ internal void RemoveGraphics(IGraphicsContainer gc, List<AMGraphic> list)
}
}
elementList.Clear();

RaisePropertyChanged(() => HasMapGraphics);
}

Expand Down Expand Up @@ -474,7 +476,13 @@ internal virtual void OnNewMapPointEvent(object obj)
// do nothing
}

internal virtual void OnMapClickEvent(object obj)
{
IsMapClick = true;
}

#endregion

#region Public Functions
/// <summary>
/// Method used to deactivate tool
Expand Down Expand Up @@ -502,11 +510,11 @@ public void SetToolActiveInToolBar(string toolName)
return;
}

if ((ArcMap.Application.CurrentTool != null) &&
if ((ArcMap.Application.CurrentTool != null) &&
(ArcMap.Application.CurrentTool.Name.Equals(toolName)))
// Tricky: Check if tool already active - because setting CurrentTool again will
// cause Activate/Deactive to be called by ArcGIS framework
return;
// Tricky: Check if tool already active - because setting CurrentTool again will
// cause Activate/Deactive to be called by ArcGIS framework
return;

ESRI.ArcGIS.Framework.ICommandBars commandBars = ArcMap.Application.Document.CommandBars;
ESRI.ArcGIS.esriSystem.UID commandID = new ESRI.ArcGIS.esriSystem.UIDClass();
Expand All @@ -530,37 +538,37 @@ private string GetFormattedPoint(IPoint point)

try
{
var cn = point as IConversionNotation;
if (cn != null)
{
switch (VisibilityConfig.AddInConfig.DisplayCoordinateType)
var cn = point as IConversionNotation;
if (cn != null)
{
case CoordinateTypes.DD:
result = cn.GetDDFromCoords(6);
break;
case CoordinateTypes.DDM:
result = cn.GetDDMFromCoords(4);
break;
case CoordinateTypes.DMS:
result = cn.GetDMSFromCoords(2);
break;
//case CoordinateTypes.GARS:
// result = cn.GetGARSFromCoords();
// break;
case CoordinateTypes.MGRS:
result = cn.CreateMGRS(5, true, esriMGRSModeEnum.esriMGRSMode_Automatic);
break;
case CoordinateTypes.USNG:
result = cn.GetUSNGFromCoords(5, true, true);
break;
case CoordinateTypes.UTM:
result = cn.GetUTMFromCoords(esriUTMConversionOptionsEnum.esriUTMAddSpaces | esriUTMConversionOptionsEnum.esriUTMUseNS);
break;
default:
break;
switch (VisibilityConfig.AddInConfig.DisplayCoordinateType)
{
case CoordinateTypes.DD:
result = cn.GetDDFromCoords(6);
break;
case CoordinateTypes.DDM:
result = cn.GetDDMFromCoords(4);
break;
case CoordinateTypes.DMS:
result = cn.GetDMSFromCoords(2);
break;
//case CoordinateTypes.GARS:
// result = cn.GetGARSFromCoords();
// break;
case CoordinateTypes.MGRS:
result = cn.CreateMGRS(5, true, esriMGRSModeEnum.esriMGRSMode_Automatic);
break;
case CoordinateTypes.USNG:
result = cn.GetUSNGFromCoords(5, true, true);
break;
case CoordinateTypes.UTM:
result = cn.GetUTMFromCoords(esriUTMConversionOptionsEnum.esriUTMAddSpaces | esriUTMConversionOptionsEnum.esriUTMUseNS);
break;
default:
break;
}
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
Expand Down Expand Up @@ -600,6 +608,7 @@ private void OnTabItemSelected(object obj)
return;

IsActiveTab = (obj == this);
IsMapClick = false;
}

internal string AddTextToMap(string text, IGeometry geom, IColor color, bool IsTempGraphic = false, int size = 12)
Expand Down Expand Up @@ -653,9 +662,12 @@ internal string AddTextToMap(string text, IGeometry geom, IColor color, bool IsT
/// Adds a graphic element to the map graphics container
/// </summary>
/// <param name="geom">IGeometry</param>
internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic = false,
esriSimpleMarkerStyle markerStyle = esriSimpleMarkerStyle.esriSMSCircle, int size = 5)
internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic = false,
esriSimpleMarkerStyle markerStyle = esriSimpleMarkerStyle.esriSMSCircle, int size = 5, IColor borderColor = null)
{
if (borderColor == null)
borderColor = color;

if (geom == null || ArcMap.Document == null || ArcMap.Document.FocusMap == null)
return string.Empty;

Expand All @@ -669,7 +681,7 @@ internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic
var simpleMarkerSymbol = (ISimpleMarkerSymbol)new SimpleMarkerSymbol();
simpleMarkerSymbol.Color = color;
simpleMarkerSymbol.Outline = true;
simpleMarkerSymbol.OutlineColor = color;
simpleMarkerSymbol.OutlineColor = borderColor;
simpleMarkerSymbol.Size = size;
simpleMarkerSymbol.Style = markerStyle;

Expand All @@ -695,16 +707,16 @@ internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic
IPolygonElement pe = (IPolygonElement)new PolygonElementClass();
element = pe as IElement;
IFillShapeElement fe = (IFillShapeElement)pe;

var fillSymbol = new SimpleFillSymbolClass();
RgbColor selectedColor = new RgbColorClass();
selectedColor.Red = 0;
selectedColor.Green = 0;
selectedColor.Blue = 0;

selectedColor.Transparency = (byte)0;
fillSymbol.Color = selectedColor;
fillSymbol.Color = selectedColor;

fe.Symbol = fillSymbol;
}

Expand All @@ -720,7 +732,7 @@ internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic
var eprop = (IElementProperties)element;
eprop.Name = Guid.NewGuid().ToString();

GraphicsList.Add(new AMGraphic(eprop.Name, geom, IsTempGraphic));
GraphicsList.Add(new AMGraphic(eprop.Name, geom, IsTempGraphic));

gc.AddElement(element, 0);

Expand All @@ -732,7 +744,7 @@ internal string AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic
}

internal DistanceTypes GetDistanceType(int linearUnitFactoryCode)
{
{
DistanceTypes distanceType = DistanceTypes.Meters;
switch (linearUnitFactoryCode)
{
Expand Down Expand Up @@ -826,7 +838,7 @@ internal void ZoomToExtent(IGeometry geom)
var av = (IActiveView)ArcMap.Document.FocusMap;

IEnvelope env = geom.Envelope;

double extentPercent = (env.XMax - env.XMin) > (env.YMax - env.YMin) ? (env.XMax - env.XMin) * .3 : (env.YMax - env.YMin) * .3;
env.XMax = env.XMax + extentPercent;
env.XMin = env.XMin - extentPercent;
Expand Down
Loading

0 comments on commit 2476a4a

Please sign in to comment.