コード例 #1
0
        /// 获得个人地理数据库中要素类的名称
        /// </summary>
        /// <param name="pAccessWorkSpace">个人地理数据库工作空间</param>
        /// <returns pArrayFeatureClassName>个人地理数据库中要素类的名称</returns>
        public static IArray GetFeactureClassName_From_AccessWorkSpace(IWorkspace pAccessWorkSpace)
        {
            IArray pArrayFeatureClassName = new ArrayClass();

            //遍历直接位于地理数据库下的要素类FeatureClass
            IEnumDatasetName enumDatasetName = ((IWorkspace)pAccessWorkSpace).get_DatasetNames(esriDatasetType.esriDTFeatureClass);
            IDatasetName     datasetName     = enumDatasetName.Next();

            while (datasetName != null)
            {
                pArrayFeatureClassName.Add(datasetName.Name.ToString());
                datasetName = enumDatasetName.Next();//推进器
            }

            //遍历位于地理数据库数据集featuredataset下的要素类
            enumDatasetName = ((IWorkspace)pAccessWorkSpace).get_DatasetNames(esriDatasetType.esriDTFeatureDataset);
            datasetName     = enumDatasetName.Next();
            while (datasetName != null)
            {
                IFeatureDatasetName featureDatasetName = (IFeatureDatasetName)datasetName;
                IEnumDatasetName    enumDatasetNameFC  = featureDatasetName.FeatureClassNames;
                IDatasetName        datasetNameFC      = enumDatasetNameFC.Next();
                while (datasetNameFC != null)
                {
                    pArrayFeatureClassName.Add(datasetNameFC.Name.ToString());
                    datasetNameFC = enumDatasetNameFC.Next();//推进器
                }
                datasetName = enumDatasetName.Next();
            }

            return(pArrayFeatureClassName);
        }
コード例 #2
0
        /*
         * This method queries the device layer and returns a set of features
         */
        private IPropertySetArray QueryDevices(string whereClause, IStringArray outFields)
        {
            IPropertySetArray results = new PropertySetArray();

            int           deviceLayerId = soeUtil.GetLayerIdByName(mapService, DEVICE_LAYER_NAME);
            IFeatureClass deviceFC      = (IFeatureClass)mapServerDataAccess.GetDataSource(mapService.DefaultMapName, deviceLayerId);

            IQueryFilter filter = new QueryFilterClass();

            filter.WhereClause = whereClause;
            IFeatureCursor resultsFeatureCursor = deviceFC.Search(filter, false);

            IArray fieldIndex = new ArrayClass();

            for (int i = 0; i < outFields.Count; i++)
            {
                fieldIndex.Add(deviceFC.FindField(outFields.Element[i]));
            }
            IFeature resultFeature = null;

            while ((resultFeature = resultsFeatureCursor.NextFeature()) != null)
            {
                IPropertySet values = new PropertySet();
                for (int i = 0; i < outFields.Count; i++)
                {
                    values.SetProperty(outFields.Element[i], resultFeature.Value[(int)fieldIndex.Element[i]]);
                }
                results.Add(values);
            }
            Marshal.ReleaseComObject(resultsFeatureCursor);

            return(results);
        }
コード例 #3
0
        /// <summary>
        /// 多个要素同时闪烁 add by xisheng 2011.07.01
        /// </summary>
        private void DefaultSelNde()
        {
            Application.DoEvents();
            IArray geoArray = new ArrayClass();

            for (int i = 0; i < this.advTree.Nodes.Count; i++)
            {
                if (!this.advTree.Nodes[i].HasChildNodes)
                {
                    continue;
                }
                for (int j = 0; j < this.advTree.Nodes[i].Nodes.Count; j++)
                {
                    IFeature pFeature = this.advTree.Nodes[i].Nodes[j].Tag as IFeature;
                    geoArray.Add(pFeature);
                }
            }
            if (geoArray == null)
            {
                return;
            }
            HookHelperClass hookHelper = new HookHelperClass();

            hookHelper.Hook = m_pMapControl.Object;
            IHookActions hookAction = (IHookActions)hookHelper;

            hookAction.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsFlash);
        }
