• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IPolyline类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPolyline的典型用法代码示例。如果您正苦于以下问题:C# IPolyline类的具体用法?C# IPolyline怎么用?C# IPolyline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPolyline类属于命名空间,在下文中一共展示了IPolyline类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateLineFeature

        public static bool CreateLineFeature(IFeatureLayer featureLayer, IPolyline pStopLine, LibEntity.StopLine stopLineEntity)
        {
            if (pStopLine == null || pStopLine.IsEmpty)
            {
                return false;
            }

            try
            {
                IFeatureClass featureClass = featureLayer.FeatureClass;
                if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    IDataset dataset = (IDataset)featureClass;
                    IWorkspace workspace = dataset.Workspace;
                    IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
                    workspaceEdit.StartEditing(false);
                    workspaceEdit.StartEditOperation();
                    IFeature feature = featureClass.CreateFeature();

                    Common.DataEditCommon.ZMValue(feature, pStopLine);  //几何图形Z值处理

                    feature.Shape = pStopLine;

                    //编号
                    int iFieldID = feature.Fields.FindField("BID");
                    if (iFieldID > -1)
                        feature.Value[iFieldID] = stopLineEntity.binding_id;

                    //名称
                    iFieldID = feature.Fields.FindField("NAME");
                    if (iFieldID > -1)
                        feature.Value[iFieldID] = stopLineEntity.stop_line_name;

                    feature.Store();
                    workspaceEdit.StopEditOperation();
                    workspaceEdit.StopEditing(true);
                    //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = pStopLine.Envelope;
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(1.5, 1.5, true);
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, feature);
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);

                    return true;
                }

                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("创建停采线要素出错:" + ex.Message);
                return false;
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:53,代码来源:DrawStopLine.cs


