Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicogis committed Nov 23, 2016
1 parent 64d5947 commit e4a43f7
Show file tree
Hide file tree
Showing 15 changed files with 2,790 additions and 0 deletions.
80 changes: 80 additions & 0 deletions AnalysisSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//-----------------------------------------------------------------------
// <copyright file="AnalysisSurface.cs" company ="Studio A&T s.r.l.">
// Original code by John Grayson (ESRI)
// </copyright>
// <author>Nicogis</author>
//-----------------------------------------------------------------------

namespace Studioat.ArcGis.Soe.Rest
{
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;

/// <summary>
/// The AnalysisSurface class holds properties of the raster in the layer and creates an ISurface via RasterSurface
/// </summary>
internal class AnalysisSurface
{
/// <summary>
/// Initializes a new instance of the AnalysisSurface class
/// </summary>
/// <param name="rasterFromLayer">The raster from the layer</param>
public AnalysisSurface(IRaster rasterFromLayer) : this(rasterFromLayer, 0)
{
}

/// <summary>
/// Initializes a new instance of the AnalysisSurface class
/// </summary>
/// <param name="rasterFromLayer">The raster from the layer</param>
/// <param name="bandIndex">Index of the band</param>
public AnalysisSurface(IRaster rasterFromLayer, int bandIndex)
{
IRasterBandCollection rasterBC = (IRasterBandCollection)rasterFromLayer;
this.RasterBand = rasterBC.Item(bandIndex);
this.RasterDataset = this.RasterBand.RasterDataset;
this.Raster = this.RasterDataset.CreateDefaultRaster();

IGeoDataset rasterGDS = (IGeoDataset)this.RasterDataset;
this.SpatialReference = rasterGDS.SpatialReference;

IRasterSurface rasterSurface = new RasterSurfaceClass();
rasterSurface.PutRaster(this.Raster, bandIndex);
this.Surface = (ISurface)rasterSurface;
}

/// <summary>
/// Prevents a default instance of the AnalysisSurface class from being created
/// </summary>
private AnalysisSurface()
{
}

/// <summary>
/// Gets or sets rasterBand of the AnalysisSurface
/// </summary>
public IRasterBand RasterBand { get; set; }

/// <summary>
/// Gets or sets rasterDataset of the AnalysisSurface
/// </summary>
public IRasterDataset RasterDataset { get; set; }

/// <summary>
/// Gets or sets raster of the AnalysisSurface
/// </summary>
public IRaster Raster { get; set; }

/// <summary>
/// Gets or sets spatialReference of the AnalysisSurface
/// </summary>
public ISpatialReference SpatialReference { get; set; }

/// <summary>
/// Gets or sets surface of the AnalysisSurface
/// </summary>
public ISurface Surface { get; set; }
}
}
70 changes: 70 additions & 0 deletions Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//-----------------------------------------------------------------------
// <copyright file="Extensions.cs" company="Studio A&T s.r.l.">
// Copyright (c) Studio AT s.r.l. All rights reserved.
// </copyright>
// <author>Nicogis</author>
//-----------------------------------------------------------------------
namespace Studioat.ArcGis.Soe.Rest
{
using System.Diagnostics.CodeAnalysis;
using System.Text;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.SOESupport;

[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "-")]