コード例 #4
0
        public IArray get_DatasetNames(esriDatasetType datasetType)
        {
            IArray datasets = new ArrayClass();

            if (datasetType == esriDatasetType.esriDTAny || datasetType != esriDatasetType.esriDTFeatureDataset)
            {
                // Since the state of the filesystem is beyond our control,
                // GetFiles() could throw.  If it does, we return an empty array.
                try
                {
                    foreach (var file in Directory.GetFiles(_workspacePath, GpxFilter))
                    {
                        string localName = Path.GetFileNameWithoutExtension(file);
                        if (!String.IsNullOrEmpty(localName))
                        {
                            datasets.Add(new GpxDataset(_workspacePath, localName));
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (ex is IOException || ex is UnauthorizedAccessException)
                        System.Diagnostics.Trace.TraceError(ex.Message);
                    else
                        throw;
                }
            }
            return datasets;
        }
コード例 #5
0
        private void Map_SearchByShape()
        {
            IMap       pMap             = axMapControl1.Map;
            ISelection pFeatureSelction = pMap.FeatureSelection;

            IEnumFeature      pEnumFeature      = pFeatureSelction as IEnumFeature;
            IEnumFeatureSetup pEnumFeatureSetup = pEnumFeature as IEnumFeatureSetup;

            pEnumFeatureSetup.AllFields = true;
            FeatureAttributeEventArgs FeatureAttributes = new FeatureAttributeEventArgs();
            IArray pFArray = new ArrayClass();

            pEnumFeature.Reset();
            IFeature pFeature = pEnumFeature.Next();

            while (pFeature != null)
            {
                pFArray.Add(pFeature);
                pFeature = pEnumFeature.Next();
            }
            FeatureAttributes.SelectFeatures = pFArray;
            if (SelectFeaturEvent != null)
            {
                SelectFeaturEvent(this, FeatureAttributes);
            }
        }
        public bool GetAllFabricSubLayers(out IArray CFSubLayers)
        {
            ICadastralFabricSubLayer pCFSubLyr     = null;
            IArray        CFParcelFabricSubLayers2 = new ArrayClass();
            IFeatureLayer pParcelFabricSubLayer    = null;
            UID           pId = new UIDClass();

            pId.Value = "{BA381F2B-F621-4F45-8F78-101F65B5BBE6}"; //ICadastralFabricSubLayer

            IEnumLayer pEnumLayer = ArcMap.Editor.Map.get_Layers(pId, true);

            pEnumLayer.Reset();
            ILayer pLayer = pEnumLayer.Next();

            while (pLayer != null)
            {
                pCFSubLyr             = (ICadastralFabricSubLayer)pLayer;
                pParcelFabricSubLayer = (IFeatureLayer)pCFSubLyr;
                IDataset pDS = (IDataset)pParcelFabricSubLayer.FeatureClass;
                if (pDS.Workspace.Equals(ArcMap.Editor.EditWorkspace))
                {
                    CFParcelFabricSubLayers2.Add(pParcelFabricSubLayer);
                }
                pLayer = pEnumLayer.Next();
            }
            CFSubLayers = CFParcelFabricSubLayers2;
            if (CFParcelFabricSubLayers2.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
ファイル: OGRWorkspace.cs プロジェクト: zhouqime/arcgis-ogr
        public IArray get_DatasetNames(esriDatasetType DatasetType)
        {
            if (m_connString == null)
            {
                return(null);
            }

            if (DatasetType == esriDatasetType.esriDTAny ||
                DatasetType == esriDatasetType.esriDTFeatureClass)
            {
                IArray datasets = new ArrayClass();

                int count = m_datasource.GetLayerCount();

                for (int i = 0; i < count; i++)
                {
                    OSGeo.OGR.Layer layer = m_datasource.GetLayerByIndex(i);

                    OGRDataset dataset = new OGRDataset(layer);

                    datasets.Add(dataset);
                }

                return(datasets);
            }

            return(null);
        }
コード例 #8
0
        private void method_2(IGroupLayer igroupLayer_1, ILayer ilayer_0, int int_0)
        {
            ICompositeLayer layer = igroupLayer_1 as ICompositeLayer;

            if ((layer.Count - 1) == int_0)
            {
                igroupLayer_1.Delete(ilayer_0);
                igroupLayer_1.Add(ilayer_0);
            }
            else
            {
                int    num;
                IArray array = new ArrayClass();
                for (num = 0; num < layer.Count; num++)
                {
                    array.Add(layer.get_Layer(num));
                }
                igroupLayer_1.Clear();
                for (num = 0; num < array.Count; num++)
                {
                    if (layer.Count == int_0)
                    {
                        igroupLayer_1.Add(ilayer_0);
                    }
                    ILayer layer2 = array.get_Element(num) as ILayer;
                    if (layer2 != ilayer_0)
                    {
                        igroupLayer_1.Add(layer2);
                    }
                }
            }
        }
コード例 #9
0
        public IArray get_DatasetNames(esriDatasetType DatasetType)
        {
            if (m_sWkspPath == null)
            {
                return(null);
            }

            //HIGHLIGHT: get_DatasetNames - Go through wksString to look for csp files
            if (DatasetType != esriDatasetType.esriDTAny &&
                DatasetType != esriDatasetType.esriDTTable)
            {
                return(null);
            }

            string[] sFiles = System.IO.Directory.GetFiles(m_sWkspPath, "*.csp");
            if (sFiles == null || sFiles.Length == 0)
            {
                return(null);
            }

            IArray datasets = new ArrayClass();

            foreach (string sFileName in sFiles)
            {
                SimplePointDataset ds = new SimplePointDataset(m_sWkspPath, System.IO.Path.GetFileNameWithoutExtension(sFileName));
                datasets.Add(ds);
            }

            return(datasets);
        }
コード例 #10
0
        /// <summary>
        /// 闪烁选中图斑
        /// </summary>
        /// <param name="featureCursor"></param>
        private void FlashPolygons(IFeatureCursor featureCursor)
        {
            IArray   geoArray = new ArrayClass();
            IFeature feature  = null;

            while ((feature = featureCursor.NextFeature()) != null)
            {
                //feature是循环外指针,所以必须用ShapeCopy
                geoArray.Add(feature.ShapeCopy);
            }

            //通过IHookActions闪烁要素集合
            HookHelperClass m_pHookHelper = new HookHelperClass();

            m_pHookHelper.Hook = m_MapControl.Object;
            IHookActions hookActions = (IHookActions)m_pHookHelper;

            hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsPan);

            System.Windows.Forms.Application.DoEvents();
            m_pHookHelper.ActiveView.ScreenDisplay.UpdateWindow();

            hookActions.DoActionOnMultiple(geoArray, esriHookActions.esriHookActionsFlash);
            System.Windows.Forms.Application.DoEvents();
            m_pHookHelper.ActiveView.ScreenDisplay.UpdateWindow();
        }
コード例 #11
0
        /// <summary>Creates new network attribute parameters</summary>
        private static void AddNetworkParameters(NetworkAttributeInfo nai, IEvaluatedNetworkAttribute netAttr)
        {
            // Create parameters
            if ((nai.Parameters != null) && (nai.Parameters.Count > 0))
            {
                IArray naParams = new ArrayClass();

                foreach (ParameterInfo paramInfo in nai.Parameters)
                {
                    INetworkAttributeParameter nap = new NetworkAttributeParameterClass();
                    nap.Name = paramInfo.Name;

                    if (paramInfo.DefaultValue is double)
                    {
                        nap.VarType = (int)VarEnum.VT_R8;
                    }
                    else if (paramInfo.DefaultValue is bool)
                    {
                        nap.VarType = (int)VarEnum.VT_BOOL;
                    }
                    else if (paramInfo.DefaultValue is string)
                    {
                        nap.VarType = (int)VarEnum.VT_BSTR;
                    }

                    nap.DefaultValue = paramInfo.DefaultValue;

                    naParams.Add(nap);
                }

                ((INetworkAttribute3)netAttr).Parameters = naParams;
            }
        }
コード例 #12
0
        /// <summary>
        /// 替换原地图容器中的元素为模板的元素
        /// </summary>
        /// <param name="tempGraph">模板</param>
        /// <param name="oldMapFrame">原地图容器</param>
        /// <returns></returns>
        private static IArray ReplaceOldIntoTempElement(IGraphicsContainer tempGraph, IMapFrame oldMapFrame)
        {
            tempGraph.Reset();
            IElement tempElement = tempGraph.Next();
            IArray   pArray      = new ArrayClass();

            while (tempElement != null)
            {
                if (tempElement is IMapFrame)
                {
                    //改变布局边框几何形状
                    IElement pMapFrameElement = oldMapFrame as IElement;
                    if (pMapFrameElement != null)
                    {
                        pMapFrameElement.Geometry = tempElement.Geometry;
                    }
                }
                else
                {
                    IMapSurroundFrame pTempMapSurroundFrame = tempElement as IMapSurroundFrame;
                    if (pTempMapSurroundFrame != null)
                    {
                        //设置地图框架
                        pTempMapSurroundFrame.MapFrame = oldMapFrame;
                    }

                    //获取图例指北针等元素
                    pArray.Add(tempElement);
                }

                tempElement = tempGraph.Next();
            }

            return(pArray);
        }
コード例 #13
0
        public void BufferOfFeatures(AxMapControl axMap, IFeatureLayer pFeatureLayer, double bRadiusInKm)
        {
            if (pFeatureLayer == null)
            {
                return;
            }
            IPoint pTransform = GeoBaseLib.PRJtoGCS(bRadiusInKm * 1000.0, 0);
            //double bRadiusInDegree = pTransform.X;
            double bRadiusInDegree = bRadiusInKm;

            GeoBaseLib       gb = new GeoBaseLib(axMap);
            IArray           pFaultFeatureArray = gb.Search(pFeatureLayer, null);
            IArray           pGeometries        = new ArrayClass();
            esriGeometryType geoType            = GeoBaseLib.GeometryType(pFeatureLayer);

            for (int i = 0; i < pFaultFeatureArray.Count; i++)
            {
                IFeature pFaultFeature = pFaultFeatureArray.get_Element(i) as IFeature;
                if (pFaultFeature.Shape.IsEmpty || pFaultFeature.Extent.Height == 0.0 || pFaultFeature.Extent.Width == 0.0)
                {
                    pFaultFeatureArray.Remove(i);
                    i--;
                    continue;
                }
                IGeometry pBufferGeometry = Buffer(pFaultFeature.Shape, bRadiusInDegree);
                pGeometries.Add(pBufferGeometry);
            }
            gb.CreateShapefile(pFeatureLayer.Name + ("_") + bRadiusInKm.ToString(), pFaultFeatureArray, pGeometries, esriGeometryType.esriGeometryPolygon);
        }
コード例 #14
0
        private void NewVerion_ItemClick(object sender, ItemClickEventArgs e)
        {
            ListViewItem item = this.VersionInfolist.SelectedItems[0];
            string       name = item.SubItems[1].Text + "." + item.SubItems[0].Text;

            try
            {
                IVersion unk = null;
                unk = this.iversionedWorkspace_0.FindVersion(name);
                IArray array = new ArrayClass();
                array.Add(unk);
                frmNewVersion version2 = new frmNewVersion
                {
                    ParentVersions = array
                };
                if (version2.ShowDialog() == DialogResult.OK)
                {
                    this.method_1();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
コード例 #15
0
        private static void RunGPFieldMapping()
        {
            // Initialize the Geoprocessor
            ESRI.ArcGIS.Geoprocessor.Geoprocessor GP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
            GP.OverwriteOutput = true;

            // Create the GPUtilites object
            IGPUtilities gputilities = new GPUtilitiesClass();

            // Create a DETable data element object 
            IDETable inputTableA = (IDETable)gputilities.MakeDataElement(@"C:\data\citiblocks.gdb\census", null, null);

            // Create an array of input tables
            IArray inputtables = new ArrayClass();
            inputtables.Add(inputTableA);

            // Initialize the GPFieldMapping
            IGPFieldMapping fieldmapping = new GPFieldMappingClass();
            fieldmapping.Initialize(inputtables, null);

            // Create a new output field
            IFieldEdit trackidfield = new FieldClass();
            trackidfield.Name_2 = "TRACTID";
            trackidfield.Type_2 = esriFieldType.esriFieldTypeString;
            trackidfield.Length_2 = 50;

            // Create a new FieldMap
            IGPFieldMap trackid = new GPFieldMapClass();
            trackid.OutputField = trackidfield;

            // Find field map "STFID" containing the input field "STFID". Add input field to the new field map.
            int fieldmap_index = fieldmapping.FindFieldMap("STFID");
            IGPFieldMap stfid_fieldmap = fieldmapping.GetFieldMap(fieldmap_index);
            int field_index = stfid_fieldmap.FindInputField(inputTableA, "STFID");
            IField inputField = stfid_fieldmap.GetField(field_index);
            trackid.AddInputField(inputTableA, inputField, 5, 10);

            // Add the new field map to the field mapping
            fieldmapping.AddFieldMap(trackid);

            // Execute Table to Table tool using the FieldMapping
            TableToTable tblTotbl = new TableToTable();
            tblTotbl.in_rows = inputTableA;
            tblTotbl.out_path = @"C:\data\citiblocks.gdb";
            tblTotbl.out_name = "census_out";
            tblTotbl.field_mapping = fieldmapping;

            object sev = null;
            try
            {
                GP.Execute(tblTotbl, null);
                System.Windows.Forms.MessageBox.Show(GP.GetMessages(ref sev));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                System.Windows.Forms.MessageBox.Show(GP.GetMessages(ref sev));
            }
        }
コード例 #16
0
ファイル: SnapExFeatures.cs プロジェクト: 605258778/GISData
        private void bbiFlashFeature_ItemClick(object sender, ItemClickEventArgs e)
        {
            int[]    selectedRows = (this.gcFeatures.MainView as ColumnView).GetSelectedRows();
            IFeature feature      = this._features[selectedRows[0]];
            IArray   pArray       = new ArrayClass();

            pArray.Add(feature.ShapeCopy);
            ((IHookActions)this._hook).DoActionOnMultiple(pArray, esriHookActions.esriHookActionsFlash);
        }
コード例 #17
0
        public IArray Find()
        {
            IFind  layer;
            IArray array3;

            if (this.cboLayers.SelectedIndex < 0)
            {
                return(null);
            }
            this.AddSearchStingToComboBox();
            IArray array2 = new ArrayClass();

            if (this.bool_0)
            {
                for (int i = 1; i < this.cboLayers.Properties.Items.Count; i++)
                {
                    layer = (this.cboLayers.Properties.Items[i] as LayerObject).Layer as IFind;
                    this.m_strFindLayers = "所有图层";
                    array3 = this.Find(layer);
                    if (array3 != null)
                    {
                        array2.Add(array3);
                    }
                }
                if (array2.Count == 0)
                {
                    return(null);
                }
                return(array2);
            }
            layer = (this.cboLayers.SelectedItem as LayerObject).Layer as IFind;
            this.m_strFindLayers = this.cboLayers.Text;
            array3 = this.Find(layer);
            if (array3 != null)
            {
                array2.Add(array3);
            }
            if (array2.Count == 0)
            {
                return(null);
            }
            return(array2);
        }
コード例 #18
0
        public static IArray Parameters(IEnumerable <AoGPParameter> ps)
        {
            IArray r = new ArrayClass();

            foreach (AoGPParameter p in ps)
            {
                r.Add(p.GPParameter);
            }
            return(r);
        }
コード例 #19
0
        public IArray GetSelectLegendItem()
        {
            IArray array = new ArrayClass();

            for (int i = 0; i < this.listLegendLayers.Items.Count; i++)
            {
                array.Add(this.listLegendLayers.Items[i]);
            }
            return(array);
        }
コード例 #20
0
        public static IArray RemoveAttributesByKeyName(IArray netAttributes, string keyName, bool keyIsPrefix)
        {
            IArray preservedNetAttributes = new ArrayClass();

            int keyNameLen = keyName.Length;
            int netAttributeNameLen;
            INetworkAttribute netAttribute;
            string            netAttributeName;
            bool isKeyAttribute;
            bool ignoreCase = true;

            int count = netAttributes.Count;

            for (int i = 0; i < count; ++i)
            {
                netAttribute = netAttributes.get_Element(i) as INetworkAttribute;
                if (netAttribute == null)
                {
                    continue;
                }

                netAttributeName    = netAttribute.Name;
                netAttributeNameLen = netAttributeName.Length;

                isKeyAttribute = false;
                if (keyNameLen == 0)
                {
                    isKeyAttribute = false;
                }
                else if (netAttributeNameLen < keyNameLen)
                {
                    isKeyAttribute = false;
                }
                else
                {
                    int startIndex = 0;
                    if (!keyIsPrefix)
                    {
                        startIndex = netAttributeNameLen - keyNameLen;
                    }

                    if (String.Compare(netAttributeName.Substring(startIndex, keyNameLen), keyName, ignoreCase) == 0)
                    {
                        isKeyAttribute = true;
                    }
                }

                if (!isKeyAttribute)
                {
                    preservedNetAttributes.Add(netAttribute);
                }
            }

            return(preservedNetAttributes);
        }
コード例 #21
0
        protected override void OnClick()
        {
            //Enable publisher extension
            if (EnablePublisherExtension())
            {
                System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;

                IMxDocument mapDoc = ArcMap.Document;

                IPMFPublish3 publishMaps = new PublisherEngineClass();

                //Accept the default settings when the map is published.
                IPropertySet settings = publishMaps.GetDefaultPublisherSettings();              

                IArray orderedMaps = new ArrayClass();
                //Loop over all the maps in the map document and each one to an Array object
                for (int i = 0; i <= mapDoc.Maps.Count - 1; i++)
                {
                    orderedMaps.Add(mapDoc.Maps.get_Item(i));
                }

                try
                {
                    //Create the PMF file using the current settings and the map order specified in the IArray parameter
                    //It will be written to C:\\PublishedMap.pmf and the data will be referenced using relative paths.
                    publishMaps.PublishWithOrder(orderedMaps, mapDoc.PageLayout, mapDoc.ActiveView, settings,
                                                 true, "C:\\PublishedMap.pmf");


                    //Report outcome to the user
                    string mapdocTitle = ((IDocument)ArcMap.Document).Title;
                    string msg = string.Empty;

                    if (orderedMaps.Count == 1)
                    {
                        msg = "The map in " + mapdocTitle + " has been published successfully";
                    }
                    else
                    {
                        msg = "The maps in " + mapdocTitle + " have been published successfully";
                    }

                    MessageBox.Show(msg);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error Publishing Map: " + ex.Message, "Error");
                }

                System.Windows.Forms.Cursor.Current = Cursors.Default;

            }

            ArcMap.Application.CurrentTool = null;
        }
コード例 #22
0
        public void AddIntElementInObjectArray()
        {
            var data = new int[] { 1, 2, 3, 0, 0, 0, 0, 0 };
            var newElement = 1;

            var array = new ArrayClass<int>(data, 3);
            array.Add(newElement);
            var count = array.GetCount();

            Assert.AreEqual(4, count);
        }
コード例 #23
0
        public void AddIntElementInObjectArrayWithLength17()
        {
            var data = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
            var newElement = 17;

            var array = new ArrayClass<int>(data, 16);
            array.Add(newElement);
            var count = array.GetCount();

            Assert.AreEqual(17, count);
        }
コード例 #24
0
        protected override void OnClick()
        {
            //Enable publisher extension
            if (EnablePublisherExtension())
            {
                System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;

                IMxDocument mapDoc = ArcMap.Document;

                IPMFPublish3 publishMaps = new PublisherEngineClass();

                //Accept the default settings when the map is published.
                IPropertySet settings = publishMaps.GetDefaultPublisherSettings();

                IArray orderedMaps = new ArrayClass();
                //Loop over all the maps in the map document and each one to an Array object
                for (int i = 0; i <= mapDoc.Maps.Count - 1; i++)
                {
                    orderedMaps.Add(mapDoc.Maps.get_Item(i));
                }

                try
                {
                    //Create the PMF file using the current settings and the map order specified in the IArray parameter
                    //It will be written to C:\\PublishedMap.pmf and the data will be referenced using relative paths.
                    publishMaps.PublishWithOrder(orderedMaps, mapDoc.PageLayout, mapDoc.ActiveView, settings,
                                                 true, "C:\\PublishedMap.pmf");


                    //Report outcome to the user
                    string mapdocTitle = ((IDocument)ArcMap.Document).Title;
                    string msg         = string.Empty;

                    if (orderedMaps.Count == 1)
                    {
                        msg = "The map in " + mapdocTitle + " has been published successfully";
                    }
                    else
                    {
                        msg = "The maps in " + mapdocTitle + " have been published successfully";
                    }

                    MessageBox.Show(msg);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error Publishing Map: " + ex.Message, "Error");
                }

                System.Windows.Forms.Cursor.Current = Cursors.Default;
            }

            ArcMap.Application.CurrentTool = null;
        }
コード例 #25
0
        public void AddEightIntElementInObjectArray()
        {
            var array = new ArrayClass<int>();

            for (var i = 1; i <= 11; i++)
            {
                array.Add(i);
            }
            var count = array.GetCount();

            Assert.AreEqual(11, count);
        }
コード例 #26
0
        /// <summary>Creates an new (unbuilt) Network Dataset</summary>
        private void CreateBuildableNDS()
        {
            IDENetworkDataset2 deNetworkDataset = new DENetworkDatasetClass();

            deNetworkDataset.Buildable = true;

            ((IDataElement)deNetworkDataset).Name = _ndsName;

            // Copy the feature dataset's extent and spatial reference to the network dataset
            IDEGeoDataset deGeoDataset = (IDEGeoDataset)deNetworkDataset;

            deGeoDataset.Extent           = _extent;
            deGeoDataset.SpatialReference = _spatialReference;

            deNetworkDataset.ElevationModel = esriNetworkElevationModel.esriNEMNone;
            deNetworkDataset.SupportsTurns  = true;

            // General Network Directions
            GeneralNetworkDirectionInfo dirInfo = _xml.GeneralNetworkDirections();

            if (dirInfo != null)
            {
                INetworkDirections netdir = new NetworkDirectionsClass();
                netdir.LengthAttributeName      = dirInfo.LengthAttr;
                netdir.DefaultOutputLengthUnits = dirInfo.LengthUnits;
                netdir.RoadClassAttributeName   = dirInfo.RoadClassAttr;
                netdir.TimeAttributeName        = dirInfo.TimeAttr;

                deNetworkDataset.Directions = netdir;
            }

            IArray sources = new ArrayClass();

            foreach (INetworkSource ns in EnumerateNetworkSources())
            {
                sources.Add(ns);
            }

            IArray attrs = new ArrayClass();

            foreach (var na in _networkAttrs)
            {
                attrs.Add(na);
            }

            deNetworkDataset.Sources    = sources;
            deNetworkDataset.Attributes = attrs;

            // Get the feature dataset extension and create the network dataset from the data element.
            IFeatureDatasetExtension fdExtension = ((IFeatureDatasetExtensionContainer)_osmDataset).FindExtension(esriDatasetType.esriDTNetworkDataset);

            _networkDataset = (INetworkDataset)((IDatasetContainer2)fdExtension).CreateDataset((IDEDataset)deNetworkDataset);
        }
コード例 #27
0
ファイル: FindResultControlEx.cs プロジェクト: secondii/Yutai
        private void SelectFeature_ItemClick(object sender, ItemClickEventArgs e)
        {
            IFeatureFindData2 tag   = null;
            IArray            array = new ArrayClass();

            try
            {
                for (int i = 0; i < this.listView1.SelectedItems.Count; i++)
                {
                    tag = this.listView1.SelectedItems[i].Tag as IFeatureFindData2;
                    if (this.ibasicMap_0 is IMap)
                    {
                        (this.ibasicMap_0 as IMap).SelectFeature(tag.Layer, tag.Feature);
                    }
                    array.Add(tag.Feature);
                }
                IEnumFeature featureSelection = null;
                if (this.ibasicMap_0 is IMap)
                {
                    featureSelection = (this.ibasicMap_0 as IMap).FeatureSelection as IEnumFeature;
                    featureSelection.Reset();
                    IFeature  feature2 = featureSelection.Next();
                    IEnvelope other    = null;
                    while (feature2 != null)
                    {
                        if (other == null)
                        {
                            other = feature2.Extent;
                        }
                        else
                        {
                            other.Union(feature2.Extent);
                        }
                        feature2 = featureSelection.Next();
                    }
                    if (other != null)
                    {
                        IRelationalOperator extent = (this.ibasicMap_0 as IActiveView).Extent as IRelationalOperator;
                        if (!extent.Contains(other))
                        {
                            (this.ibasicMap_0 as IActiveView).Extent = other;
                        }
                    }
                    (this.ibasicMap_0 as IActiveView).Refresh();
                }
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
        }
コード例 #28
0
ファイル: FormVertexList.cs プロジェクト: 605258778/GISData
 private void HighlightPoint()
 {
     try
     {
         IPoint selectedVertex = this.GetSelectedVertex();
         if (selectedVertex != null)
         {
             IArray pArray = new ArrayClass();
             pArray.Add(selectedVertex);
             ((IHookActions)this._hookHelper).DoActionOnMultiple(pArray, esriHookActions.esriHookActionsFlash);
         }
     }
     catch
     {
     }
 }
コード例 #29
0
        /// <summary>Adds edge feature classes to the network dataset</summary>
        /// <remarks>
        /// - For each 'edge' element in the config file, adds a new EdgeFeatureSource to the NDS
        /// - A new feature class is extracted from *_OSM_LN using a filter specified in the config file
        /// </remarks>
        private void ExtractEdgeFeatureClasses()
        {
            IList <SourceFeatureClassInfo> edges = _xml.EdgeFeatureClasses().ToList();

            if ((edges == null) || (edges.Count == 0))
            {
                return;
            }

            ConvertRequiredTagsToAttributes(true);

            // Create the new feature class using the query filter from the config XML
            foreach (SourceFeatureClassInfo edge in edges)
            {
                string edgeClassName = GetFullClassName(edge.Name);
                SelectFeaturesToNewFeatureClass(_osmLinePath, _dsPath + "\\" + edgeClassName, edge.Query);

                INetworkSource edgeNetworkSource = new EdgeFeatureSourceClass();
                edgeNetworkSource.Name        = edgeClassName;
                edgeNetworkSource.ElementType = esriNetworkElementType.esriNETEdge;

                IEdgeFeatureSource edgeFeatureSource = (IEdgeFeatureSource)edgeNetworkSource;
                edgeFeatureSource.UsesSubtypes            = false;
                edgeFeatureSource.ClassConnectivityPolicy = (esriNetworkEdgeConnectivityPolicy)edge.ConnectPolicy;

                if (edge.StreetNameFields != null)
                {
                    // Create a StreetNameFields object and populate its settings for the Streets source.
                    IStreetNameFields streetNameFields = new StreetNameFieldsClass();
                    streetNameFields.Priority                 = 1;
                    streetNameFields.StreetNameFieldName      = edge.StreetNameFields.StreetName;
                    streetNameFields.PrefixDirectionFieldName = edge.StreetNameFields.DirectionPrefix;
                    streetNameFields.SuffixDirectionFieldName = edge.StreetNameFields.DirectionSuffix;
                    streetNameFields.PrefixTypeFieldName      = edge.StreetNameFields.TypePrefix;
                    streetNameFields.SuffixTypeFieldName      = edge.StreetNameFields.TypeSuffix;

                    INetworkSourceDirections sourceDirections = new NetworkSourceDirectionsClass();
                    IArray streetNameFieldsArray = new ArrayClass();
                    streetNameFieldsArray.Add(streetNameFields);
                    sourceDirections.StreetNameFields = streetNameFieldsArray;
                    ((INetworkSource)edgeFeatureSource).NetworkSourceDirections = sourceDirections;
                }

                _edgeSources.Add(edgeFeatureSource);
            }
        }
コード例 #30
0
        ////////////////////////////////////////////////////////////////////////
        // METHOD: PopulateAOIListUsingParent
        private bool PopulateAOIListUsingParent(IJTXJob2 pParentJob, ref IArray aoiList, int numCopies)
        {
            try
            {
                aoiList = new ArrayClass();
                for (int i = 0; i < numCopies; i++)
                {
                    aoiList.Add(pParentJob.AOIExtent);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create AOIs based on parent job's AOI: " + ex.Message);
            }

            return(true);
        }
コード例 #31
0
ファイル: FindResultControl.cs プロジェクト: secondii/Yutai
        private void Identify_ItemClick(object sender, ItemClickEventArgs e)
        {
            IFeatureFindData2 tag   = null;
            IArray            array = new ArrayClass();

            for (int i = 0; i < this.listView1.SelectedItems.Count; i++)
            {
                tag = this.listView1.SelectedItems[i].Tag as IFeatureFindData2;
                array.Add(tag.Feature);
            }
            frmInfo info = new frmInfo
            {
                FocusMap = this.iactiveView_0.FocusMap as IBasicMap
            };

            info.SetInfo(null, array, array.get_Element(0) as IFeature);
            info.ShowDialog();
        }
コード例 #32
0
        //buffer查询并闪烁。
        public static void BufferSelectAndFlash(IMapControl4 mapCtrl, IGeometry baseGeo, esriSpatialRelEnum spatialRef, ILayer layer)
        {
            IFeatureLayer featureLayer = layer as IFeatureLayer;

            if (mapCtrl == null || featureLayer == null)
            {
                return;
            }
            IFeatureClass  fC      = featureLayer.FeatureClass;
            ISpatialFilter pFilter = new SpatialFilterClass();

            pFilter.Geometry      = baseGeo;
            pFilter.GeometryField = "SHAPE";
            pFilter.SpatialRel    = spatialRef;
            IFeatureCursor pFeatureCursor = fC.Search(pFilter, false);

            IArray   inArray = new ArrayClass();
            IFeature fe      = pFeatureCursor.NextFeature();

            mapCtrl.Map.ClearSelection();
            while (fe != null)
            {
                inArray.Add(fe);
                mapCtrl.Map.SelectFeature(layer, fe);
                fe = pFeatureCursor.NextFeature();
            }

            if (inArray == null)
            {
                return;
            }

            HookHelper m_hookHelper = new HookHelperClass();

            m_hookHelper.Hook = mapCtrl.Object;
            IHookActions hookAction = (IHookActions)m_hookHelper;

            ICommand cmd = new ControlsZoomToSelectedCommandClass();

            cmd.OnCreate(m_hookHelper.Hook);
            cmd.OnClick();
            Application.DoEvents();
            hookAction.DoActionOnMultiple(inArray, esriHookActions.esriHookActionsFlash);
        }
コード例 #33
0
ファイル: FrmFilter.cs プロジェクト: wwcc19870805/DIFGIS
 private bool CheckConditionFld(string m_SQL)
 {
     try
     {
         string[] s      = null;
         string[] p      = null;
         IArray   arrFld = new ArrayClass();
         if (m_SQL.IndexOf("or") > -1)
         {
             m_SQL = m_SQL.Replace("or", "-");
             s     = m_SQL.Split('-');
             for (int i = 0; i < s.Length; i++)
             {
                 if (s[i].IndexOf("=") > -1)
                 {
                     p = s[i].Split('=');
                     arrFld.Add(p[0]);
                 }
             }
             if (arrFld.Count > 1)
             {
                 for (int j = 0; j < arrFld.Count; j++)
                 {
                     for (int m = j + 1; m < arrFld.Count; m++)
                     {
                         if (arrFld.get_Element(j).ToString() != arrFld.get_Element(m).ToString())
                         {
                             return(false);
                         }
                     }
                 }
             }
             return(true);
         }
         else
         {
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
コード例 #34
0
ファイル: FindResultControl.cs プロジェクト: secondii/Yutai
        private void ZoomToFeature_ItemClick(object sender, ItemClickEventArgs e)
        {
            IFeatureFindData2 tag = null;
            int    num;
            IArray array = new ArrayClass();

            for (num = 0; num < this.listView1.SelectedItems.Count; num++)
            {
                tag = this.listView1.SelectedItems[num].Tag as IFeatureFindData2;
                array.Add(tag.Feature);
            }
            CommonHelper.Zoom2Features(this.iactiveView_0, array);
            this.iactiveView_0.ScreenDisplay.UpdateWindow();
            for (num = 0; num < this.listView1.SelectedItems.Count; num++)
            {
                tag = this.listView1.SelectedItems[num].Tag as IFeatureFindData2;
                Flash.FlashFeature(this.iactiveView_0.ScreenDisplay, tag.Feature);
            }
        }
コード例 #35
0
        public static bool Merge(string[] files, string featureClassName, string outputfeatureClass)
        {
            IArray array = new ArrayClass();

            //List<IFeatureClass> list = new List<IFeatureClass>();
            foreach (var item in files)
            {
                var entry = GetFeatureClass(item, featureClassName);
                if (entry != null)
                {
                    array.Add(entry);
                    //_merge.inputs = entry;
                    //list.Add(entry);
                }
            }
            _merge.inputs = array;
            _merge.output = outputfeatureClass;
            return(Excute(_merge));
        }
コード例 #36
0
        /// <summary>
        /// Gets a list of all dataset names of the particular dataset type
        /// We only support feature classes currently
        /// </summary>
        /// <param name="DatasetType">the type of dataset</param>
        /// <returns>an array of IPlugInDatasetInfo</returns>
        public IArray get_DatasetNames(esriDatasetType DatasetType)
        {
            if (DatasetType != esriDatasetType.esriDTAny &&
                DatasetType != esriDatasetType.esriDTFeatureClass)
            {
                return(null);
            }

            IArray retVal = new ArrayClass();

            var names = m_CatalogDS.GetAllEntries();

            foreach (var name in names)
            {
                retVal.Add(new MongoDBDataset(name, m_Connection));
            }

            return(retVal);
        }
コード例 #37
0
		public IArray get_DatasetNames(esriDatasetType DatasetType)
		{
			if (m_sWkspPath == null)
				return null;

			//HIGHLIGHT: get_DatasetNames - Go through wksString to look for csp files
			if (DatasetType != esriDatasetType.esriDTAny && 
				DatasetType != esriDatasetType.esriDTTable)
				return null;

			string[] sFiles = System.IO.Directory.GetFiles(m_sWkspPath, "*.csp");
			if (sFiles == null || sFiles.Length == 0)
				return null;

			IArray datasets = new ArrayClass();
			foreach (string sFileName in sFiles)
			{
				SimplePointDataset ds = new SimplePointDataset(m_sWkspPath, System.IO.Path.GetFileNameWithoutExtension(sFileName));
				datasets.Add(ds);
			}

			return datasets;
		}
コード例 #38
0
ファイル: Mainfrm.cs プロジェクト: chinasio/Control
 private void InitializeMap(string sDataPath)
 {
     IArray layerNameArray = new ArrayClass();
     layerNameArray.Add("Parcels");
     layerNameArray.Add("Roads");
     layerNameArray.Add("Ocean");
     SetLayersForApp(layerNameArray);
     IEnvelope pEnv = new EnvelopeClass();
     pEnv.XMin = 555957;
     pEnv.YMin = 39874;
     pEnv.XMax = 563539;
     pEnv.YMax = 45522;
     IActiveView pActiveView = axMapControl1.ActiveView.FocusMap as IActiveView;
     pActiveView.Extent = pEnv;
     pActiveView.Refresh();
 }
コード例 #39
0
ファイル: Mainfrm.cs プロジェクト: chinasio/Control
 //������ʩ�������
 private void menuItem68_Click(object sender, EventArgs e)
 {
     axMapControl1.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
     m_BasicOperationTool = "isProfileAnalysis";
     IMap pMap = axMapControl1.ActiveView.FocusMap;
     pMap.DelayDrawing(true);
     CleanUpApp();
     //�����ʩ���������еIJ���
     IEnvelope pEnv = new EnvelopeClass();
     pEnv.XMin = 561900;
     pEnv.YMin = 42450;
     pEnv.XMax = 563800;
     pEnv.YMax = 43676;
     axMapControl1.ActiveView.Extent = pEnv;
     //�򿪸ù����漰����ͼ��
     IArray pLayerNameArray = new ArrayClass();
     pLayerNameArray.Add("Sewer Fixtures");
     pLayerNameArray.Add("Sewer Lines");
     pLayerNameArray.Add("Parcels");
     pLayerNameArray.Add("Roads");
     SetLayersForApp(pLayerNameArray);
     //ΪWater fixtures��������ͼ�㶨��
     IFeatureLayer pFeatLayer = Utility.FindFeatLayer("Sewer Fixtures", this);
     IFeatureLayerDefinition pFeatLayerDef = pFeatLayer as IFeatureLayerDefinition;
     pFeatLayerDef.DefinitionExpression = "[NODE_TYPE] = 'MH'";
     IFeatureLayer pFeatLayer2 = Utility.FindFeatLayer("Sewer Lines", this);
     pFeatLayerDef = pFeatLayer2 as IFeatureLayerDefinition;
     pFeatLayerDef.DefinitionExpression = "[LINE_TYPE] = 'MG'";
     //����ѡ��ͼ��
     for (int i = 0; i <= pMap.LayerCount - 1; i++)
     {
         if (pMap.get_Layer(i) is IFeatureLayer)
         {
             pFeatLayer2 = pMap.get_Layer(i) as IFeatureLayer;
             if (pFeatLayer2.Name == "Sewer Fixtures")
                 pFeatLayer2.Selectable = true;
             else
                 pFeatLayer2.Selectable = false;
         }
     }
     //���ָ���ļ�������
     string sUtilityNetPath;
     sUtilityNetPath = Application.StartupPath + @"\..\..\..\Data\Sewer9\data\sewer3.mdb";
     pGeoNetwork = Utility.openGeoNetwork(sUtilityNetPath, "urban", "Sewer_Network");
     pMap.DelayDrawing(false);
     axMapControl1.ActiveView.Refresh();
 }
コード例 #40
0
ファイル: Mainfrm.cs プロジェクト: chinasio/Control
        //����ά����Ƶ����
        private void menuItem70_Click(object sender, EventArgs e)
        {
            axMapControl1.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
            m_BasicOperationTool = "isSewerTvSurvey";
            IMap pMap = axMapControl1.ActiveView.FocusMap;
            pMap.DelayDrawing(true);
            CleanUpApp();
            //�����ʩ���������еIJ���

            //�򿪸ù����漰����ͼ��
            IArray pLayerNameArray = new ArrayClass();
            pLayerNameArray.Add("Sewer TV Surveys");
            pLayerNameArray.Add("Sewer Lines");
            pLayerNameArray.Add("Parcels");
            pLayerNameArray.Add("Roads");
            pLayerNameArray.Add("Ocean");
            SetLayersForApp(pLayerNameArray);
            //ΪWater fixtures��������ͼ�㶨��
            IFeatureLayer pFeatLayer = Utility.FindFeatLayer("Sewer TV Surveys", this);
            IGeoDataset pGeodataset = pFeatLayer as IGeoDataset;
            IEnvelope pEnv = pGeodataset.Extent;
            pEnv.Expand(1.05, 1.05, true);
            axMapControl1.ActiveView.Extent = pEnv;
            //����ѡ��ͼ��
            for (int i = 0; i <= pMap.LayerCount - 1; i++)
            {
                if (pMap.get_Layer(i) is IFeatureLayer)
                {
                    pFeatLayer = pMap.get_Layer(i) as IFeatureLayer;
                    if (pFeatLayer.Name == "Sewer Lines" || pFeatLayer.Name == "Sewer TV Surveys" || pFeatLayer.Name == "TV Survey Events")
                        pFeatLayer.Selectable = true;
                    else
                        pFeatLayer.Selectable = false;
                }
            }
            //���ָ���ļ�������
            //string sUtilityNetPath;
            // sUtilityNetPath = Application.StartupPath + @"\..\..\..\Data\Sewer9\data\sewer3.mdb";
            //pGeoNetwork = Utility.openGeoNetwork(sUtilityNetPath, "urban", "Sewer_Network");
            Utility.TVScansHatchRoutes(this);

            pMap.DelayDrawing(false);
            axMapControl1.ActiveView.Refresh();
        }
コード例 #41
0
        //��˷׷�ٲ��ҹ����漰�ĵؿ�
        public static void UpStreamFindParcels(AxMapControl ppAxMapControl, IEnumNetEID pEnumResultEdges, IGeometricNetwork pGeoNetwork)
        {
            try
            {

                IFeatureLayer pFeatLayerSewerLines = FindFeatLayer("Sewer Lines", ppAxMapControl);
                IFeatureLayer pFeatLayerParcels = FindFeatLayer("Parcels", ppAxMapControl);
                //����ѡ���Sewer�������д������ΰ�

                IGeometryCollection pGeomBag = new GeometryBagClass();
                object missing = Type.Missing;
                int lEID;
                int iUserClassID;
                int iUserID;
                int iUserSubID;
                INetElements pNetElements = pGeoNetwork.Network as INetElements;
                pEnumResultEdges.Reset();
                IFeature pFeature;

                for (int j = 0; j <= pEnumResultEdges.Count - 1; j++)
                {
                    lEID = pEnumResultEdges.Next();
                    pNetElements.QueryIDs(lEID, esriElementType.esriETEdge, out iUserClassID, out iUserID, out iUserSubID);
                    pFeature = pFeatLayerSewerLines.FeatureClass.GetFeature(iUserID);
                    pGeomBag.AddGeometry(pFeature.Shape, ref missing, ref missing);
                    // MessageBox.Show(iUserClassID.ToString()+","+iUserID.ToString()+","+iUserSubID.ToString());
                }
                //���пռ����˵��Ӳ��������ڲ��ҵؿ���Ϣ
                ISpatialFilter pSpatialFilter = new SpatialFilterClass();
                pSpatialFilter.Geometry = pGeomBag as IGeometry;
                pSpatialFilter.GeometryField = "Shape";
                pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                pSpatialFilter.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;

                //��ý��浽�ĵؿ���Ϣ
                IFeatureCursor pFeatCursor = pFeatLayerParcels.FeatureClass.Search(pSpatialFilter, false);
                //���ӱ�ѡ��ĵؿ����ݵ���ͼ��ͼ��ͼ��������
                ICompositeGraphicsLayer pComGraphicLayer = new CompositeGraphicsLayerClass();
                ILayer pLayer = pComGraphicLayer as ILayer;
                pLayer.Name = "��Ӱ��ĵؿ�";
                IGraphicsContainer pGraphicContainer = pComGraphicLayer as IGraphicsContainer;
                //������ѡ��ĵؿ鵽ͼ��������
                ISimpleFillSymbol pSymFill = new SimpleFillSymbolClass();
                IFillSymbol pFillSymbol = pSymFill as IFillSymbol;
                IRgbColor pRgbColor = new RgbColorClass();
                pRgbColor.Red = 0;
                pRgbColor.Green = 200;
                pRgbColor.Blue = 100;
                pFillSymbol.Color = pRgbColor as IColor;
                ICartographicLineSymbol pCartoLine = new CartographicLineSymbolClass();
                IRgbColor pRgbColor2 = new RgbColorClass();
                pRgbColor2.Red = 100;
                pRgbColor2.Green = 200;
                pRgbColor2.Blue = 100;
                pCartoLine.Width = 2;
                pCartoLine.Color = pRgbColor2 as IColor;
                pFillSymbol.Outline = pCartoLine;
                //����������еؿ�����������
                IArray pFeatArray = new ArrayClass();
                pFeature = pFeatCursor.NextFeature();
                while (pFeature != null)
                {
                    IElement pPolyElement = new PolygonElementClass();
                    IFillShapeElement pFillShapeElement = pPolyElement as IFillShapeElement;
                    pPolyElement.Geometry = pFeature.Shape;
                    pFillShapeElement.Symbol = pFillSymbol;
                    pGraphicContainer.AddElement(pPolyElement, 0);
                    pFeatArray.Add(pFeature);
                    pFeature = pFeatCursor.NextFeature();
                }
                ppAxMapControl.AddLayer(pGraphicContainer as ILayer);
                ppAxMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                //ma
                //frmUpstreamCreateOwnerList frmUpstreamCreateOwnerList1 = new frmUpstreamCreateOwnerList(ppAxMapControl,pFeatLayerParcels, pFeatArray);
                //frmUpstreamCreateOwnerList1.Show();
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.Message);

            }
        }
コード例 #42
0
        //�������ĸ߳�����
        public static void ProfileGetRelatedSewerElevData(AxMapControl ppAxMapControl, IGeometricNetwork pGeoNetwork, IEnumNetEID pResultEdges, IEnumNetEID pResultJunctions)
        {
            try
            {
                //��ñ������Զ�Ӧ������׷�ٽ��
                IArray pSewerElevArray = new ArrayClass();
                IEIDHelper pEIDHelper = new EIDHelperClass();
                pEIDHelper.GeometricNetwork = pGeoNetwork;
                pEIDHelper.ReturnFeatures = true;
                pEIDHelper.ReturnGeometries = true;
                pEIDHelper.PartialComplexEdgeGeometry = true;
                pEIDHelper.AddField("Component_Key2");
                IEnumEIDInfo pEnumEIDInfo = pEIDHelper.CreateEnumEIDInfo(pResultEdges);
                //�������߻�����ص������߼�¼
                pEnumEIDInfo.Reset();
                IEIDInfo pEIDInfo = pEnumEIDInfo.Next();
                IFeature pFeature = pEIDInfo.Feature;
                IGeometry pFeatGeo = pEIDInfo.Geometry;
                //�������л�ù�ϵ
                IEnumRelationshipClass pEnumRelationshipCls = pFeature.Class.get_RelationshipClasses(esriRelRole.esriRelRoleOrigin);
                pEnumRelationshipCls.Reset();
                IRelationshipClass pRelationshipCls = pEnumRelationshipCls.Next();
                //�����ȷ�Ĺ�ϵ��
                string s = "SewerToMainline";
                while (pRelationshipCls != null)
                {
                    if (pRelationshipCls.ForwardPathLabel.ToUpper() == s.ToUpper())
                        break;
                    else
                        pRelationshipCls = pEnumRelationshipCls.Next();
                }
                //��ѯ���ɹ�����ÿ������ص����ݣ������1-1�Ĺ�ϵ����ֻ����һ����¼
                //  because the arcs are ordered and directional, if the start node is an
                //  fnode then get subsequent tnode's for the rest of the arcs, else if the
                //  start node is a tnode, get subsequent fnode's.  Related data has elev
                //  attributes for up and down stream manhole elevs, so related to from and to node of arc.
                // get the first junction in the network trace results to determine if the
                //first junction is a from-node or a to-node for graphing sewer line elev
                if (pRelationshipCls != null)
                {
                    ISet pMainlineRelatedSet;
                    IRow pMainlineRow;
                    IEIDHelper pEIDHelper2 = new EIDHelperClass();
                    pEIDHelper2.GeometricNetwork = pGeoNetwork;
                    pEIDHelper2.ReturnFeatures = true;
                    pEIDHelper2.ReturnGeometries = true;
                    pEIDHelper2.PartialComplexEdgeGeometry = true;
                    IEnumEIDInfo pEnumEIDInfo2 = pEIDHelper2.CreateEnumEIDInfo(pResultJunctions);
                    pEnumEIDInfo2.Reset();
                    //pFeature is the first arc in the network trace results
                    // check the junctions on the first arc to see which is the starting
                    // junction, this determines which sewer elev attribute (ups_elev, dwn_elev)
                    // will be used to calculate the sewer line profile
                    IEdgeFeature pEdgeFeat = pFeature as IEdgeFeature;
                    string strStartAttr;
                    string strMHelevAttr;
                    double lastelev = 0;
                    int lastnodeEID;
                    if (pEnumEIDInfo2.Next().EID == pEdgeFeat.FromJunctionEID)
                    {
                        // trace is in the direction of flow, flow goes down hill
                        strStartAttr = "Ups_elev";
                        strMHelevAttr = "Dwn_elev";
                    }
                    else
                    {
                        //trace is in the opposite direction of flow, flow goes up hill
                        strStartAttr = "Dwn_elev";
                        strMHelevAttr = "Ups_elev";
                    }
                    lastnodeEID = pEnumEIDInfo2.Next().EID;
                    // create a polyline from the result junctions, make the polyline in the
                    //direction of the trace, not in the direction of the original arcs/edges
                    IPolyline pPolyline = new PolylineClass();
                    IPointCollection pPointColl = pPolyline as IPointCollection;
                    pEnumEIDInfo2.Reset();
                    object missing = Type.Missing;
                    for (int i = 0; i <= pEnumEIDInfo2.Count - 1; i++)
                    {
                        pPointColl.AddPoint(pEnumEIDInfo2.Next().Geometry as IPoint, ref missing, ref missing);
                    }
                    ISegmentCollection pSegColl = pPolyline as ISegmentCollection;
                    //�򻯶����
                    ITopologicalOperator pTopoOp = pPolyline as ITopologicalOperator;
                    pTopoOp.Simplify();
                    pPolyline.SimplifyNetwork();
                    pPolyline.Densify(50, 0.01);
                    pResultEdges.Reset();
                    pEnumEIDInfo2.Reset();
                    IPolyline pNewSegPolyline;
                    IPolyline pPolyLineFeat;
                    IRelationalOperator pRelOpFeat;
                    ISegmentCollection pNewSegColl;
                    ISegmentCollection pSegmentColl = pPolyline as ISegmentCollection;
                    for (int i = 0; i <= pResultEdges.Count - 1; i++)
                    {
                        pMainlineRelatedSet = pRelationshipCls.GetObjectsRelatedToObject(pFeature);
                        pMainlineRelatedSet.Reset();
                        pMainlineRow = pMainlineRelatedSet.Next() as IRow;
                        pPolyLineFeat = pFeature.Shape as IPolyline;
                        pRelOpFeat = pPolyLineFeat as IRelationalOperator;
                        for (int j = 0; j <= pSegmentColl.SegmentCount - 1; j++)
                        {
                            pNewSegPolyline = new PolylineClass();
                            pNewSegColl = pNewSegPolyline as ISegmentCollection;
                            pNewSegColl.AddSegment(pSegmentColl.get_Segment(j), ref missing, ref missing);
                            if (pRelOpFeat.Contains(pNewSegPolyline as IGeometry))
                            {
                                if (j == 0)
                                {
                                    pSewerElevArray.Add(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strStartAttr)));
                                    lastelev = Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));
                                }
                                else
                                {
                                    if (lastelev == Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr))))
                                    {
                                        pSewerElevArray.Add(-99);
                                    }
                                    else
                                    {
                                        pSewerElevArray.Add(lastelev);
                                        lastelev = Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));
                                    }
                                }
                            }
                        }
                        // get the next feature and check to see what direction it's going and
                        //adjust the variables accordingly
                        if (i < pResultEdges.Count - 1)
                        {
                            lastnodeEID = pEdgeFeat.ToJunctionEID;
                            pFeature = pEnumEIDInfo.Next().Feature;
                            pEdgeFeat = pFeature as IEdgeFeature;
                            if (pEdgeFeat.FromJunctionEID == lastnodeEID)
                                strMHelevAttr = "Dwn_elev";
                            else
                                strMHelevAttr = "Ups_elev";

                        }
                        else
                        {
                            pSewerElevArray.Add(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));

                        }
                    }
                    ProfileCreateGraph(ppAxMapControl, pPolyline, pSewerElevArray);
                }
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.Message);

            }
        }
コード例 #43
0
        /// <summary>Creates an new (unbuilt) Network Dataset</summary>
        private void CreateBuildableNDS()
        {
            IDENetworkDataset2 deNetworkDataset = new DENetworkDatasetClass();
            deNetworkDataset.Buildable = true;

            ((IDataElement)deNetworkDataset).Name = _ndsName;

            // Copy the feature dataset's extent and spatial reference to the network dataset
            IDEGeoDataset deGeoDataset = (IDEGeoDataset)deNetworkDataset;
            deGeoDataset.Extent = _extent;
            deGeoDataset.SpatialReference = _spatialReference;

            deNetworkDataset.ElevationModel = esriNetworkElevationModel.esriNEMNone;
            deNetworkDataset.SupportsTurns = true;

            // General Network Directions
            GeneralNetworkDirectionInfo dirInfo = _xml.GeneralNetworkDirections();
            if (dirInfo != null)
            {
                INetworkDirections netdir = new NetworkDirectionsClass();
                netdir.LengthAttributeName = dirInfo.LengthAttr;
                netdir.DefaultOutputLengthUnits = dirInfo.LengthUnits;
                netdir.RoadClassAttributeName = dirInfo.RoadClassAttr;
                netdir.TimeAttributeName = dirInfo.TimeAttr;

                deNetworkDataset.Directions = netdir;
            }

            IArray sources = new ArrayClass();
            foreach (INetworkSource ns in EnumerateNetworkSources())
                sources.Add(ns);

            IArray attrs = new ArrayClass();
            foreach (var na in _networkAttrs)
                attrs.Add(na);

            deNetworkDataset.Sources = sources;
            deNetworkDataset.Attributes = attrs;

            // Get the feature dataset extension and create the network dataset from the data element.
            IFeatureDatasetExtension fdExtension = ((IFeatureDatasetExtensionContainer)_osmDataset).FindExtension(esriDatasetType.esriDTNetworkDataset);
            _networkDataset = (INetworkDataset)((IDatasetContainer2)fdExtension).CreateDataset((IDEDataset)deNetworkDataset);
        }
コード例 #44
0
ファイル: Mainfrm.cs プロジェクト: chinasio/Control
        //���ҷ���
        private void BurstFindValves(IFlagDisplay pFlagDisplay)
        {
            try
            {
                INetwork pNetwork = pGeoNetwork.Network;
                IFeatureLayer pValveFeatLayer = Utility.FindFeatLayer("Water Fixtures", this);
                IFeatureLayer pWaterLineFeatLyr = Utility.FindFeatLayer("Water Lines", this);
                //�õ�EdgeFlag
                IEdgeFlag pEdgeFlag = new EdgeFlagClass();
                INetFlag pNetFlag = pEdgeFlag as INetFlag;
                pNetFlag.UserClassID = pFlagDisplay.FeatureClassID;
                pNetFlag.UserID = pFlagDisplay.FID;
                //��÷��ŵĹ��
                IQueryFilter pQueryFilter = new QueryFilterClass();
                pQueryFilter.WhereClause = "PWF_TYPE_CODE = 1";
                IFeatureSelection pValveFeatSelection = pValveFeatLayer as IFeatureSelection;
                pValveFeatSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
                //������ѡ��ķ���ΪSelectionSetBarriers
                ISelectionSetBarriers pSelSetBarriers = new SelectionSetBarriersClass();
                int FeatClassID = pValveFeatLayer.FeatureClass.FeatureClassID;
                IEnumIDs pEnumIDs = pValveFeatSelection.SelectionSet.IDs;
                pEnumIDs.Reset();
                int FeatID = pEnumIDs.Next();
                while (FeatID > 0)
                {
                    pSelSetBarriers.Add(FeatClassID, FeatID);
                    FeatID = pEnumIDs.Next();
                }
                //����TraceFlowSolver
                ITraceFlowSolver pTraceFlowSolver = new TraceFlowSolverClass() as ITraceFlowSolver;

                INetSolver pNetSolver = pTraceFlowSolver as INetSolver;
                pNetSolver.SourceNetwork = pNetwork;
                pNetSolver.SelectionSetBarriers = pSelSetBarriers;
                pTraceFlowSolver.PutEdgeOrigins(1, ref pEdgeFlag);
                //�Ӹ��ٹ����л�ý��
                IEnumNetEID pResultJenction;
                IEnumNetEID pResultsEdges;
                IEnumNetEID ptmpEnumNetEID = null;
                pTraceFlowSolver.FindFlowEndElements(esriFlowMethod.esriFMConnected, esriFlowElements.esriFEJunctions, out pResultJenction, out ptmpEnumNetEID);
                pTraceFlowSolver.FindFlowElements(esriFlowMethod.esriFMConnected, esriFlowElements.esriFEEdges, out ptmpEnumNetEID, out pResultsEdges);
                int lEID;
                int iUserClassID;
                int iUserID;
                int iUserSubID;
                INetElements pNetElements = pGeoNetwork.Network as INetElements;
                pResultJenction.Reset();
                IFeature pFeature;
                pValveFeatSelection.Clear();
                for (int j = 0; j <= pResultJenction.Count - 1; j++)
                {
                    lEID = pResultJenction.Next();
                    pNetElements.QueryIDs(lEID, esriElementType.esriETJunction, out iUserClassID, out iUserID, out iUserSubID);
                    pFeature = pValveFeatLayer.FeatureClass.GetFeature(iUserID);
                    pValveFeatSelection.Add(pFeature);
                    // MessageBox.Show(iUserClassID.ToString()+","+iUserID.ToString()+","+iUserSubID.ToString());
                }
                IFeatureSelection pLinesFeatSelection = pWaterLineFeatLyr as IFeatureSelection;
                pLinesFeatSelection.Clear();
                for (int i = 0; i <= pResultsEdges.Count - 1; i++)
                {
                    lEID = pResultsEdges.Next();
                    pNetElements.QueryIDs(lEID, esriElementType.esriETEdge, out iUserClassID, out iUserID, out iUserSubID);
                    pFeature = pWaterLineFeatLyr.FeatureClass.GetFeature(iUserID);
                    pLinesFeatSelection.Add(pFeature);
                }

                //�����µķ���������Ⱦѡȡ�Ľ��
                IMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
                IRgbColor pRGBColor = new RgbColorClass();
                pRGBColor.Red = 12;
                pRGBColor.Green = 250;
                pRGBColor.Blue = 233;
                pMarkerSymbol.Size = 14;
                pMarkerSymbol.Color = pRGBColor;
                pValveFeatSelection.SelectionSymbol = pMarkerSymbol as ISymbol;
                pValveFeatSelection.SelectionColor = pRGBColor as IColor;
                pValveFeatSelection.SelectionChanged();

                IRgbColor pRGBColor2 = new RgbColorClass();
                pRGBColor2.Red = 230;
                pRGBColor2.Green = 230;
                pRGBColor2.Blue = 0;
                pLinesFeatSelection.SelectionColor = pRGBColor2;
                pLinesFeatSelection.SelectionChanged();
                axMapControl1.ActiveView.Refresh();
                ICursor pCursor = null;
                pValveFeatSelection.SelectionSet.Search(null, false, out pCursor);
                IFeatureCursor pFeatCursor = pCursor as IFeatureCursor;
                IArray pArray = new ArrayClass();
                pFeature = pFeatCursor.NextFeature();
                while (pFeature != null)
                {
                    pArray.Add(pFeature);
                    pFeature = pFeatCursor.NextFeature();
                }
                pFeature = pWaterLineFeatLyr.FeatureClass.GetFeature(pFlagDisplay.FID);
                frmBurstReport frmBurstReport1 = new frmBurstReport(this, pValveFeatLayer, pWaterLineFeatLyr, pArray, pFeature);
                frmBurstReport1.Show();

            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.Message);

            }
        }
コード例 #45
0
        public void AddOneIntElementInObjectArray()
        {
            var newElement = 1;

            var array = new ArrayClass<int>();
            array.Add(newElement);
            var count = array.GetCount();

            Assert.AreEqual(1, count);
        }
        public bool GetFabricSubLayersByClass(esriCadastralFabricTable FabricSubClass, out IArray CFParcelFabSubLayers)
        {
            ICadastralFabricSubLayer pCFSubLyr = null;
            IArray CFParcelFabricSubLayers2 = new ArrayClass();
            IFeatureLayer pParcelFabricSubLayer = null;
            UID pId = new UIDClass();
            //pId.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";//IGeoFeatureLayer
            pId.Value = "{BA381F2B-F621-4F45-8F78-101F65B5BBE6}"; //ICadastralFabricSubLayer

            IMap pMap = AAState._editor.Map;
            IEnumLayer pEnumLayer = pMap.get_Layers(pId, true);
            pEnumLayer.Reset();
            ILayer pLayer = pEnumLayer.Next();
            while (pLayer != null)
            {
                pCFSubLyr = (ICadastralFabricSubLayer)pLayer;
                if (pCFSubLyr.CadastralTableType == FabricSubClass)
                {
                    pParcelFabricSubLayer = (IFeatureLayer)pCFSubLyr;
                    IDataset pDS = (IDataset)pParcelFabricSubLayer.FeatureClass;
                    if (pDS.Workspace.Equals(AAState._editor.EditWorkspace))
                        CFParcelFabricSubLayers2.Add(pParcelFabricSubLayer);
                }
                pLayer = pEnumLayer.Next();
            }
            CFParcelFabSubLayers = CFParcelFabricSubLayers2;
            if (CFParcelFabricSubLayers2.Count > 0)
                return true;
            else
                return false;
        }
コード例 #47
0
        ////////////////////////////////////////////////////////////////////////
        // METHOD: PopulateAOIListUsingOverlapFeatureClass
        private bool PopulateAOIListUsingOverlapFeatureClass(IJTXJob2 pParentJob, ref IArray aoiList)
        {
            try
            {
                // Make sure all the information exists to get the data workspace
                if (pParentJob.ActiveDatabase == null)
                {
                    MessageBox.Show("Unable to proceed: Please set the data workspace for this job.");
                    return false;
                }
                if (pParentJob.AOIExtent == null)
                {
                    MessageBox.Show("Unable to proceed: Please assign the AOI for this job.");
                    return false;
                }

                // Get the feature workspace from the current data workspace
                IJTXDatabase2 pJTXDB = (IJTXDatabase2)m_ipDatabase;
                string activeDBID = pParentJob.ActiveDatabase.DatabaseID;
                IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)pJTXDB.GetDataWorkspace(activeDBID, pParentJob.VersionExists() ? pParentJob.VersionName : "");
                if (featureWorkspace == null)
                {
                    MessageBox.Show("Unable to connect to Data Workspace");
                    return false;
                }

                IFeatureClass featureClass = null;
                try
                {
                    featureClass = featureWorkspace.OpenFeatureClass(m_AOIOverlapFeatureClassName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to connect to feature class to generate AOIs: " +
                        m_AOIOverlapFeatureClassName + "\n Error: " + ex.ToString());
                    return false;
                }

                // Get all features that intersect the parent job's AOI
                //
                // Note: The parent job's AOI is shrunk very slightly so features that merely adjoin the parent's AOI 
                // are *not* returned.  Only features that have some part of their actual area intersecting the parent's 
                // AOI are returned.
                ISpatialFilter spatialFilter = new SpatialFilterClass();
                ITopologicalOperator topOp = (ITopologicalOperator)pParentJob.AOIExtent;
                IPolygon slightlySmallerExtent = (IPolygon)topOp.Buffer(-0.0001);
                spatialFilter.Geometry = slightlySmallerExtent;
                spatialFilter.GeometryField = featureClass.ShapeFieldName;
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);

                aoiList = new ArrayClass();
                IFeature feature = null;
                while ((feature = featureCursor.NextFeature()) != null)
                {
                    aoiList.Add(feature.Shape);
                }

                // Explicitly release the cursor.  
                Marshal.ReleaseComObject(featureCursor);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create AOIs based on feature class: " + m_AOIOverlapFeatureClassName + ". " + ex.ToString());
            }

            return true;
        }
 public bool GetAllFabricSubLayers(out IArray CFSubLayers)
 {
     ICadastralFabricSubLayer pCFSubLyr = null;
     IArray CFParcelFabricSubLayers2 = new ArrayClass();
     IFeatureLayer pParcelFabricSubLayer = null;
     UID pId = new UIDClass();
     pId.Value = "{BA381F2B-F621-4F45-8F78-101F65B5BBE6}"; //ICadastralFabricSubLayer
     IMap pMap = AAState._editor.Map;
     IEnumLayer pEnumLayer = pMap.get_Layers(pId, true);
     pEnumLayer.Reset();
     ILayer pLayer = pEnumLayer.Next();
     while (pLayer != null)
     {
         pCFSubLyr = (ICadastralFabricSubLayer)pLayer;
         pParcelFabricSubLayer = (IFeatureLayer)pCFSubLyr;
         IDataset pDS = (IDataset)pParcelFabricSubLayer.FeatureClass;
         if (pDS.Workspace.Equals(AAState._editor.EditWorkspace))
             CFParcelFabricSubLayers2.Add(pParcelFabricSubLayer);
         pLayer = pEnumLayer.Next();
     }
     CFSubLayers = CFParcelFabricSubLayers2;
     if (CFParcelFabricSubLayers2.Count > 0)
         return true;
     else
         return false;
 }
コード例 #49
0
 void AddEmptyPlansToList(ICadastralFabric Fabric, IFIDSet EmptyPlansFIDSet, dlgEmptyPlansList EmptyPlansList)
 {
     ITable pPlansTable = Fabric.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
       CheckedListBox list = EmptyPlansList.checkedListBox1;
       IArray array = new ArrayClass();
       for (int idx = 0; idx <= (EmptyPlansFIDSet.Count() - 1); idx++)
       {
     // Add the name of the plan to the list
     Int32 i_x;
     Int32 iPlanName;
     iPlanName = pPlansTable.FindField("NAME");
     EmptyPlansFIDSet.Next(out i_x);
     array.Add(i_x);
     string sPlanName = (string)pPlansTable.GetRow(i_x).get_Value(iPlanName);
     list.Items.Add(sPlanName, true);
       }
       // Bind array of plan ids with the list
       list.Tag = (object)array;
       if(list.Items.Count>0)
     EmptyPlansList.checkedListBox1_SelectedValueChanged(null, null);
 }
コード例 #50
0
ファイル: Mainfrm.cs プロジェクト: chinasio/Control
 //���ù��̵�ͼ
 private void menuItem71_Click(object sender, EventArgs e)
 {
     IMap pMap = axMapControl1.ActiveView.FocusMap;
     pMap.DelayDrawing(true);
     CleanUpApp();
     //���õ�ͼ��Χ
     IEnvelope pEnv = new EnvelopeClass();
     pEnv.XMin = 559166;
     pEnv.YMin = 39389;
     pEnv.XMax = 560403;
     pEnv.YMax = 41333;
     axMapControl1.ActiveView.Extent = pEnv;
     //��Ӧ�õ�ͼ��
     IArray pLayerNameArray = new ArrayClass();
     pLayerNameArray.Add("Street Centerlines");
     pLayerNameArray.Add("Street Project");
     pLayerNameArray.Add("Parcels");
     pLayerNameArray.Add("Elevation");
     pLayerNameArray.Add("Roads");
     pLayerNameArray.Add("Hillshade");
     SetLayersForApp(pLayerNameArray);
     //ˢ����Ļ
     pMap.DelayDrawing(false);
     axMapControl1.ActiveView.Refresh();
     //��ʾ����
     frmUtilityImageMap frmUtilityImageMap1 = new frmUtilityImageMap();
     frmUtilityImageMap1.Show();
 }