示例2: QueryIntersectPoints

        public static Dictionary<int, List<IPoint>> QueryIntersectPoints(IPolyline line, IFeatureClass roadFC)
        {
            var cursor = roadFC.Search(new SpatialFilterClass { Geometry = line, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects }, true);
            var topo = line as ITopologicalOperator;
            var rel = line as IRelationalOperator;
            var f = cursor.NextFeature();
            var dict = new Dictionary<int, List<IPoint>>();
            while(f!= null)
            {
                var shp = f.ShapeCopy;
                line.SpatialReference = shp.SpatialReference;
                var pc2 = shp as IPointCollection;
                var ret = topo.Intersect(shp, esriGeometryDimension.esriGeometry1Dimension);

                if (ret != null && ret.IsEmpty == false)
                {
                    dict.Add(f.OID, null);
                }
                else
                {
                    ret = topo.Intersect(shp, esriGeometryDimension.esriGeometry0Dimension);
                    if(ret is IPoint)
                    {
                        var pt = ret as IPoint;
                        if (IsStartOrEnd(pt, pc2) == false)
                        {
                            dict.Add(f.OID, new List<IPoint>(new[] { pt }));
                        }
                    }
                    else if(ret is IPointCollection)
                    {
                        var pc = ret as IPointCollection;
                        var list = new List<IPoint>();
                        for (var i = 0; i < pc.PointCount; i++)
                        {
                            if (IsStartOrEnd(pc.Point[i], pc2) == false)
                            {
                                list.Add(pc.Point[i]);
                            }
                        }
                        dict.Add(f.OID, list);
                    }
                    else
                    {
                        throw new NotSupportedException(string.Format("道路相交结果的类型‘{0}’不被支持", ret.GetType()));
                    }
                }
                f = cursor.NextFeature();
            }

            Marshal.ReleaseComObject(cursor);
            return dict;
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:53,代码来源:RoadHelper.cs


示例3: CreateLineFeature

        /// <summary>
        /// 在掘进进尺图层创建掘进进尺线要素
        /// </summary>
        /// <params name="featureLayer">掘进进尺图层</params>
        /// <params name="pJjPolyline">掘进进尺线</params>
        /// <params name="tunnelID">对应的巷道ID</params>
        /// <returns>成功返回true</returns>
        public static bool CreateLineFeature(IFeatureLayer featureLayer, IPolyline pJjPolyline, string bindingID,  double distance)
        {
            if (pJjPolyline == null || pJjPolyline.IsEmpty)
            {
                return false;
            }

            try
            {
                IFeatureClass featureClass = featureLayer.FeatureClass;

                if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    IDataset dataset = (IDataset)featureClass;
                    IWorkspace workspace = dataset.Workspace;
                    IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
                    workspaceEdit.StartEditOperation();
                    IFeature feature = featureClass.CreateFeature();

                    Common.DataEditCommon.ZMValue(feature, pJjPolyline);  //几何图形Z值处理

                    feature.Shape = pJjPolyline;

                    //绑定编号
                    int iFieldID = feature.Fields.FindField("ID");
                    if (iFieldID > -1)
                        feature.Value[iFieldID] = bindingID;

                    //掘进距离
                    iFieldID = feature.Fields.FindField("Distance");
                    if (iFieldID > -1)
                        feature.Value[iFieldID] = distance;

                    feature.Store();
                    workspaceEdit.StopEditOperation();

                    //缩放到新增的线要素,并高亮该要素
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = pJjPolyline.Envelope;
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(1.5, 1.5, false);
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, feature);
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                    return true;
                }

                return false;
            }
            catch(Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("创建掘进进尺线要素出错:" + ex.Message);
                return false;
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:59,代码来源:DrawJJLine.cs


示例4: PointsAlongLineForm

        public PointsAlongLineForm(IEditor3 editor)
        {
            InitializeComponent();

              m_editor = editor;
              m_edSketch = m_editor as IEditSketch3;

              m_polyline = m_edSketch.Geometry as IPolyline;
              tbLineLength.Text = (m_polyline.Length.ToString("F"));

              //get the template
              m_editTemplate = m_editor.CurrentTemplate;
              m_featureLayer = m_editTemplate.Layer as IFeatureLayer;
              m_featureClass = m_featureLayer.FeatureClass;
        }
开发者ID:jrinks,项目名称:local-government-desktop-addins,代码行数:15,代码来源:PointsAlongLineForm.cs


示例5: BufferAnalyseNew

        public List<GeoStruct> BufferAnalyseNew(IPolyline pGeom, double dist, IFeatureLayer fealyr, IGeometry Reg = null)
        {
            List<GeoStruct> geoList = new List<GeoStruct>();

            ITopologicalOperator top = pGeom as ITopologicalOperator;
            IGeometry geom = top.Buffer(dist);
            IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr);
            if (searchCursor != null)
            {
                IFeature fea = searchCursor.NextFeature();

                while (fea != null)
                {
                    GeoStruct geoTmp = new GeoStruct();

                    var fieldDict = new Dictionary<string, string>();
                    for (var i = 0; i < fea.Fields.FieldCount; i++)
                    {
                        var field = fea.Fields.Field[i];
                        if (field.Type != esriFieldType.esriFieldTypeGeometry)
                        {
                            fieldDict.Add(field.Name, fea.Value[i].ToString());
                        }
                        else
                        {
                            geoTmp.geo = fea.Shape;
                        }
                    }
                    geoTmp.geoinfos = fieldDict;
                    IRelationalOperator relation = Reg as IRelationalOperator;
                    bool bin = (relation.Overlaps(fea.Shape) || relation.Touches(fea.Shape) || relation.Contains(fea.Shape));
                    double distance = CalculateDistanceNew(pGeom, geoTmp.geo);
                    if (bin)
                        distance = 0.0;
                    if (distance < Global.searchlen)
                    {
                        geoTmp.dist = distance;
                        geoList.Add(geoTmp);
                    }
                    //geoTmp.dist = distance;
                    //geoList.Add(geoTmp);

                    fea = searchCursor.NextFeature();
                }

            }
            return geoList;
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:48,代码来源:CommonClass.cs


示例6: CastPolyline

 netDxf.Entities.Polyline CastPolyline(IPolyline item)
 {
     netDxf.Entities.Polyline polyline = null;
     if (item is LightWeightPolyline)
     {
         polyline = ((LightWeightPolyline)item).ToPolyline();
     }
     else if (item is Polyline)
     {
         polyline = (netDxf.Entities.Polyline)item;
     }
     else
     {
         polyline = null;
     }
     return polyline;
 }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:17,代码来源:DXFDrawingDeserializer.cs


示例7: GetAngle

        private double GetAngle(IPolyline pPolyline)
        {
            //IPolycurve pPolycurve;  
            ILine pTangentLine = new ESRI.ArcGIS.Geometry.Line();
            pPolyline.QueryTangent(esriSegmentExtension.esriNoExtension, 0.5, true, pPolyline.Length, pTangentLine);
            Double radian = pTangentLine.Angle;
            //Double angle = radian * 180 / Math.PI;  
            //// 如果要设置正角度执行以下方法  
            //while (angle < 0)  
            //{  
            //    angle = angle + 360;  
            //}  
            //// 返回角度  
            //return angle;  

            // 返回弧度  
            return radian;
        }
开发者ID:Leooonard,项目名称:CGXM,代码行数:18,代码来源:roadStripedRow.cs


示例8: GetNodesBetweenPoints

        /// <summary>
        /// Returns nodes on the path between two points
        /// </summary>
        /// <param name="from">The start point</param>
        /// <param name="to">The end point</param>
        /// <param name="path"></param>
        /// <returns></returns>
        public static IEnumerable<IPointGeo> GetNodesBetweenPoints(IPointGeo from, IPointGeo to, IPolyline<IPointGeo> path)
        {
            var segments = path.Segments;

            List<IPointGeo> result = new List<IPointGeo>();

            int fromIndex = -1;
            int toIndex = -1;
            for (int i = 0; i < segments.Count; i++) {
                if (Calculations.GetDistance2D(from, segments[i]) < Calculations.EpsLength) {
                    if (fromIndex > -1 && toIndex > -1 && toIndex <= fromIndex)
                        ;
                    else
                        fromIndex = i;
                }
                if (Calculations.GetDistance2D(to, segments[i]) < Calculations.EpsLength) {
                    if (fromIndex > -1 && toIndex > -1 && toIndex >= fromIndex)
                        ;
                    else
                        toIndex = i;
                }
            }
            if (fromIndex == -1 || toIndex == -1)
                return result;

            if (fromIndex == toIndex - 1) {
                result.Add(segments[fromIndex].EndPoint);
            }
            else if (fromIndex - 1 == toIndex) {
                result.Add(segments[toIndex].EndPoint);
            }
            else if (fromIndex < toIndex) {
                for (int i = fromIndex; i < toIndex; i++) {
                    result.Add(segments[i].EndPoint);
                }
            }
            else if (toIndex < fromIndex) {
                for (int i = fromIndex; i > toIndex; i--) {
                    result.Add(segments[i].StartPoint);
                }
            }

            return result;
        }
开发者ID:guifa,项目名称:traveltimeanalysis,代码行数:51,代码来源:Topology.cs


示例9: getData

        public void getData(IPolyline profileLineGeom)
        {
            try
            {
                polyLineLam72 = (IPolyline)geopuntHelper.Transform((IGeometry)profileLineGeom, lam72);

                int samplesCount = (int)samplesNum.Value;
                datacontract.geojsonLine gjs = geopuntHelper.esri2geojsonLine(polyLineLam72);
                profileData = dhm.getDataAlongLine(gjs, samplesCount, dataHandler.CRS.Lambert72);

                ArcMap.Application.CurrentTool = oldCmd;

                this.WindowState = FormWindowState.Normal;
                this.Focus();

                maxH = profileData.Select(c => c[3]).Max();
                minH = profileData.Where(c => c[3] > -999).Select(c => c[3]).Min();
                maxD = profileData.Select(c => c[0]).Max();
                profileGrp.GraphPane.YAxis.Scale.Max = maxH;
                profileGrp.GraphPane.YAxis.Scale.Min = minH;
                profileGrp.GraphPane.XAxis.Scale.Max = maxD;

                addLineGrapic();
                createGraph();
            }
            catch (WebException wex)
            {
                if (wex.Status == WebExceptionStatus.Timeout)
                    MessageBox.Show("De connectie werd afgebroken." +
                        " Het duurde te lang voor de server een resultaat terug gaf.\n" +
                        "U kunt via de instellingen de 'timout'-tijd optrekken.", wex.Message);
                else if (wex.Response != null)
                {
                    string resp = new StreamReader(wex.Response.GetResponseStream()).ReadToEnd();
                    MessageBox.Show(resp, wex.Message);
                }
                else
                    MessageBox.Show(wex.Message, "Error");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message +" "+ ex.StackTrace, "Error");
            }
        }
