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


C# PolylineClass.ConstructOffset方法代码示例

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


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

示例1: 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

示例2: UpdateHdFull

        /// <summary>
        /// 更新巷道全图层
        /// </summary>
        /// <params name="HdId">巷道ID</params>
        /// <params name="Bid">BID</params>
        /// <params name="jjcd">掘进尺度</params>
        /// <params name="plin">中心线</params>
        /// <params name="hdwid">巷道宽度</params>
        private void UpdateHdFull(string HdId, string Bid, double jjcd, IPolyline plin, double hdwid)
        {
            try
            {
                IFeatureClass feaclss = Global.hdfdfulllyr.FeatureClass;
                IWorkspaceEdit wks = (feaclss as IDataset).Workspace as IWorkspaceEdit;
                wks.StartEditing(false);
                wks.StartEditOperation();
                //查找所有的序号大于当前对象序号的巷道分段图层记录,进行平移
                string sql = "\"" + GIS_Const.FIELD_HDID + "\"='" + HdId + "' AND \"" + GIS_Const.FIELD_BS + "\"=0 AND " + GIS_Const.FIELD_BID + "='" + Bid + "'";
                IQueryFilter queryfilter = new QueryFilterClass();
                queryfilter.WhereClause = sql;
                //更新中心线分段信息
                IFeatureCursor hdfull_cursors = feaclss.Update(queryfilter, true);
                IFeature currenthdfull = hdfull_cursors.NextFeature();
                if (currenthdfull == null)
                {
                    MessageBox.Show("没有找到对应的巷道全空间信息,请检查数据库和地图!", "系统提示");
                    return;
                }
                else
                {
                    IPointCollection pnts = currenthdfull.Shape as IPointCollection;
                    IPolyline lin = plin;
                    IPoint start_p = lin.FromPoint;
                    IPoint end_p = lin.ToPoint;
                    IPoint ptstart = pnts.get_Point(0);
                    IPoint ptend = pnts.get_Point(1);
                    IPoint ptstart1 = pnts.get_Point(3);
                    IPoint ptend1 = pnts.get_Point(2);
                    double len_delta = jjcd - lin.Length;
                    double angle_lean = Math.Atan((end_p.Y - start_p.Y) / (end_p.X - start_p.X));
                    double offset_x = len_delta * Math.Cos(angle_lean);//X增量
                    double offset_y = len_delta * Math.Sin(angle_lean);//Y增量
                    //修改当前的巷道分段对象
                    IConstructCurve constructCurve = new PolylineClass();
                    constructCurve.ConstructOffset(plin, -hdwid / 2);//左侧的线
                    IPolyline plyleft = constructCurve as IPolyline;

                    IConstructCurve constructCurveright = new PolylineClass();
                    constructCurveright.ConstructOffset(plin, hdwid / 2);//左侧的线
                    IPolyline plyright = constructCurveright as IPolyline;

                    List<IPoint> hdfdjj_leftcols = new List<IPoint>();
                    hdfdjj_leftcols.Add(plyleft.FromPoint);
                    hdfdjj_leftcols.Add(plyleft.ToPoint);

                    List<IPoint> hdfdjj_rightcols = new List<IPoint>();
                    hdfdjj_rightcols.Add(plyright.FromPoint);
                    hdfdjj_rightcols.Add(plyright.ToPoint);
                    ////修改当前的巷道分段对象
                    //IPoint pnt_left = new PointClass();
                    //IPolyline plinleft = new PolylineClass();//左侧线求点
                    //plinleft.SpatialReference = Global.spatialref;
                    //if (plin.FromPoint.X - plin.ToPoint.X > 0)
                    //{
                    //    plinleft.FromPoint = pnts.get_Point(0);
                    //    plinleft.ToPoint = pnts.get_Point(1);
                    //    plinleft.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd, false, pnt_left);
                    //}
                    //else
                    //{
                    //    plinleft.FromPoint = pnts.get_Point(1);
                    //    plinleft.ToPoint = pnts.get_Point(0);
                    //    plinleft.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd, false, pnt_left);
                    //}
                    //IPoint pnt_right = new PointClass();
                    //IPolyline plinright = new PolylineClass();//右侧线求点
                    //plinright.SpatialReference = Global.spatialref;
                    //if (plin.FromPoint.X - plin.ToPoint.X > 0)
                    //{
                    //    plinright.FromPoint = pnts.get_Point(3);
                    //    plinright.ToPoint = pnts.get_Point(2);
                    //    plinright.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd, false, pnt_right);
                    //}
                    //else
                    //{
                    //    plinright.FromPoint = pnts.get_Point(2);
                    //    plinright.ToPoint = pnts.get_Point(3);
                    //    plinright.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd, false, pnt_right);
                    //}
                    List<IPoint> respnts = new List<IPoint>();
                    respnts.Add(hdfdjj_leftcols[0]);
                    respnts.Add(hdfdjj_leftcols[1]);
                    respnts.Add(hdfdjj_rightcols[1]);
                    respnts.Add(hdfdjj_rightcols[0]);
                    //List<IPoint> respnts = new List<IPoint>();
                    //if (plin.FromPoint.X - plin.ToPoint.X > 0)
                    //{
                    //    respnts.Add(pnts.get_Point(0));
                    //    respnts.Add(pnt_left);
                    //    respnts.Add(pnt_right);
//.........这里部分代码省略.........
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:101,代码来源:ConstructParallel.cs

示例3: ConstructOffset

 /// <summary>
 /// 平行线
 /// </summary>
 /// <params name="inPolyline"></params>
 /// <params name="offset"></params>
 /// <returns></returns>
 private IPolyline ConstructOffset(IPolyline inPolyline, double offset)
 {
     if (inPolyline == null || inPolyline.IsEmpty)
     {
         return null;
     }
     object Missing = Type.Missing;
     IConstructCurve constructCurve = new PolylineClass();
     constructCurve.ConstructOffset(inPolyline, offset, ref Missing, ref Missing);
     return constructCurve as IPolyline;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:17,代码来源:ConstructParallel.cs

示例4: DrawJJCD

        /// <summary>
        /// 绘制巷道掘进
        /// </summary>
        /// <params name="HdId">巷道ID</params>
        /// <params name="xzpnts">校正点</params>
        /// <params name="jjcd">掘进长度</params>
        /// <params name="jjfx">掘进方向</params>
        /// <params name="search">查询地质资料的范围</params>
        /// <params name="checkval">上下层关系判断阈值</params>
        /// <params name="jjbs">掘进与校正标识</params>
        public Dictionary<string, List<GeoStruct>> DrawJJCD(string HdId, string bid, double hdwid, List<IPoint> xzpnts, double jjcd = 0, int jjfx = 0, double search = 0, double checkval = 0, int jjbs = 0)
        {
            Dictionary<string, List<GeoStruct>> dzxlist = null;

            List<IPoint> rightpts = null;
            List<IPoint> leftpts = null;
            List<IPoint> rightresults = null;
            List<IPoint> leftresults = null;
            List<IPoint> results = null;
            Dictionary<string, string> fldvals = new Dictionary<string, string>();
            fldvals.Add(GIS_Const.FIELD_HDID, HdId);
            //查询指定id的巷道对应的中心线(用于计算的分段显示的中心线)
            List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerfdlyr, fldvals);
            if (selobjs.Count == 0)
            {
                MessageBox.Show("没有找到相应的巷道信息!", "系统提示");
                return null;
            }
            int xh = Convert.ToInt32(selobjs[0].Item3[GIS_Const.FIELD_XH]) + 1;
            Dictionary<string, string> fdlin_dics = new Dictionary<string, string>();
            fdlin_dics.Add(GIS_Const.FIELD_HDID, HdId);
            fdlin_dics.Add(GIS_Const.FIELD_XH, xh.ToString());
            fdlin_dics.Add(GIS_Const.FIELD_ID, "0");
            fdlin_dics.Add(GIS_Const.FIELD_BS, "0");
            fdlin_dics.Add(GIS_Const.FIELD_BID, bid);
            //计算延长点的坐标
            IGeometry geosel = selobjs[0].Item2;
            IPolyline plin = (IPolyline)geosel;
            if (jjbs == 0)//掘进
            {
                IPoint outP = new PointClass();
                outP.SpatialReference = Global.spatialref;
                plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, outP);
                //根据点查询60米范围内的地质构造的信息
                List<int> hd_ids = new List<int>();
                hd_ids.Add(Convert.ToInt16(HdId));

                //将延长点添加到导线点图层上
                List<IPoint> dpts = new List<IPoint>();
                dpts.Add(outP);
                Dictionary<string, string> dics = new Dictionary<string, string>();
                dics.Add(GIS_Const.FIELD_HDID, HdId);
                dics.Add(GIS_Const.FIELD_BS, "0");
                dics.Add(GIS_Const.FIELD_BID, bid);
                //AddHangdaoToLayer(dpts, dics, Global.pntlyr);
                //将延长线添加到中线分段图层上
                List<IPoint> fdlin_pts = new List<IPoint>();
                fdlin_pts.Add(plin.ToPoint);
                fdlin_pts.Add(outP);
                AddFDLineToLayer(fdlin_pts, fdlin_dics, Global.centerfdlyr, 0);
                //将延长线添加到中线全图层上
                List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selcenterlin = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, fldvals);
                IPolyline centerlin = selcenterlin[0].Item2 as IPolyline;
                IPointCollection centerpnts = centerlin as IPointCollection;
                centerpnts.AddPoint(outP);
                IPolyline centerlinnew = centerpnts as IPolyline;
                IFeature centerlinfea = selcenterlin[0].Item1;
                AddHangdaoToLayer(fdlin_pts, fdlin_dics, Global.centerlyr);
                //将延长分段面添加到巷道面分段图层中
                List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selhdfd = Global.commonclss.SearchFeaturesByGeoAndText(Global.hdfdlyr, fldvals);
                IPolygon hdfd_polygon = (IPolygon)selhdfd[0].Item2;
                IPointCollection hdfd_cols = hdfd_polygon as IPointCollection;

                IPolyline center_line = new PolylineClass();
                center_line.FromPoint = plin.ToPoint;
                center_line.ToPoint = outP;
                IConstructCurve constructCurve = new PolylineClass();
                constructCurve.ConstructOffset(center_line, -hdwid / 2);//左侧的线
                IPolyline plyleft = constructCurve as IPolyline;

                IConstructCurve constructCurveright = new PolylineClass();
                constructCurveright.ConstructOffset(center_line, hdwid / 2);//左侧的线
                IPolyline plyright = constructCurveright as IPolyline;

                List<IPoint> hdfdjj_leftcols = new List<IPoint>();
                hdfdjj_leftcols.Add(plyleft.FromPoint);
                hdfdjj_leftcols.Add(plyleft.ToPoint);

                List<IPoint> hdfdjj_rightcols = new List<IPoint>();
                hdfdjj_rightcols.Add(plyright.FromPoint);
                hdfdjj_rightcols.Add(plyright.ToPoint);

                //IPolyline plyleft = new PolylineClass();
                //plyleft.SpatialReference = Global.spatialref;
                //IPointCollection plinleftcols = plyleft as IPointCollection;
                //if (plin.FromPoint.X - plin.ToPoint.X > 0)
                //{
                //    plinleftcols.AddPoint(hdfd_cols.get_Point(0));
                //    plinleftcols.AddPoint(hdfd_cols.get_Point(1));
                //}
//.........这里部分代码省略.........
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:101,代码来源:ConstructParallel.cs

示例5: AddCurveToMap

        /// <summary>
        /// 绘制曲线部分
        /// </summary>
        /// <params name="lyr">推断断层</params>
        /// <params name="newplines">延长点构造的线</params>
        /// <params name="originlines">原始点构造的线</params>
        private void AddCurveToMap(IFeatureLayer lyr, List<IPolyline> newplines, List<IPolyline> originlines)
        {
            IFeatureClass Featureclass = lyr.FeatureClass;
            IWorkspaceEdit workspace = (IWorkspaceEdit)(Featureclass as IDataset).Workspace;
            workspace.StartEditing(true);
            workspace.StartEditOperation();
            object missing = Type.Missing;
            //揭露断层上的曲线对象
            IGeometry geom = new PolylineClass();
            geom.SpatialReference = Global.spatialref;
            IGeometryCollection outgeomcols = geom as IGeometryCollection;
            IFeature fea = Featureclass.CreateFeature();
            ISegmentCollection newpath = new PathClass();
            int kindpos = Featureclass.Fields.FindField(GIS.GIS_Const.FIELD_TYPE);
            int bidpos = Featureclass.Fields.FindField(GIS.GIS_Const.FIELD_BID);
            for (int i = 0; i < newplines.Count; i++)
            {
                ILine lin = new LineClass();
                lin.SpatialReference = Global.spatialref;
                //直线段
                IPath path = new PathClass();
                if (i == 0)
                {
                    lin.FromPoint = newplines[i].FromPoint;
                    lin.ToPoint = originlines[i].ToPoint;
                }
                else if (i == originlines.Count - 1)
                {
                    lin.FromPoint = originlines[i].FromPoint;
                    lin.ToPoint = newplines[i].ToPoint;
                }
                else
                {
                    lin.FromPoint = originlines[i].FromPoint;
                    lin.ToPoint = originlines[i].ToPoint;
                }
                newpath.AddSegment(lin as ISegment, ref missing, ref missing);
                //曲线段
                if (i < newplines.Count - 1)
                {
                    IBezierCurveGEN bezier = new BezierCurveClass();
                    IPoint[] pntcontrols = new IPoint[4];
                    pntcontrols[0] = originlines[i].ToPoint;
                    pntcontrols[1] = newplines[i].ToPoint;
                    pntcontrols[2] = newplines[i + 1].FromPoint;
                    pntcontrols[3] = originlines[i + 1].FromPoint;
                    bezier.PutCoords(ref pntcontrols);

                    newpath.AddSegment(bezier as ISegment, ref missing, ref missing);
                }
            }
            outgeomcols.AddGeometry(newpath as IGeometry, ref missing, ref missing);
            int index = fea.Fields.FindField(GIS_Const.FIELD_SHAPE);
            IGeometryDef geometryDef = fea.Fields.get_Field(index).GeometryDef as IGeometryDef;
            if (geometryDef.HasZ)
            {
                IZAware pZAware = (IZAware)outgeomcols;
                pZAware.ZAware = true;
            }
            fea.Shape = outgeomcols as IPolyline;
            fea.set_Value(kindpos, 1);
            fea.set_Value(bidpos, BID);
            fea.Store();
            //外围曲线绘制
            ITopologicalOperator2 top = outgeomcols as ITopologicalOperator2;
            if (!top.IsSimple)
                top.Simplify();
            IConstructCurve curve = new PolylineClass();
            curve.ConstructOffset(outgeomcols as IPolyline, -3, ref missing, ref missing);
            IPolyline plinnew = curve as IPolyline;
            plinnew.SpatialReference = Global.spatialref;
            plinnew.FromPoint = newplines[0].FromPoint;
            plinnew.ToPoint = newplines[newplines.Count - 1].ToPoint;

            IFeature outcurve = Featureclass.CreateFeature();
            outcurve.set_Value(kindpos, 2);
            outcurve.set_Value(bidpos, BID);
            outcurve.Shape = plinnew;
            outcurve.Store();
            //结束编辑
            workspace.StopEditOperation();
            workspace.StopEditing(true);
            //定位跳转
            Global.commonclss.JumpToGeometry(plinnew);
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:91,代码来源:TddcClass.cs

示例6: CreateParaLineFeature

        /// <summary>
        /// 创建回采进尺线(根据参考线创建平行线)
        /// </summary>
        /// <params name="featureLayer">回采进尺图层</params>
        /// <params name="pRefPolyline">参考开切眼巷道</params>
        /// <params name="dDistance">回采距离</params>
        /// <returns>成功创建返回True</returns>
        public static bool CreateParaLineFeature(IFeatureLayer featureLayer, IPolyline pRefPolyline,string bindID, double dDistance)
        {
            if (pRefPolyline == null || pRefPolyline.IsEmpty)
            {
                return false;
            }

            try
            {
                IFeatureClass featureClass = featureLayer.FeatureClass;
                IGeometry geometry = pRefPolyline;

                object Missing = Type.Missing;
                IConstructCurve constructCurve = new PolylineClass();
                constructCurve.ConstructOffset(pRefPolyline, dDistance, ref Missing, ref Missing);

                IPolyline hcLine = constructCurve as IPolyline;
                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, hcLine);  //几何图形Z值处理

                    feature.Shape = hcLine;

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

                    //回采距离
                    iFieldID = feature.Fields.FindField("Distance");
                    if (iFieldID > -1)
                        feature.Value[iFieldID] = dDistance;

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

                    //缩放到新增的线要素,并高亮该要素
                    GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = hcLine.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);
                    //GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
                    return true;
                }
                else
                {
                    //System.Windows.Forms.MessageBox.Show("请选择点图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:68,代码来源:DrawHCLine.cs

示例7: FlatBuffer

        private IPolygon FlatBuffer(IPolyline _pLine, double _pBufferDis)
        {
            object o = System.Type.Missing;

               //分别对输入的线平移两次(正方向和负方向)

               IConstructCurve pConCurve = new PolylineClass();

               pConCurve.ConstructOffset(_pLine, _pBufferDis, ref o, ref o);

               IPointCollection pCol = pConCurve as IPointCollection;

               IConstructCurve pCurve = new PolylineClass();

               pCurve.ConstructOffset(_pLine, -1 * _pBufferDis, ref o, ref o);
               //把第二次平移的线的所有节点翻转
               IPolyline addline = pCurve as IPolyline;

               addline.ReverseOrientation();
               //把第二条的所有节点放到第一条线的IPointCollection里面
               IPointCollection pCol2 = addline as IPointCollection;

               pCol.AddPointCollection(pCol2);
               //用面去初始化一个IPointCollection
               IPointCollection myPCol = new PolygonClass();

               myPCol.AddPointCollection(pCol);
               //把IPointCollection转换为面
               IPolygon pPolygon = myPCol as IPolygon;
               //简化节点次序
               pPolygon.SimplifyPreserveFromTo();

               return pPolygon;
        }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:34,代码来源:MainForm.cs


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