/// <summary>
/// class for extension
/// </summary>
internal static class Extensions
{
/// <summary>
/// return the json in byte UTF8 from a object jsonObject
/// </summary>
/// <param name="jsonObject">obejct Json Object</param>
/// <returns>json in byte UTF8</returns>
internal static byte[] JsonByte(this JsonObject jsonObject)
{
string json = jsonObject.ToJson();
return Encoding.UTF8.GetBytes(json);
}

/// <summary>
/// Convert any Json geometry to its corresponding IGeometry
/// </summary>
/// <param name="jsonGeom">The Json geometry</param>
/// <returns>Converted IGeometry</returns>
internal static IGeometry ConvertAnyJsonGeom(this JsonObject jsonGeom)
{
object[] geomParts;
if (jsonGeom.TryGetArray("rings", out geomParts))
{
return Conversion.ToGeometry(jsonGeom, esriGeometryType.esriGeometryPolygon);
}

if (jsonGeom.TryGetArray("paths", out geomParts))
{
return Conversion.ToGeometry(jsonGeom, esriGeometryType.esriGeometryPolyline);
}

if (jsonGeom.TryGetArray("points", out geomParts))
{
return Conversion.ToGeometry(jsonGeom, esriGeometryType.esriGeometryMultipoint);
}

double? coordX;
if (jsonGeom.TryGetAsDouble("x", out coordX))
{
return Conversion.ToGeometry(jsonGeom, esriGeometryType.esriGeometryPoint);
}

double? minX;
if (jsonGeom.TryGetAsDouble("xmin", out minX))
{
return Conversion.ToGeometry(jsonGeom, esriGeometryType.esriGeometryEnvelope);
}

return null;
}
}
}
140 changes: 140 additions & 0 deletions FxCop.FxCop
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<FxCopProject Version="1.36" Name="My FxCop Project">
<ProjectOptions>
<SharedProject>True</SharedProject>
<Stylesheet Apply="False">c:\program files (x86)\microsoft fxcop 1.36\Xml\FxCopReport.xsl</Stylesheet>
<SaveMessages>
<Project Status="Active, Excluded" NewOnly="False" />
<Report Status="Active" NewOnly="False" />
</SaveMessages>
<ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" />
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
<SourceLookup>True</SourceLookup>
<AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
<RuleExceptionsThreshold>1</RuleExceptionsThreshold>
<Spelling Locale="en-US" />
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
<SearchGlobalAssemblyCache>False</SearchGlobalAssemblyCache>
<DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>
<IgnoreGeneratedCode>False</IgnoreGeneratedCode>
</ProjectOptions>
<Targets>
<AssemblyReferenceDirectories>
<Directory>$(ProjectDir)/../../../../../../../Program Files (x86)/ArcGIS/DeveloperKit10.1/bin/</Directory>
<Directory>$(ProjectDir)/../../../../../../../Program Files (x86)/ArcGIS/DeveloperKit10.1/DotNet/</Directory>
</AssemblyReferenceDirectories>
<Target Name="$(ProjectDir)/bin/Debug/Studioat.ArcGis.Soe.Rest.ElevationsUtility.dll" Analyze="True" AnalyzeAllChildren="True" />
</Targets>
<Rules>
<RuleFiles>
<RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\UsageRules.dll" Enabled="True" AllRulesEnabled="True" />
</RuleFiles>
<Groups />
<Settings />
</Rules>
<FxCopReport Version="1.36">
<Namespaces>
<Namespace Name="Studioat.ArcGis.Soe.Rest">
<Messages>
<Message Id="Gis" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Namespace">
<Item>Gis</Item>
<Item>Studioat.ArcGis.Soe.Rest</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
<Message Id="Soe" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Namespace">
<Item>Soe</Item>
<Item>Studioat.ArcGis.Soe.Rest</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
<Message Id="Studioat" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Namespace">
<Item>Studioat</Item>
<Item>Studioat.ArcGis.Soe.Rest</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
</Messages>
</Namespace>
</Namespaces>
<Targets>
<Target Name="$(ProjectDir)/bin/Debug/Studioat.ArcGis.Soe.Rest.ElevationsUtility.dll">
<Modules>
<Module Name="studioat.arcgis.soe.rest.elevationsutility.dll">
<Messages>
<Message Id="Gis" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Assembly">
<Item>Gis</Item>
<Item>'Studioat.ArcGis.Soe.Rest.ElevationsUtility.dll'</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
<Message Id="Soe" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Assembly">
<Item>Soe</Item>
<Item>'Studioat.ArcGis.Soe.Rest.ElevationsUtility.dll'</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
<Message Id="Studioat" TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704" Status="Excluded" Created="2013-02-05 17:15:29Z">
<Issue Name="Assembly">
<Item>Studioat</Item>
<Item>'Studioat.ArcGis.Soe.Rest.ElevationsUtility.dll'</Item>
</Issue>
<Notes>
<User Name="Administrator">
<Note Id="0" />
</User>
</Notes>
</Message>
</Messages>
</Module>
</Modules>
</Target>
</Targets>
<Notes>
<User Name="Administrator">
<Note Id="0" Modified="2013-02-05 17:16:02Z">Ok</Note>
</User>
</Notes>
<Rules>
<Rule TypeName="IdentifiersShouldBeSpelledCorrectly" Category="Microsoft.Naming" CheckId="CA1704">
<Resolution Name="Assembly">Correct the spelling of '{0}' in assembly name {1}.</Resolution>
<Resolution Name="Namespace">Correct the spelling of '{0}' in namespace name '{1}'.</Resolution>
</Rule>
</Rules>
</FxCopReport>
</FxCopProject>
Loading

0 comments on commit e4a43f7

Please sign in to comment.