コード例 #1
0
        private void AxRenderControl1_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            if (PickResult == null)
            {
                return;
            }

            IRenderPipeLinePickResult pr = PickResult as IRenderPipeLinePickResult;

            if (pr == null)
            {
                return;
            }

            GetParam();
            IRenderPipeLine rpl = pr.RenderPipeLine;

            rpl.Color = System.Drawing.Color.Yellow;
            rpl.Play(playMode, duration, needLoop);
            currentPLs.Add(rpl);
        }
コード例 #2
0
        private void AxRenderControl1_RcMouseDragSelect(IPickResultCollection PickResults, gviModKeyMask Mask)
        {
            if (PickResults == null)
            {
                return;
            }

            for (int i = 0; i < PickResults.Count; i++)
            {
                IRenderPipeLinePickResult pr = PickResults.Get(i) as IRenderPipeLinePickResult;
                if (pr == null)
                {
                    continue;
                }

                GetParam();
                IRenderPipeLine rpl = pr.RenderPipeLine;
                rpl.Color = System.Drawing.Color.Yellow;
                rpl.Play(playMode, duration, needLoop);
                currentPLs.Add(rpl);
            }
        }
コード例 #3
0
        private void GetResultSet(IFeatureClass fc, IQueryFilter filter, DataTable dt)
        {
            if (fc != null)
            {
                IFdeCursor cursor = null;
                try
                {
                    if (filter != null)
                    {
                        filter.PostfixClause = "order by oid asc";
                    }
                    // 查找所有记录
                    cursor = fc.Search(filter, true);
                    if (cursor != null)
                    {
                        dt.BeginLoadData();
                        IRowBuffer fdeRow = null;
                        DataRow    dr     = null;
                        while ((fdeRow = cursor.NextRow()) != null)
                        {
                            dr = dt.NewRow();
                            for (int i = 0; i < dt.Columns.Count; ++i)
                            {
                                string strColName = dt.Columns[i].ColumnName;
                                int    nPos       = fdeRow.FieldIndex(strColName);
                                if (nPos == -1 || fdeRow.IsNull(nPos))
                                {
                                    continue;
                                }
                                object v = fdeRow.GetValue(nPos);  // 从库中读取值
                                dr[i] = v;

                                if (i == 0)
                                {
                                    // 创建管子
                                    int       geoPos = fdeRow.FieldIndex("Geometry");
                                    IGeometry geo    = (IGeometry)fdeRow.GetValue(geoPos);
                                    if (geo.GeometryType == gviGeometryType.gviGeometryPolyline)
                                    {
                                        IPolyline       pl  = (IPolyline)fdeRow.GetValue(geoPos);
                                        IRenderPipeLine rpl = this.axRenderControl1.ObjectManager.CreateRenderPipeLine(pl, rootId);
                                        rpl.Radius = 10;
                                        rpl.Color  = System.Drawing.Color.Red;
                                        ArrayList rpls = new ArrayList();
                                        rpls.Add(rpl);
                                        pipeMap.Add(v, rpls);
                                    }
                                    else if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                                    {
                                        IMultiPolyline multiPolyline = geo as IMultiPolyline;
                                        ArrayList      rpls          = new ArrayList();
                                        for (int g = 0; g < multiPolyline.GeometryCount; g++)
                                        {
                                            IPolyline       plIndex = multiPolyline.GetGeometry(g) as IPolyline;
                                            IRenderPipeLine rpl     = this.axRenderControl1.ObjectManager.CreateRenderPipeLine(plIndex, rootId);
                                            rpl.Radius = 10;
                                            rpl.Color  = System.Drawing.Color.Red;
                                            rpls.Add(rpl);
                                        }
                                        pipeMap.Add(v, rpls);
                                    }
                                }
                            }
                            dt.Rows.Add(dr);
                        }
                        dt.EndLoadData();
                    }
                }
                catch (COMException ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex.Message);
                }
                finally
                {
                    if (cursor != null)
                    {
                        cursor.Dispose();
                        cursor = null;
                    }
                }
            }
        }