コード例 #51
0
        /// <summary>
        /// Create an array with the right BandName and Wavelength values for the corresponding key. 
        /// </summary>
        /// <param name="key">Key to use.</param>
        /// <returns>Array with the correct BandName and Wavelength values.</returns>
        private static IArray SetBandProperties(string key)
        {
            IArray productDefProps = new ArrayClass();
            IPropertySet band1Def = new PropertySetClass();
            IPropertySet band2Def = new PropertySetClass();
            IPropertySet band3Def = new PropertySetClass();
            if (key == "NATURAL_COLOR_RGB" || key == "NATURAL_COLOR_RGBI")
            {
                band1Def.SetProperty("BandName", "Red");
                band1Def.SetProperty("WavelengthMin", 630);
                band1Def.SetProperty("WavelengthMax", 690);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 530);
                band2Def.SetProperty("WavelengthMax", 570);

                band3Def.SetProperty("BandName", "Blue");
                band3Def.SetProperty("WavelengthMin", 440);
                band3Def.SetProperty("WavelengthMax", 480);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);

                if (key == "NATURAL_COLOR_RGBI")
                {
                    IPropertySet band4Def = new PropertySetClass();
                    band4Def.SetProperty("BandName", "NearInfrared");
                    band4Def.SetProperty("WavelengthMin", 770);
                    band4Def.SetProperty("WavelengthMax", 830);
                    productDefProps.Add(band4Def);
                }
            }
            else if (key == "FALSE_COLOR_IRG")
            {
                band1Def.SetProperty("BandName", "Infrared");
                band1Def.SetProperty("WavelengthMin", 770);
                band1Def.SetProperty("WavelengthMax", 830);

                band2Def.SetProperty("BandName", "Red");
                band2Def.SetProperty("WavelengthMin", 630);
                band2Def.SetProperty("WavelengthMax", 690);

                band3Def.SetProperty("BandName", "Green");
                band3Def.SetProperty("WavelengthMin", 530);
                band3Def.SetProperty("WavelengthMax", 570);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
            }
            else if (key == "FORMOSAT-2_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 450);
                band1Def.SetProperty("WavelengthMax", 520);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 520);
                band2Def.SetProperty("WavelengthMax", 600);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 630);
                band3Def.SetProperty("WavelengthMax", 690);

                band4Def.SetProperty("BandName", "NearInfrared");
                band4Def.SetProperty("WavelengthMin", 760);
                band4Def.SetProperty("WavelengthMax", 900);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "GEOEYE-1_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 450);
                band1Def.SetProperty("WavelengthMax", 510);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 510);
                band2Def.SetProperty("WavelengthMax", 580);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 655);
                band3Def.SetProperty("WavelengthMax", 690);

                band4Def.SetProperty("BandName", "NearInfrared");
                band4Def.SetProperty("WavelengthMin", 780);
                band4Def.SetProperty("WavelengthMax", 920);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "IKONOS_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 445);
                band1Def.SetProperty("WavelengthMax", 516);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 506);
                band2Def.SetProperty("WavelengthMax", 595);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 632);
                band3Def.SetProperty("WavelengthMax", 698);

                band4Def.SetProperty("BandName", "NearInfrared");
                band4Def.SetProperty("WavelengthMin", 757);
                band4Def.SetProperty("WavelengthMax", 863);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "KOMPSAT-2_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 450);
                band1Def.SetProperty("WavelengthMax", 520);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 520);
                band2Def.SetProperty("WavelengthMax", 600);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 630);
                band3Def.SetProperty("WavelengthMax", 690);

                band4Def.SetProperty("BandName", "NearInfrared");
                band4Def.SetProperty("WavelengthMin", 760);
                band4Def.SetProperty("WavelengthMax", 900);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "LANDSAT_6BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();
                IPropertySet band5Def = new PropertySetClass();
                IPropertySet band6Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 450);
                band1Def.SetProperty("WavelengthMax", 520);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 520);
                band2Def.SetProperty("WavelengthMax", 600);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 630);
                band3Def.SetProperty("WavelengthMax", 690);

                band4Def.SetProperty("BandName", "NearInfrared_1");
                band4Def.SetProperty("WavelengthMin", 760);
                band4Def.SetProperty("WavelengthMax", 900);

                band5Def.SetProperty("BandName", "NearInfrared_2");
                band5Def.SetProperty("WavelengthMin", 1550);
                band5Def.SetProperty("WavelengthMax", 1750);

                band6Def.SetProperty("BandName", "MidInfrared");
                band6Def.SetProperty("WavelengthMin", 2080);
                band6Def.SetProperty("WavelengthMax", 2350);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
                productDefProps.Add(band5Def);
                productDefProps.Add(band6Def);
            }
            else if (key == "QUICKBIRD_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 450);
                band1Def.SetProperty("WavelengthMax", 520);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 520);
                band2Def.SetProperty("WavelengthMax", 600);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 630);
                band3Def.SetProperty("WavelengthMax", 690);

                band4Def.SetProperty("BandName", "NearInfrared");
                band4Def.SetProperty("WavelengthMin", 760);
                band4Def.SetProperty("WavelengthMax", 900);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "RAPIDEYE_5BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();
                IPropertySet band5Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Blue");
                band1Def.SetProperty("WavelengthMin", 440);
                band1Def.SetProperty("WavelengthMax", 510);

                band2Def.SetProperty("BandName", "Green");
                band2Def.SetProperty("WavelengthMin", 520);
                band2Def.SetProperty("WavelengthMax", 590);

                band3Def.SetProperty("BandName", "Red");
                band3Def.SetProperty("WavelengthMin", 630);
                band3Def.SetProperty("WavelengthMax", 685);

                band4Def.SetProperty("BandName", "RedEdge");
                band4Def.SetProperty("WavelengthMin", 690);
                band4Def.SetProperty("WavelengthMax", 730);

                band5Def.SetProperty("BandName", "NearInfrared");
                band5Def.SetProperty("WavelengthMin", 760);
                band5Def.SetProperty("WavelengthMax", 850);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
                productDefProps.Add(band5Def);
            }
            else if (key == "SPOT-5_4BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "Green");
                band1Def.SetProperty("WavelengthMin", 500);
                band1Def.SetProperty("WavelengthMax", 590);

                band2Def.SetProperty("BandName", "Red");
                band2Def.SetProperty("WavelengthMin", 610);
                band2Def.SetProperty("WavelengthMax", 680);

                band3Def.SetProperty("BandName", "NearInfrared");
                band3Def.SetProperty("WavelengthMin", 780);
                band3Def.SetProperty("WavelengthMax", 890);

                band4Def.SetProperty("BandName", "ShortWaveInfrared");
                band4Def.SetProperty("WavelengthMin", 1580);
                band4Def.SetProperty("WavelengthMax", 1750);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
            }
            else if (key == "WORLDVIEW-2_8BANDS")
            {
                IPropertySet band4Def = new PropertySetClass();
                IPropertySet band5Def = new PropertySetClass();
                IPropertySet band6Def = new PropertySetClass();
                IPropertySet band7Def = new PropertySetClass();
                IPropertySet band8Def = new PropertySetClass();

                band1Def.SetProperty("BandName", "CoastalBlue");
                band1Def.SetProperty("WavelengthMin", 400);
                band1Def.SetProperty("WavelengthMax", 450);

                band2Def.SetProperty("BandName", "Blue");
                band2Def.SetProperty("WavelengthMin", 450);
                band2Def.SetProperty("WavelengthMax", 510);

                band3Def.SetProperty("BandName", "Green");
                band3Def.SetProperty("WavelengthMin", 510);
                band3Def.SetProperty("WavelengthMax", 580);

                band4Def.SetProperty("BandName", "Yellow");
                band4Def.SetProperty("WavelengthMin", 585);
                band4Def.SetProperty("WavelengthMax", 625);

                band5Def.SetProperty("BandName", "Red");
                band5Def.SetProperty("WavelengthMin", 630);
                band5Def.SetProperty("WavelengthMax", 690);

                band6Def.SetProperty("BandName", "RedEdge");
                band6Def.SetProperty("WavelengthMin", 705);
                band6Def.SetProperty("WavelengthMax", 745);

                band7Def.SetProperty("BandName", "NearInfrared_1");
                band7Def.SetProperty("WavelengthMin", 770);
                band7Def.SetProperty("WavelengthMax", 895);

                band8Def.SetProperty("BandName", "NearInfrared_2");
                band8Def.SetProperty("WavelengthMin", 860);
                band8Def.SetProperty("WavelengthMax", 1040);

                productDefProps.Add(band1Def);
                productDefProps.Add(band2Def);
                productDefProps.Add(band3Def);
                productDefProps.Add(band4Def);
                productDefProps.Add(band5Def);
                productDefProps.Add(band6Def);
                productDefProps.Add(band7Def);
                productDefProps.Add(band8Def);
            }
            return productDefProps;
        }
コード例 #52
0
        /// <summary>Creates new network attribute parameters</summary>
        private static void AddNetworkParameters(NetworkAttributeInfo nai, IEvaluatedNetworkAttribute netAttr)
        {
            // Create parameters
            if ((nai.Parameters != null) && (nai.Parameters.Count > 0))
            {
                IArray naParams = new ArrayClass();

                foreach (ParameterInfo paramInfo in nai.Parameters)
                {
                    INetworkAttributeParameter nap = new NetworkAttributeParameterClass();
                    nap.Name = paramInfo.Name;

                    if (paramInfo.DefaultValue is double)
                        nap.VarType = (int)VarEnum.VT_R8;
                    else if (paramInfo.DefaultValue is bool)
                        nap.VarType = (int)VarEnum.VT_BOOL;
                    else if (paramInfo.DefaultValue is string)
                        nap.VarType = (int)VarEnum.VT_BSTR;

                    nap.DefaultValue = paramInfo.DefaultValue;

                    naParams.Add(nap);
                }

                ((INetworkAttribute3)netAttr).Parameters = naParams;
            }
        }
コード例 #53
0
    /// <summary>
    /// Identifying all the weather items falling within the given envelope
    /// </summary>
    /// <param name="pGeom"></param>
    /// <returns></returns>
    public IArray Identify(IGeometry pGeom)
    {
      IEnvelope intersectEnv = new EnvelopeClass();
      IEnvelope inEnv;
      IArray array = new ArrayClass();

      //get the envelope from the geometry 
      if(pGeom.GeometryType == esriGeometryType.esriGeometryEnvelope)
        inEnv = pGeom.Envelope;
      else
        inEnv = pGeom as IEnvelope;

      //reproject the envelope to the source coordsys
      //this would allow to search directly on the Lat/Lon columns
			if (null != m_spatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode && null != inEnv.SpatialReference)
        inEnv.Project(base.m_spatialRef);

      //expand the envelope so that it'll cover the symbol
      inEnv.Expand(4,4,true);

      double xmin, ymin, xmax, ymax;
      inEnv.QueryCoords(out xmin, out ymin, out xmax, out ymax);  
      
      //select all the records within the given extent
      string qry = "LON >= " + xmin.ToString() + " AND LON <= " + xmax.ToString() + " AND Lat >= " + ymin.ToString() + " AND LAT <= " + ymax.ToString();
      DataRow[] rows = m_table.Select(qry);
      if(0 == rows.Length)
        return array;
      
      long zipCode;
      IPropertySet			propSet		= null;
      IIdentifyObj			idObj			= null;
      IIdentifyObject		idObject	= null;
      bool	            bIdentify	= false;

      foreach(DataRow r in rows)
      {
        //get the zipCode
        zipCode = Convert.ToInt64(r["ZIPCODE"]); 
 
        //get the properties of the given item in order to pass it to the identify object
        propSet = this.GetWeatherItem(zipCode);
        if(null != propSet)
        {
          //instantiate the identify object and add it to the array
          idObj = new RSSWeatherIdentifyObject();
          //test whether the layer can be identified
          bIdentify = idObj.CanIdentify((ILayer)this);
          if(bIdentify)
          {
            idObject = idObj as IIdentifyObject;
            idObject.PropertySet = propSet;
            array.Add(idObj);
          }
        }
      }

      //return the array with the identify objects
      return array;
    }
コード例 #54
0
        public bool GetFabricSubLayersFromFabric(IMap Map, ICadastralFabric Fabric, out IFeatureLayer CFPointLayer, out IFeatureLayer CFLineLayer,
          out IArray CFParcelLayers, out IFeatureLayer CFControlLayer, out IFeatureLayer CFLinePointLayer)
        {
            ICadastralFabricLayer pCFLayer = null;
              ICadastralFabricSubLayer pCFSubLyr = null;
              ICompositeLayer pCompLyr = null;
              IArray CFParcelLayers2 = new ArrayClass();

              IDataset pDS = (IDataset)Fabric;
              IName pDSName = pDS.FullName;
              string FabricNameString = pDSName.NameString;

              long layerCount = Map.LayerCount;
              CFPointLayer = null; CFLineLayer = null; CFControlLayer = null; CFLinePointLayer = null;
              IFeatureLayer pParcelLayer = null;
              for (int idx = 0; idx <= (layerCount - 1); idx++)
              {
            ILayer pLayer = Map.get_Layer(idx);
            bool bIsComposite = false;
            if (pLayer is ICompositeLayer)
            {
              pCompLyr = (ICompositeLayer)pLayer;
              bIsComposite = true;
            }

            int iCompositeLyrCnt = 1;
            if (bIsComposite)
              iCompositeLyrCnt = pCompLyr.Count;

            for (int i = 0; i <= (iCompositeLyrCnt - 1); i++)
            {
              if (bIsComposite)
            pLayer = pCompLyr.get_Layer(i);
              if (pLayer is ICadastralFabricLayer)
              {
            pCFLayer = (ICadastralFabricLayer)pLayer;
            break;
              }
              if (pLayer is ICadastralFabricSubLayer)
              {
            pCFSubLyr = (ICadastralFabricSubLayer)pLayer;
            IDataset pDS2 = (IDataset)pCFSubLyr.CadastralFabric;
            IName pDSName2 = pDS2.FullName;
            if (pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTParcels)
            {
              pParcelLayer = (IFeatureLayer)pCFSubLyr;
              CFParcelLayers2.Add(pParcelLayer);
            }
            if (CFLineLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTLines)
              CFLineLayer = (IFeatureLayer)pCFSubLyr;
            if (CFPointLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTPoints)
              CFPointLayer = (IFeatureLayer)pCFSubLyr;
            if (CFLinePointLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTLinePoints)
              CFLinePointLayer = (IFeatureLayer)pCFSubLyr;
            if (CFControlLayer == null && pDSName.NameString.ToLower() == pDSName2.NameString.ToLower() &&
            pCFSubLyr.CadastralTableType == esriCadastralFabricTable.esriCFTControl)
              CFControlLayer = (IFeatureLayer)pCFSubLyr;
              }
            }

            //Check that the fabric layer belongs to the requested fabric
            if (pCFLayer != null)
            {
              if (pCFLayer.CadastralFabric.Equals(Fabric))
              {
            CFPointLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRPoints);
            CFLineLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRLines);
            pParcelLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRParcels);
            CFParcelLayers2.Add(pParcelLayer);
            Debug.WriteLine(pParcelLayer.Name);
            CFControlLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRControlPoints);
            CFLinePointLayer = (IFeatureLayer)pCFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRLinePoints);
              }

              if (CFLinePointLayer != null)
            CFParcelLayers2.Add(CFLinePointLayer);

              if (CFControlLayer != null)
            CFParcelLayers2.Add(CFControlLayer);

              if (CFLineLayer != null)
            CFParcelLayers2.Add(CFLineLayer);

              if (CFPointLayer != null)
            CFParcelLayers2.Add(CFPointLayer);

              CFParcelLayers = CFParcelLayers2;
              return true;
            }
              }
              //at the minimum, just need to make sure we have a parcel sublayer for the requested fabric
              if (pParcelLayer != null)
              {
            if (CFLinePointLayer != null)
              CFParcelLayers2.Add(CFLinePointLayer);

            if (CFControlLayer != null)
              CFParcelLayers2.Add(CFControlLayer);

            if (CFLineLayer != null)
              CFParcelLayers2.Add(CFLineLayer);

            if (CFPointLayer != null)
              CFParcelLayers2.Add(CFPointLayer);

            CFParcelLayers = CFParcelLayers2;
            return true;
              }
              else
              {
            CFParcelLayers = null;
            return false;
              }
        }
