예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            GeoBaseLib gb     = new GeoBaseLib(m_axMapControl);
            string     sLayer = comboBox1.SelectedItem.ToString();

            m_pLayer = gb.GetLayer(sLayer);
        }
예제 #2
0
        public void AddItems(IFeatureLayer m_pFeatureLayer)
        {
            Items.Clear();
            if (m_pFeatureLayer == null || m_pFeatureLayer.FeatureClass == null)
            {
                return;
            }
            IFeatureClass pFeatureClass = m_pFeatureLayer.FeatureClass;

            ILayerFields pLayerFields = m_pFeatureLayer as ILayerFields;

            for (int k = 0; k < pLayerFields.FieldCount; k++)
            {
                IField pField = pLayerFields.get_Field(k);
                if (GeoBaseLib.IsSysField(pField.Name))
                {
                    continue;
                }
                Items.Add(pField.Name);
            }
            if (Items.Count > 0)
            {
                SelectedIndex = 0;
            }
        }
예제 #3
0
        private void btn_SearchBySpace_Click(object sender, EventArgs e)
        {
            FrmSelectLayer pLayerFrm = new FrmSelectLayer();

            pLayerFrm.m_axMapControl = axMapControl1;
            if (pLayerFrm.ShowDialog() == DialogResult.OK)
            {
                IArray aFeatures = GeoBaseLib.GetSelectedFeatures(axMapControl1);
                if (aFeatures.Count == 0)
                {
                    MessageBox.Show("没有选中目标!");
                    return;
                }
                IFeature pSelFeature = aFeatures.get_Element(0) as IFeature;
                try
                {
                    IArray pFeatures = GeoBaseLib.SelectFeatureByGeometry((IFeatureLayer)pLayerFrm.m_pLayer, pSelFeature.ShapeCopy);
                    for (int i = 0; i < pFeatures.Count; i++)
                    {
                        IFeature  pFeature = pFeatures.get_Element(i) as IFeature;
                        IRgbColor pColor   = new RgbColorClass();
                        pColor.RGB = 255;
                        GeoBaseLib.DrawElement(axMapControl1, pFeature.ShapeCopy, pColor);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
예제 #4
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);
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            GeoBaseLib gb     = new GeoBaseLib(m_axMapControl);
            string     sLayer = comboBox1.SelectedItem.ToString();

            m_pLayer  = gb.GetLayer(sLayer);
            m_dRadius = Convert.ToDouble(tb_Buffer.Text);
        }
예제 #6
0
        private void btn_UnSelect_Click(object sender, EventArgs e)
        {
            ESRI.ArcGIS.SystemUI.ICommand pCommand = new ControlsClearSelectionCommandClass();
            pCommand.OnCreate(axMapControl1.Object);
            pCommand.OnClick();

            GeoBaseLib.ClearDrawItems(this.axMapControl1.ActiveView);
            axMapControl1.Refresh();
        }
예제 #7
0
        public void AddItems(IFeatureLayer m_pFeatureLayer, seismicGCBaseRelativeYearFieldFormat format = seismicGCBaseRelativeYearFieldFormat.seismicGCBRYFTypeYRS)
        {
            m_nFieldFormat = format;
            Items.Clear();
            if (m_pFeatureLayer == null || m_pFeatureLayer.FeatureClass == null)
            {
                return;
            }
            IFeatureClass pFeatureClass = m_pFeatureLayer.FeatureClass;

            ILayerFields pLayerFields = m_pFeatureLayer as ILayerFields;

            for (int k = 0; k < pLayerFields.FieldCount; k++)
            {
                IField pField = pLayerFields.get_Field(k);
                if (GeoBaseLib.IsSysField(pField.Name))
                {
                    continue;
                }
                if (m_nFieldFormat == seismicGCBaseRelativeYearFieldFormat.seismicGCBRYFTypeYRS)
                {
                    if (pField.Name.Contains("YRS"))
                    {
                        Items.Add(pField.Name);
                    }
                }
                else if (m_nFieldFormat == seismicGCBaseRelativeYearFieldFormat.seismicGCBRYFTypeNone)
                {
                    Items.Add(pField.Name);
                }
            }
            if (Items.Count > 0)
            {
                SelectedIndex = 0;
            }
        }