开发者ID:geopunt,项目名称:geopunt4arcgis,代码行数:44,代码来源:elevationForm.cs


示例10: FlatBuffer

 private IPolygon FlatBuffer(IPolyline pLline1, double pBufferDis)
 {
     object o = System.Type.Missing;
      //分别对输入的线平移两次(正方向和负方向)
      IConstructCurve pCurve1 = new PolylineClass();
      pCurve1.ConstructOffset(pLline1, pBufferDis, ref o, ref o);
      IPointCollection pCol = pCurve1 as IPointCollection;
      IConstructCurve pCurve2 = new PolylineClass();
      pCurve2.ConstructOffset(pLline1, -1 * pBufferDis, ref o, ref o);
      //把第二次平移的线的所有节点翻转
      IPolyline pline2 = pCurve2 as IPolyline;
      pline2.ReverseOrientation();
      //把第二条的所有节点放到第一条线的IPointCollection里面
      IPointCollection pCol2 = pline2 as IPointCollection;
      pCol.AddPointCollection(pCol2);
      //用面去初始化一个IPointCollection
      IPointCollection pPointCol = new PolygonClass();
      pPointCol.AddPointCollection(pCol);
      //把IPointCollection转换为面
      IPolygon pPolygon = pPointCol as IPolygon;
      //简化节点次序
      pPolygon.SimplifyPreserveFromTo();
      return pPolygon;
 }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:24,代码来源:GeometryTest.cs