コード例 #55
0
        ////////////////////////////////////////////////////////////////////////
        // METHOD: PopulateAOIListUsingParent
        private bool PopulateAOIListUsingParent(IJTXJob2 pParentJob, ref IArray aoiList, int numCopies)
        {
            try
            {
                aoiList = new ArrayClass();
                for (int i = 0; i < numCopies; i++)
                {
                    aoiList.Add(pParentJob.AOIExtent);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create AOIs based on parent job's AOI: " + ex.Message);
            }

            return true;
        }
コード例 #56
0
        /// <summary>Adds edge feature classes to the network dataset</summary>
        /// <remarks>
        /// - For each 'edge' element in the config file, adds a new EdgeFeatureSource to the NDS
        /// - A new feature class is extracted from *_OSM_LN using a filter specified in the config file
        /// </remarks>
        private void ExtractEdgeFeatureClasses()
        {
            IList<SourceFeatureClassInfo> edges = _xml.EdgeFeatureClasses().ToList();
            if ((edges == null) || (edges.Count == 0))
                return;

            ConvertRequiredTagsToAttributes(true);

            // Create the new feature class using the query filter from the config XML
            foreach (SourceFeatureClassInfo edge in edges)
            {
                string edgeClassName = GetFullClassName(edge.Name);
                SelectFeaturesToNewFeatureClass(_osmLinePath, _dsPath + "\\" + edgeClassName, edge.Query);

                INetworkSource edgeNetworkSource = new EdgeFeatureSourceClass();
                edgeNetworkSource.Name = edgeClassName;
                edgeNetworkSource.ElementType = esriNetworkElementType.esriNETEdge;

                IEdgeFeatureSource edgeFeatureSource = (IEdgeFeatureSource)edgeNetworkSource;
                edgeFeatureSource.UsesSubtypes = false;
                edgeFeatureSource.ClassConnectivityPolicy = (esriNetworkEdgeConnectivityPolicy)edge.ConnectPolicy;

                if (edge.StreetNameFields != null)
                {
                    // Create a StreetNameFields object and populate its settings for the Streets source.
                    IStreetNameFields streetNameFields = new StreetNameFieldsClass();
                    streetNameFields.Priority = 1;
                    streetNameFields.StreetNameFieldName = edge.StreetNameFields.StreetName;
                    streetNameFields.PrefixDirectionFieldName = edge.StreetNameFields.DirectionPrefix;
                    streetNameFields.SuffixDirectionFieldName = edge.StreetNameFields.DirectionSuffix;
                    streetNameFields.PrefixTypeFieldName = edge.StreetNameFields.TypePrefix;
                    streetNameFields.SuffixTypeFieldName = edge.StreetNameFields.TypeSuffix;

                    INetworkSourceDirections sourceDirections = new NetworkSourceDirectionsClass();
                    IArray streetNameFieldsArray = new ArrayClass();
                    streetNameFieldsArray.Add(streetNameFields);
                    sourceDirections.StreetNameFields = streetNameFieldsArray;
                    ((INetworkSource)edgeFeatureSource).NetworkSourceDirections = sourceDirections;
                }

                _edgeSources.Add(edgeFeatureSource);
            }
        }
コード例 #57
0
        /// <summary>
        /// This method is called when a query is made to the locator. 
        /// This must be implemented in such a way that Single and Multi line searches can be preformaed
        /// </summary>
        /// <param name="address">Review code for the structure of this property set</param>
        /// <returns>A single-line array containing a property set. Review code for the structure of this property set</returns>
        public override IArray FindAddressCandidates(IPropertySet address)
        {
            _log.Debug("BNGLocator  IAddressCandidates FindAddressCandidates");
            IArray addressCandidates = new ArrayClass();

            // Get the input from the IPropertySet
            object names = null;
            object values = null;

            address.GetAllProperties(out names, out values);

            string[] nameArray = (string[])names;
            object[] valueArray = (object[])values;

            _log.Debug("Input address columns:" + string.Concat( nameArray));

            //make sure there is at least one value
            if (nameArray.Length > 0)
            {
                string addressValue;

                if(nameArray.Length == 1)
                    addressValue = valueArray[0].ToString();
                else
                    addressValue = valueArray[0].ToString() + "," + valueArray[1].ToString();

                _log.Debug("Lookup Value:" + addressValue);

                Envelope enve = DoMatchLookup(addressValue);
                // Get centre point of Envelope for geocode location
                // ONLY Point geometries can be returned successfully
                Point point = CentrePoint(enve);

                if (point != null)
                {
                    // Ensure spatial reference is set on this envelope returned by the search function
                    (point as IGeometry).SpatialReference = base.m_spatialReference;

                    // Build the required output array
                    IPropertySet match = new PropertySetClass();
                    names = new string[] { "Shape", "Status", "Score", "X", "Y", "XMin", "YMin", "XMax", "YMax", "Match_addr", "Addr_type" };
                    values = new object[] { point, "M", 100, point.X, point.Y, enve.XMin, enve.YMin, enve.XMax, enve.YMax, addressValue.ToUpper(), "BNG" };

                    match.SetProperties(names, values);
                    addressCandidates.Add(match);
                }
            }

            return addressCandidates;
        }
コード例 #58
0
        /// <summary>Creates a temporary network dataset to use during turn feature creation</summary>
        private INetworkDataset CreateTempNDS()
        {
            const string TEMP_NDS_NAME = "TEMP_TURN_NDS";

            IDENetworkDataset2 deNDS = new DENetworkDatasetClass();
            deNDS.Buildable = true;

            ((IDataElement)deNDS).Name = TEMP_NDS_NAME;

            // Copy the feature dataset's extent and spatial reference to the network dataset
            IDEGeoDataset deGeoDataset = (IDEGeoDataset)deNDS;
            deGeoDataset.Extent = _extent;
            deGeoDataset.SpatialReference = _spatialReference;

            deNDS.ElevationModel = esriNetworkElevationModel.esriNEMNone;
            deNDS.SupportsTurns = true;

            IArray sources = new ArrayClass();
            foreach (INetworkSource ns in EnumerateNetworkSources())
                sources.Add(ns);

            deNDS.Sources = sources;

            // Get the feature dataset extension and create the network dataset from the data element.
            IFeatureDatasetExtension fdExtension = ((IFeatureDatasetExtensionContainer)_osmDataset).FindExtension(esriDatasetType.esriDTNetworkDataset);
            INetworkDataset nds = (INetworkDataset)((IDatasetContainer2)fdExtension).CreateDataset((IDEDataset)deNDS);
            if (nds == null)
                throw new ArgumentNullException("NetworkDataset");

            return nds;
        }
コード例 #59
0
		private void PlayAnimationFast(int cycles, int iteration)
		{
			IGlobe globe = axGlobeControl1.Globe;
			IGlobeDisplay globeDisplay = globe.GlobeDisplay;
			Scene scene = (Scene) globeDisplay.Scene;
			IAnimationTracks sceneTracks = (IAnimationTracks) scene;

			IArray trackCamArray = new ArrayClass();
			IArray trackGlbArray = new ArrayClass();
			IArray trackLyrArray = new ArrayClass();

			string sError;
			if (sceneTracks.TrackCount == 0)
			{
				sError = m_AnimFilePath;
				if (sError == "")
				{
					sError = "To get a Sample animation file, Developer Kit Samples need to be installed!";
					System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A  + sError);
				}
				else
				{
					System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A  + "Load " + m_AnimFilePath + @"\AnimationSample.aga for sample.");
				}
				return;
			}
			
			IAnimationTrack track;
			IAnimationTrack trackLayer;
			IAnimationTrack trackGlobe = null;
			IAnimationType animType;
			IAnimationType animLayer;
			IAnimationType animGlobeCam = null;
			IKeyframe kFGlbCam;
			IKeyframe kFGlbLayer;
			int k;
			int[] count = new int[1000];

			//get each track from the scene and store tracks of the same kind in an Array
			for (int i=0; i<=sceneTracks.TrackCount-1;i++)
			{
				track = (IAnimationTrack) sceneTracks.Tracks.get_Element(i);
				k = i;
				animType = track.AnimationType;

				if (animType.CLSID.Value.ToString() == "{7CCBA704-3933-4D7A-8E89-4DFEE88AA937}")
				{
					//GlobeLayer
					trackLayer = new AnimationTrackClass();
					trackLayer = track;
					trackLayer.AnimationType = animType;
					kFGlbLayer = new GlobeLayerKeyframeClass();
					animLayer = animType;
					//Store the keyframe count of each track in an array
					count[i] = trackLayer.KeyframeCount;
					trackLyrArray.Add(trackLayer);
				}
				else if (animType.CLSID.Value.ToString() == "{D4565495-E2F9-4D89-A8A7-D0B69FD7A424}")
				{
					//Globe Camera type
					trackGlobe = new AnimationTrackClass();
					trackGlobe = track;
					trackGlobe.AnimationType = animType;
					kFGlbCam = new GlobeCameraKeyframeClass();
					animGlobeCam = animType;
					//Store the keyframe count of each track in an array
					count[i] = trackGlobe.KeyframeCount;
					trackGlbArray.Add(trackGlobe);
				}
				else
				{
					System.Windows.Forms.MessageBox.Show("Animation Type " + animType.Name + " Not Supported. Check if the animation File is Valid!");
					return;
				}
			}

			int larger = Greatest(ref count);
			//if nothing gets passed by the argument it takes the max no of keyframes
			if (iteration == 0) iteration = larger;

			IAnimationTrack trackCamera;
			IAnimationType animCam = null;
			IKeyframe kFBkmark;
			double time = 0;
			int keyFrameLayerCount; int keyFrameCameraCount; int keyFrameCount;

			for (int i=1; i<=cycles; i++) //no of cycles...
			{
				for (int start=0; start<=iteration; start++) //no of iterations...
				{
					for (int j=0; j<=trackCamArray.Count-1; j++)
					{
						trackCamera = (IAnimationTrack) trackCamArray.get_Element(j);
						if (trackCamera != null)
						{
							if (time >= trackCamera.BeginTime)
							{
								keyFrameCameraCount = trackGlobe.KeyframeCount;
								kFBkmark = trackCamera.get_Keyframe(keyFrameCameraCount - keyFrameCameraCount);
								//reset object
								animCam.ResetObject(scene, kFBkmark);
								//interpolate by using track
								trackCamera.InterpolateObjectProperties(scene, time);
								keyFrameCameraCount = keyFrameCameraCount - 1;
							}
						}
					}

					for (k=0; k<=trackGlbArray.Count-1;k++)
					{
						trackGlobe = (IAnimationTrack) trackGlbArray.get_Element(k);
						if (trackGlobe != null)
						{
							if (time >= trackGlobe.BeginTime)
							{
								keyFrameCount = trackGlobe.KeyframeCount;
								kFGlbCam = trackGlobe.get_Keyframe(trackGlobe.KeyframeCount - keyFrameCount);
								//reset object
								animGlobeCam.ResetObject(scene, kFGlbCam);
								//interpolate by using track
								trackGlobe.InterpolateObjectProperties(scene, time);
								keyFrameCount = keyFrameCount - 1;
							}
						}
					}

					for (int t=0; t<=trackLyrArray.Count-1; t++)
					{
						trackLayer = (IAnimationTrack) trackLyrArray.get_Element(t);
						if (trackLayer != null)
						{
							if (time >= trackLayer.BeginTime)
							{
								keyFrameLayerCount = trackLayer.KeyframeCount;
								kFGlbLayer = trackLayer.get_Keyframe(trackLayer.KeyframeCount - keyFrameLayerCount);
								//interpolate by using track
								trackLayer.InterpolateObjectProperties(scene, time);
								keyFrameLayerCount = keyFrameLayerCount - 1;
							}
						}
					}

					//reset interpolation Point
					time = start / iteration;
					//refresh the globeviewer(s)
					globeDisplay.RefreshViewers();
				}
			}
		}
コード例 #60
0
        public void AddStringElementInObjectArray()
        {
            var data = new string[] { "ana", "are", "mere", null, null, null, null, null };
            var newElement = "pere";

            var array = new ArrayClass<string>(data, 3);
            array.Add(newElement);
            var count = array.GetCount();

            Assert.AreEqual(4, count);
        }