public FeatureHelper() { Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); System.Object obj = Activator.CreateInstance(factoryType); ISpatialReferenceFactory2 srf = obj as ISpatialReferenceFactory2; m_PCSout = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass(); m_PCSout = (IProjectedCoordinateSystem2)srf.CreateProjectedCoordinateSystem((int)esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere); // 102100 is equivalent to esriSRProjCS_WGS1984WebMercatorMajorAuxSphere m_sr = new com.esri.ags.SpatialReference(102100); }
protected override void OnClick() { IArray LineLyrArr; IArray PolygonLyrArr; IActiveView pActiveView = ArcMap.Document.ActiveView; IMap pMap = pActiveView.FocusMap; Utilities Utils = new Utilities(); if (!Utils.GetFabricSubLayers(pMap, esriCadastralFabricTable.esriCFTLines, out LineLyrArr)) { return; } if (!Utils.GetFabricSubLayers(pMap, esriCadastralFabricTable.esriCFTParcels, out PolygonLyrArr)) { return; } IFeatureLayer pFlyr = (IFeatureLayer)LineLyrArr.get_Element(0); IFeatureClass pFabricLinesFC = pFlyr.FeatureClass; pFlyr = (IFeatureLayer)PolygonLyrArr.get_Element(0); IFeatureClass pFabricParcelsFC = pFlyr.FeatureClass; IProjectedCoordinateSystem2 pPCS = null; IGeoDataset pGeoDS = (IGeoDataset)pFabricLinesFC; ISpatialReference pFabricSpatRef = pGeoDS.SpatialReference; double dMetersPerUnit = 1; bool bFabricIsInGCS = !(pFabricSpatRef is IProjectedCoordinateSystem2); if (pFabricSpatRef != null) { if (!bFabricIsInGCS) { pPCS = (IProjectedCoordinateSystem2)pFabricSpatRef; dMetersPerUnit = pPCS.CoordinateUnit.MetersPerUnit; } } string fileName = ""; if (dMetersPerUnit != 1) { fileName = AssemblyDirectory + "\\QualityControlLayers\\QA Symbology Feet.lyr"; } else { fileName = AssemblyDirectory + "\\QualityControlLayers\\QA Symbology Meters.lyr"; } bool bIsBefore1022 = false; string sBuild = Utils.GetDesktopBuildNumberFromRegistry(); int iBuildNumber = 0; if (Int32.TryParse(sBuild, out iBuildNumber)) { bIsBefore1022 = iBuildNumber < 3542; //CR278039 was fixed 10.2.2.3542 } AddQALayerToActiveView(pMap, pFabricLinesFC, pFabricParcelsFC, fileName, dMetersPerUnit, bIsBefore1022, bFabricIsInGCS); }