当前位置: 首页>>代码示例>>C#>>正文


C# PolylineClass.SegmentsChanged方法代码示例

本文整理汇总了C#中PolylineClass.SegmentsChanged方法的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass.SegmentsChanged方法的具体用法?C# PolylineClass.SegmentsChanged怎么用?C# PolylineClass.SegmentsChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PolylineClass的用法示例。


在下文中一共展示了PolylineClass.SegmentsChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMouseDown

        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // �Ҽ�����
            if (Button == 2) return;
            if (m_pDongshiFeatureLayer == null)
                return;
            m_pPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            m_pPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_pPoint);

            double angle = -1;
            string layerName = LayerNames.LAYER_ALIAS_MR_TUNNEL_FD;      //���
            pFeatLayer = drawSpecialCom.GetFeatureLayerByName(layerName);

            IFeature pFeature = null;
            TestExistPointFeature(m_hookHelper, m_pPoint, pFeatLayer, ref pFeature);
            if (pFeature == null)
            {
                MessageBox.Show(@"�������û�����������ѡ��һ���������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //IPoint hightPoint= Snapping(m_pPoint, pFeatLayer, pFeature);
            //if (hightPoint.IsEmpty)
            //{
            //    MessageBox.Show("��ȡ����߽�ʧ�ܣ�������ѡ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            IProximityOperator proximityOperator = (IProximityOperator)pFeature.Shape;
            IPoint mousePoint = proximityOperator.ReturnNearestPoint(m_pPoint, esriSegmentExtension.esriNoExtension);

            IProximityOperator proximityOperator2 = (IProximityOperator)mousePoint;
            ISegmentCollection segmentCollection = (ISegmentCollection)pFeature.Shape;
            for (int i = 0; i < segmentCollection.SegmentCount; i++)
            {

                ISegmentCollection geometryCollection = new PolylineClass();
                ISegment segment = segmentCollection.get_Segment(i);
                geometryCollection.AddSegment(segment);
                geometryCollection.SegmentsChanged();
                var distance = proximityOperator2.ReturnDistance((IGeometry)geometryCollection);

                if (distance < 0.0001)
                {
                    angle = ((ILine)segment).Angle;
                    break;
                }
            }
            if (angle == -1)
            {
                MessageBox.Show(@"��ȡ����߽�ʧ�ܣ�������ѡ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //�õ���Ӧ������
            string hdid = pFeature.get_Value(pFeature.Fields.FindField(GIS_Const.FIELD_HDID)).ToString();
            string bid = pFeature.get_Value(pFeature.Fields.FindField(GIS_Const.FIELD_BID)).ToString();

            FormCaveSizeInput frmCaveSize = new FormCaveSizeInput();
            frmCaveSize.ShowDialog();
            if (frmCaveSize.DialogResult == DialogResult.OK)
            {
                //������ȷ��������ҵij��Ϳ�
                double Width = frmCaveSize.CaveWidth;
                double Height = frmCaveSize.CaveHeight;

                PointClass p0 = RectanglePoint(mousePoint, angle, Width);
                PointClass p1 = RectanglePoint(mousePoint, angle + Math.PI, Width);
                PointClass p2 = RectanglePoint2(p0, angle + 90 * Math.PI / 180, Height);
                PointClass p3 = RectanglePoint2(p1, angle + 90 * Math.PI / 180, Height);
                //��������
                CreateDongShi(p0, p2, p3, p1, hdid, bid);
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:71,代码来源:AddDongshi.cs


注:本文中的PolylineClass.SegmentsChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。