示例11: CreatePoints

        public static bool CreatePoints(IApplication app, List<ConstructLineWithPointsDetails> linesWithPointsDetails, IPolyline line, IFeatureLayer SourceLayer, bool bUseTemplate, out List<IFeature> pLstFeat)
        {
            pLstFeat = null;

            IFeatureLayer pStartPointLayer = null;
            IFeatureLayer pAlongPointLayer = null;
            IFeatureLayer pEndPointLayer = null;
            IEditor editor = null;
            ICurve pCur = null;// as ICurve;
            //List<string> strTemplateNames = null;
            IEditTemplate pEditTempStart = null;
            IEditTemplate pEditTempAlong = null;
            IEditTemplate pEditTempEnd = null;
            IFeature pPntFeat = null;
            IEnumVertex pEnumVx = null;
            IPoint ppnt = null;
            try
            {
                editor = Globals.getEditor(app);
                if (linesWithPointsDetails == null) return false;
                if (linesWithPointsDetails.Count == 0) return false;
                //   MessageBox.Show(Control.ModifierKeys.ToString());
                pLstFeat = new List<IFeature>();
                foreach (ConstructLineWithPointsDetails pDet in linesWithPointsDetails)
                {
                    if (pDet.Line_LayerName != SourceLayer.Name)
                        continue;
                    bool FCorLayerStart = true;
                    bool FCorLayerAlong = true;
                    bool FCorLayerEnd = true;

                    pStartPointLayer = Globals.FindLayer(app, pDet.Point_Start_LayerName, ref FCorLayerStart) as IFeatureLayer;
                    pAlongPointLayer = Globals.FindLayer(app, pDet.Point_Along_LayerName, ref FCorLayerAlong) as IFeatureLayer;
                    pEndPointLayer = Globals.FindLayer(app, pDet.Point_End_LayerName, ref FCorLayerEnd) as IFeatureLayer;
                    if (pStartPointLayer == null)
                        continue;
                    else if (pStartPointLayer.FeatureClass == null)
                        continue;
                    //if (pAlongPointLayer == null)
                    //    continue;
                    //else if (pAlongPointLayer.FeatureClass == null)
                    //    continue;
                    if (pEndPointLayer == null)
                        continue;
                    else if (pEndPointLayer.FeatureClass == null)
                        continue;
                    //if (pDet.lineLayerName == SourceLayer.Name)

                    if (!Globals.IsEditable(ref pStartPointLayer, ref editor))
                        return false;
                    if (pAlongPointLayer != null)
                    {
                        if (!Globals.IsEditable(ref pAlongPointLayer, ref editor))
                            return false;
                    }
                    if (!Globals.IsEditable(ref pEndPointLayer, ref editor))
                        return false;
                    //IFeatureLayer pPointLay = Globals.FindLayer(app, pDet.pointLayerName) as IFeatureLayer;

                    pCur = line;// as ICurve;

                    if (bUseTemplate)
                    {
                        //pEditTempStart = Globals.PromptAndGetEditTemplate(app, pStartPointLayer, pDet.Point_Start_EditTemplate, "Template for Start Layer: " + pStartPointLayer.Name);
                        //pEditTempAlong = Globals.PromptAndGetEditTemplate(app, pAlongPointLayer, pDet.Point_Along_EditTemplate, "Template for Point Along Layer: " + pAlongPointLayer.Name);

                        //pEditTempEnd = Globals.PromptAndGetEditTemplate(app, pEndPointLayer, pDet.Point_End_EditTemplate, "Template for End Layer: " + pEndPointLayer.Name);

                        pEditTempStart = Globals.PromptAndGetEditTemplateGraphic(pStartPointLayer, pDet.Point_Start_EditTemplate);
                        if (pAlongPointLayer != null)
                        {
                            pEditTempAlong = Globals.PromptAndGetEditTemplateGraphic(pAlongPointLayer, pDet.Point_Along_EditTemplate);

                        }
                        pEditTempEnd = Globals.PromptAndGetEditTemplateGraphic(pEndPointLayer, pDet.Point_End_EditTemplate);

                    }
                    else
                    {
                        //pEditTempStart = Globals.PromptAndGetEditTemplate(app, pStartPointLayer, "", "Template for Start Layer: " + pStartPointLayer.Name);
                        //pEditTempAlong = Globals.PromptAndGetEditTemplate(app, pAlongPointLayer, "", "Template for Point Along Layer: " + pAlongPointLayer.Name);

                        //pEditTempEnd = Globals.PromptAndGetEditTemplate(app, pEndPointLayer, "", "Template for End Layer: " + pEndPointLayer.Name);

                        pEditTempStart = Globals.PromptAndGetEditTemplateGraphic(pStartPointLayer, "");
                        if (pAlongPointLayer != null)
                        {
                            pEditTempAlong = Globals.PromptAndGetEditTemplateGraphic(pAlongPointLayer, "");
                        }
                        pEditTempEnd = Globals.PromptAndGetEditTemplateGraphic(pEndPointLayer, "");

                    }

                    if (pDet.PointAtVertices.ToUpper() == "TRUE")
                    {
                        ESRI.ArcGIS.Geometry.IPointCollection4 pPointColl;
                        pPointColl = (IPointCollection4)line;
                        pEnumVx = pPointColl.EnumVertices;
                        pEnumVx.Reset();

//.........这里部分代码省略.........
开发者ID:tuyndv,项目名称:local-government-desktop-addins,代码行数:101,代码来源:ConstructionTools.cs


示例12: GetTurnEndpoint

        /// <summary>Gets the end point of a turn edge</summary>
        /// <remarks>
        /// - The Via node of a turn is assumed to be at the From or To point of the edge
        /// </remarks>
        private static IPoint GetTurnEndpoint(IPolyline line, IPoint ptVia, out bool edgeEndAtToPoint, out double position)
        {
            IPoint point = null;

            edgeEndAtToPoint = false;
            position = 0.0;

            if ((ptVia.X == line.FromPoint.X) && (ptVia.Y == line.FromPoint.Y))
            {
                point = ((IPointCollection)line).get_Point(1);
                ISegment segment = ((ISegmentCollection)line).get_Segment(0);
                position = segment.Length / line.Length;
            }
            else
            {
                edgeEndAtToPoint = true;

                IPointCollection pc = (IPointCollection)line;
                point = pc.get_Point(pc.PointCount - 2);

                ISegmentCollection sc = line as ISegmentCollection;
                ISegment segment = sc.get_Segment(sc.SegmentCount - 1);

                position = (line.Length - segment.Length) / line.Length;
            }

            return point;
        }
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:32,代码来源:NetworkTurns.cs


示例13: isIntersect

        public bool isIntersect(IPolyline line)
        {
            //需要做四次相交, 分别是和四个边线.
            //左边边线.
            IPolyline boundLine = new PolylineClass();
            IPointCollection ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperLeftPt);
            ptCol.AddPoint(lowerLeftPt);
            ITopologicalOperator tpOp = boundLine as ITopologicalOperator;
            IGeometry geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //右边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperRightPt);
            ptCol.AddPoint(lowerRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //上边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperLeftPt);
            ptCol.AddPoint(upperRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //下边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(lowerLeftPt);
            ptCol.AddPoint(lowerRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            return false;
        }
开发者ID:Leooonard,项目名称:CGXM,代码行数:53,代码来源:HouseManager.cs


示例14: MakeHatchesEndsOnly

        public static void MakeHatchesEndsOnly(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor, double dHatchLen, double dTxtInterval, double dHatchOffset)
        {
            //���������
            ITopologicalOperator pTopo = pPL as ITopologicalOperator;
            pTopo.Simplify();
            //���ǽ��ڶμ����д洢HATCH
            ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
            ISegmentCollection pSCMinor = pMinor as ISegmentCollection;

            //Break the polyline into parts here ... Ideally, there should be one part
            //per route. In cases where there is mSEETARD than one part, and there is no physical
            // separation in the parts, the results can look like they are wrong (i.e. there
            //appears to be text where there should not be).
            IGeometryCollection pGC = pPL as IGeometryCollection;
            int cnt = pGC.GeometryCount - 1;
            object missing = Type.Missing;
            object distances;
            double dist;
            for (int i = 0; i <= pGC.GeometryCount - 1; i++)
            {
                IPath pPath = pGC.get_Geometry(i) as IPath;
                IGeometryCollection pSubPL = new PolylineClass();
                pSubPL.AddGeometry(pPath, ref missing, ref missing);
                IMAware pMAware = pSubPL as IMAware;
                pMAware.MAware = true;
                IMSegmentation pPLM = pSubPL as IMSegmentation;
                double Mmin = pPLM.MMin;
                double Mmax = pPLM.MMax;
                ISegment pSeg = MakeOneHatch(pSubPL as IPolyline, Mmin, Mmin, 1, dTxtInterval, dHatchLen, dHatchOffset);
                if (pSeg.Length >= ((Math.Abs(dHatchLen) * 0.5) + 0.001))
                    pSCMajor.AddSegment(pSeg, ref  missing, ref missing);
                else
                    pSCMinor.AddSegment(pSeg, ref missing, ref missing);
                distances = pPLM.GetDistancesAtM(false, Mmax);
                IArray pArray = (IArray)distances;
                for (int j = 0; j <= pArray.Count - 1; j++)
                {
                    dist = (double)pArray.get_Element(j);
                    pSeg = MakeOneHatch(pSubPL as IPolyline, dist, Mmax, 1, dTxtInterval, dHatchLen, dHatchOffset);
                    if (pSeg.Length >= (Math.Abs(dHatchLen) * 0.5) + 0.001)
                    {
                        pSCMajor.AddSegment(pSeg, ref missing, ref missing);
                    }
                    else
                    {
                        pSCMinor.AddSegment(pSeg, ref missing, ref missing);
                    }
                }
            }
            pMajor.SimplifyNetwork();
            pMinor.SimplifyNetwork();
        }
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:52,代码来源:UtilityFunction.cs


示例15: MakeHatchs

        public static void MakeHatchs(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor)
        {
            ITopologicalOperator pTopo = pPL as ITopologicalOperator;
            pTopo.Simplify();
            ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
            ISegmentCollection pSCMinor = pMinor as ISegmentCollection;

            IGeometryCollection pGC = pPL as IGeometryCollection;
            IPath pPath;
            IGeometryCollection pSubPL;
            IMSegmentation pPLM;
            object missing = Type.Missing;
            IMAware pMAware;
            double Mmin;
            double Mmax;
            int cnt = pGC.GeometryCount - 1;
            for (int i = 0; i <= cnt - 1; i++)
            {
                pPath = pGC.get_Geometry(i) as IPath;
                pSubPL = new PolylineClass();
                pSubPL.AddGeometry(pPath as IGeometry, ref missing, ref missing);
                pMAware = pSubPL as IMAware;
                pMAware.MAware = true;
                pPLM = pSubPL as IMSegmentation;
                Mmin = pPLM.MMin;
                Mmax = pPLM.MMax;

            }
        }
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:29,代码来源:UtilityFunction.cs


示例16: drawPolyline

 public static void drawPolyline(IActiveView pActiveView, IPolyline pGeom)
 {
     try
     {
         IGraphicsContainer iGC = pActiveView as IGraphicsContainer;
         ILineSymbol ipLineSymbol = new CartographicLineSymbolClass();
         ipLineSymbol.Width = 5;
         IRgbColor pRgbColor = new RgbColorClass();
         pRgbColor.Red = 255;
         pRgbColor.Green = 0;
         pRgbColor.Blue = 0;
         ipLineSymbol.Color = pRgbColor as IColor;
         IElement pEle;
         ILineElement pLE;
         if (pGeom != null)
         {
             pEle = new LineElementClass() as IElement;
             pLE = pEle as ILineElement;
             pLE.Symbol = ipLineSymbol;
             pEle.Geometry = pGeom;
             iGC.AddElement(pEle, 0);
         }
         pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, pActiveView.Extent);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:29,代码来源:UtilityFunction.cs


示例17: DeleteTargetPoints

        private static void DeleteTargetPoints(IFeatureClass targetFC, IPolyline line, double tolerenceForDelete)
        {
            ITopologicalOperator topoOpLine = null;
            IPolygon poly2 = null;
            ISpatialFilter sFilter2 = null;
            IFeatureCursor fCursor2 = null;
            IFeature feature2 = null;
            try
            {
                if (targetFC != null && line != null)
                {
                    //Buffer the line
                    topoOpLine = line as ITopologicalOperator;
                    poly2 = topoOpLine.Buffer(tolerenceForDelete) as IPolygon;
                    sFilter2 = new SpatialFilterClass();
                    sFilter2.Geometry = poly2;
                    sFilter2.GeometryField = targetFC.ShapeFieldName;
                    sFilter2.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                    fCursor2 = targetFC.Search(sFilter2, false);

                    while ((feature2 = fCursor2.NextFeature()) != null)
                    {
                        feature2.Delete();
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "DeleteTargetPoints: " + ex.Message);

            }
            finally
            {
                if (fCursor2 != null)
                    Marshal.ReleaseComObject(fCursor2);
                topoOpLine = null;
                poly2 = null;
                sFilter2 = null;
                fCursor2 = null;
                feature2 = null;
            }
        }
开发者ID:tuyndv,项目名称:local-government-desktop-addins,代码行数:43,代码来源:ConstructionTools.cs


示例18: ScalePolyline

        public void ScalePolyline(IPolyline Raai, double scale)
        {
            ITransform2D TransForm2D = Raai as ITransform2D;

            // Get the center point of the envelope.
            IEnvelope envelope = Raai.Envelope;
            IPoint centerPoint = new PointClass();
            centerPoint.X = ((envelope.XMax - envelope.XMin) / 2) + envelope.XMin;
            centerPoint.Y = ((envelope.YMax - envelope.YMin) / 2) + envelope.YMin;

            TransForm2D.Scale(centerPoint, scale, scale);
        }
开发者ID:Isolf,项目名称:CalibreerMShape,代码行数:12,代码来源:ArcObjectsHelper.cs


示例19: InsertPointAtIntersection

        public void InsertPointAtIntersection(ref IPolyline pPolyline, IGeometry pOther, double hmgetal)
        {
            bool SplitHappened = false;
            int newPartIndex = 0;
            int newSegmentIndex = 0;
            int index = 0;
            List<int> indices;
            IPoint Point = null;

            IClone pClone = pPolyline.SpatialReference as IClone;
            if (pClone.IsEqual(pOther.SpatialReference as IClone) == false)
            {
                pOther.Project(pPolyline.SpatialReference);
            }

            ITopologicalOperator pTopoOp = pOther as ITopologicalOperator;
            pTopoOp.Simplify();

            pTopoOp = pPolyline as ITopologicalOperator;
            IGeometry pGeomResult = pTopoOp.Intersect(pOther, esriGeometryDimension.esriGeometry0Dimension);

            indices = new List<int>();
            if ((pGeomResult is IPointCollection) && ((pGeomResult as IPointCollection).PointCount > 0))
            {

                for (int i = 0; i < (pGeomResult as IPointCollection).PointCount; i++)
                {
                    (pPolyline as IPolycurve2).SplitAtPoint((pGeomResult as IPointCollection).get_Point(i), true, false, out SplitHappened, out newPartIndex, out newSegmentIndex);
                    //TODO Zet de measure op het ingevoegde punt, houdt rekening met partindex en segmentindex

                    for (int j = 0; j < newPartIndex; j++)
                    {
                        index += ((pPolyline as IGeometryCollection).get_Geometry(j) as IPointCollection).PointCount;
                    }
                    index += newSegmentIndex;

                    Point = (pPolyline as IPointCollection).get_Point(index);
                    Point.M = hmgetal;
                    (pPolyline as IPointCollection).UpdatePoint(index, Point);

                }

            }

            (pPolyline as ITopologicalOperator2).IsKnownSimple_2 = false;
            (pPolyline as IPolyline4).SimplifyEx(true);
        }
开发者ID:Isolf,项目名称:CalibreerMShape,代码行数:47,代码来源:ArcObjectsHelper.cs


示例20: NewGeologicLine

        public string NewGeologicLine(string Type, double LocationConfidenceMeters, string ExistenceConfidence, string IdentityConfidence,
            string Symbol, string Label, string Notes, string DataSourceID, string RuleID, IPolyline Shape)
        {
            GeologicLine newGeologicLine = new GeologicLine();

            sysInfo SysInfoTable = new sysInfo(m_theWorkspace);
            newGeologicLine.GeologicLines_ID = SysInfoTable.ProjAbbr + ".GeologicLines." + SysInfoTable.GetNextIdValue("GeologicLines");
            newGeologicLine.Type = Type;
            newGeologicLine.LocationConfidenceMeters = LocationConfidenceMeters;
            newGeologicLine.ExistenceConfidence = ExistenceConfidence;
            newGeologicLine.IdentityConfidence = IdentityConfidence;
            newGeologicLine.Symbol = Symbol;
            newGeologicLine.Label = Label;
            newGeologicLine.Notes = Notes;
            newGeologicLine.DataSourceID = DataSourceID;
            newGeologicLine.RuleID = RuleID;
            newGeologicLine.Shape = Shape;
            newGeologicLine.RequiresUpdate = false;

            m_GeologicLinesDictionary.Add(newGeologicLine.GeologicLines_ID, newGeologicLine);
            return newGeologicLine.GeologicLines_ID;
        }
开发者ID:chinasio,项目名称:azgs-toolbar,代码行数:22,代码来源:GeologicLinesAccess.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPosition类代码示例发布时间:2022-05-24
下一篇:
C# IPolygon类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap