示例#1
0
        public static ITableLabel CreateTableLabel1(int rowcount)
        {
            AxRenderControl _3DControl = DF3DApplication.Application.Current3DMapControl;

            if (_3DControl != null)
            {
                ITableLabel tl = _3DControl.ObjectManager.CreateTableLabel(rowcount, 1, _3DControl.ProjectTree.RootID);
                tl.BorderColor          = 0xcc068043;   // 表的边框颜色
                tl.BorderWidth          = 2;            // 表的边框的宽度
                tl.TableBackgroundColor = 0xccffffff;   // 表的背景色
                tl.TitleBackgroundColor = 0xcc3366cc;   // 标题背景色

                // 第一列文本样式
                TextAttribute contentTextAttribute = new TextAttribute();
                contentTextAttribute.TextColor              = 0xff000000;
                contentTextAttribute.OutlineColor           = 0xff000000;
                contentTextAttribute.Font                   = "仿宋";
                contentTextAttribute.TextSize               = 11;
                contentTextAttribute.Bold                   = false;
                contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
                tl.SetColumnTextAttribute(0, contentTextAttribute);

                // 标题文本样式
                TextAttribute capitalTextAttribute = new TextAttribute();
                capitalTextAttribute.TextColor              = 0xffffffff;
                capitalTextAttribute.OutlineColor           = 0xffffffff;
                capitalTextAttribute.Font                   = "宋体";
                capitalTextAttribute.TextSize               = 11;
                capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
                capitalTextAttribute.Bold                   = false;
                tl.TitleTextAttribute = capitalTextAttribute;
                return(tl);
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// 重置
        /// </summary>
        /// <remarks>不再使用时调用</remarks>
        public virtual void Reset()
        {
            if (_StartRenderPoint != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_StartRenderPoint.Guid);
                _StartRenderPoint = null;
            }
            if (_EndRenderPoint != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_EndRenderPoint.Guid);
                _EndRenderPoint = null;
            }
            if (_RenderPolygon != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_RenderPolygon.Guid);
                _RenderPolygon = null;
            }
            if (_TableLabel != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_TableLabel.Guid);
                _TableLabel = null;
            }

            return;
        }
示例#3
0
        private void LoadTableLabel()
        {
            dynamicTableLabel = this.axRenderControl1.ObjectManager.CreateTableLabel(3, 2, rootId);

            dynamicTableLabel.TitleText = "直升机当前位置";
            dynamicTableLabel.SetRecord(0, 0, "X:");
            dynamicTableLabel.SetRecord(0, 1, line.GetPoint(0).X.ToString());
            dynamicTableLabel.SetRecord(1, 0, "Y:");
            dynamicTableLabel.SetRecord(1, 1, line.GetPoint(0).Y.ToString());
            dynamicTableLabel.SetRecord(2, 0, "Z:");
            dynamicTableLabel.SetRecord(2, 1, line.GetPoint(0).Z.ToString());

            dynamicTableLabel.Position = line.GetPoint(0);

            dynamicTableLabel.BorderColor          = System.Drawing.Color.FromArgb(255, 255, 255, 255);
            dynamicTableLabel.BorderWidth          = 2;
            dynamicTableLabel.TableBackgroundColor = System.Drawing.Color.FromArgb(200, 255, 255, 165);
            dynamicTableLabel.TitleBackgroundColor = System.Drawing.Color.FromArgb(180, 122, 122, 122);

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.FromArgb(120, 127, 64, 0);
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "细黑";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.FromArgb(125, 255, 127, 64);
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            dynamicTableLabel.TitleTextAttribute        = capitalTextAttribute;

            // 绑定到运动路径
            IMotionable m = dynamicTableLabel as IMotionable;

            position.Set(0, 0, 2);
            m.Bind2(dynamicObject, position, 0, 0, 0);
        }
示例#4
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null && dr["fc"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                    {
                        IModelPoint       mp  = objGeo as IModelPoint;
                        IModelPointSymbol mps = new ModelPointSymbol();
                        mps.SetResourceDataSet((dr["fc"] as IFeatureClass).FeatureDataSet);
                        mps.Color = 0xffffff00;
                        IRenderModelPoint rMP = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                        rMP.Glow(8000);
                        app.Current3DMapControl.ObjectManager.DelayDelete(rMP.Guid, 8000);

                        IGeometryFactory geoFact = new GeometryFactory();
                        IPoint           pt      = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = mp.X; pt.Y = mp.Y; pt.Z = mp.Z;

                        ITableLabel tl = DrawTool.CreateTableLabel1(1);
                        tl.TitleText = dr["fcName"].ToString();
                        tl.SetRecord(0, 0, dr["Name"].ToString());
                        tl.Position = pt;

                        this._listRender.Add(tl.Guid);

                        app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                    }
                }
                break;
            }
        }
示例#5
0
        private void ClickQuery()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }

            try
            {
                Guid                        guid = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer.FeatureClassId;
                DF3DFeatureClass            dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(guid.ToString());
                Dictionary <string, string> dict = null;
                if (dffc != null)
                {
                    dict = GetQueryResult(dffc, this._drawTool.GetSelectFeatureLayerPickResult().FeatureId);
                }
                else
                {
                    dict = GetQueryResult(this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer.FeatureClassInfo, this._drawTool.GetSelectFeatureLayerPickResult().FeatureId);
                }
                if (dict == null)
                {
                    return;
                }

                #region
                ITableLabel tl = DrawTool.CreateTableLabel2(dict.Count);
                tl.TitleText = "属性查询";
                int num = 0;
                foreach (KeyValuePair <string, string> kv in dict)
                {
                    string k = kv.Key;
                    string v = kv.Value;
                    tl.SetRecord(num, 0, k);
                    tl.SetRecord(num, 1, v);
                    num++;
                }
                tl.Position = this._drawTool.GetSelectPoint();
                _listTLs.Add(tl);
                #endregion
            }
            catch (Exception ex)
            {
            }
        }
示例#6
0
 void g_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
 {
     if (PickResult == null)
     {
         return;
     }
     else
     {
         if (PickResult.Type == gviObjectType.gviObjectTableLabel)
         {
             ITableLabelPickResult tlpr = PickResult as ITableLabelPickResult;
             gviObjectType         type = tlpr.Type;
             ITableLabel           fl   = tlpr.TableLabel;
             MessageBox.Show("拾取到" + type + "类型,名称为" + fl.TitleText);
         }
     }
 }
示例#7
0
        private void LoadDynamicTableLabel()
        {
            #region 加载一个标签
            dynamicTableLabel = axRenderControl1.ObjectManager.CreateTableLabel(2, 2, rootId);

            dynamicTableLabel.TitleText = "消防车当前位置";
            dynamicTableLabel.SetRecord(0, 0, "X:");
            dynamicTableLabel.SetRecord(0, 1, firstX.ToString());
            dynamicTableLabel.SetRecord(1, 0, "Y:");
            dynamicTableLabel.SetRecord(1, 1, firstY.ToString());

            position.Set(firstX, firstY, firstZ + 2.4);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position         = position;
            dynamicTableLabel.Position = fde_point;

            dynamicTableLabel.BorderColor          = System.Drawing.Color.White;
            dynamicTableLabel.BorderWidth          = 2;
            dynamicTableLabel.TableBackgroundColor = System.Drawing.Color.Gray;
            dynamicTableLabel.TitleBackgroundColor = System.Drawing.Color.Red;

            // 表头样式
            TextAttribute headerTextAttribute = new TextAttribute();
            headerTextAttribute.TextColor              = System.Drawing.Color.Black;
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 内容样式
            TextAttribute contentTextAttribute = new TextAttribute();
            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题样式
            TextAttribute capitalTextAttribute = new TextAttribute();
            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            dynamicTableLabel.TitleTextAttribute        = capitalTextAttribute;

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
            #endregion

            #region 加载一个模型
            if (renderModelPoint == null)
            {
                string           modelName  = (strMediaPath + @"\osg\Vehicles\XiaoFangChe\xiaoFangChe3.OSG");
                IGeometryFactory geoFactory = new GeometryFactory();
                IModelPoint      modePoint  = (IModelPoint)geoFactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ);
                modePoint.ModelName = modelName;
                modePoint.SetCoords(firstX, firstY, firstZ, 0, 0);
                renderModelPoint = axRenderControl1.ObjectManager.CreateRenderModelPoint(modePoint, null, rootId);
            }
            #endregion

            #region 加载一个运动路径
            if (motionPath == null)
            {
                motionPath = axRenderControl1.ObjectManager.CreateMotionPath(rootId);
                // 为MotionPath添加第一个点
                position.Set(firstX, firstY, firstZ);
                angle.Set(firstH, firstP, firstR);
                scale.Set(firstSX, firstSY, firstSZ);
                motionPath.AddWaypoint(position, angle, scale, firtWhen);
                //为MotionPath添加第二个点
                position.Set(secondX, secondY, secondZ);
                angle.Set(secondH, secondP, secondR);
                scale.Set(secondSX, secondSY, secondSZ);
                motionPath.AddWaypoint(position, angle, scale, secondWhen);
                //为MotionPath添加第三个点
                position.Set(thirdX, thirdY, thirdZ);
                angle.Set(thirdH, thirdP, thirdR);
                scale.Set(thirdSX, thirdSY, thirdSZ);
                motionPath.AddWaypoint(position, angle, scale, thirdWhen);
                //为MotionPath添加第四个点
                position.Set(fourthX, fourthY, fourthZ);
                angle.Set(fourthH, fourthP, fourthR);
                scale.Set(fourthSX, fourthSY, fourthSZ);
                motionPath.AddWaypoint(position, angle, scale, fourthWhen);
            }
            #endregion

            #region 将模型和标牌同时绑定在路径上
            m = renderModelPoint as IMotionable;
            //将模型绑定到路径上

            v3.Set(0, 0, 0);
            m.Bind(motionPath, v3, 0, 0, 0);

            // 将标牌绑定到路径上
            if (dynamicTableLabel != null && motionPath != null)
            {
                m = dynamicTableLabel as IMotionable;
                v3.Set(0, 0, 6);
                m.Bind(motionPath, v3, 0, 0, 0);
            }
            #endregion
        }
示例#8
0
        private void btnThirdLabel_Click(object sender, EventArgs e)
        {
            // 创建一个有3行2列的TableLabel
            tableLabel = axRenderControl1.ObjectManager.CreateTableLabel(3, 3, rootId);

            // 设定文字
            tableLabel.TitleText = "火焰特效";
            tableLabel.SetRecord(0, 0, "发射速率");
            tableLabel.SetRecord(0, 1, "50");
            tableLabel.SetRecord(0, 2, "100");
            tableLabel.SetRecord(1, 0, "移动速度");
            tableLabel.SetRecord(1, 1, "0");
            tableLabel.SetRecord(1, 2, "1");
            tableLabel.SetRecord(2, 0, "旋转速度");
            tableLabel.SetRecord(2, 1, "-1");
            tableLabel.SetRecord(2, 2, "1");

            //标牌的位置
            position.Set(15038.20, 35681.01, 5.00);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position  = position;
            tableLabel.Position = fde_point;

            tableLabel.BorderColor          = System.Drawing.Color.FromArgb(255, 25, 25, 25);
            tableLabel.BorderWidth          = 1.6f;
            tableLabel.TableBackgroundColor = System.Drawing.Color.FromArgb(255, 15, 23, 0);
            tableLabel.TitleBackgroundColor = System.Drawing.Color.FromArgb(255, 122, 122, 122);
            string tmpPicturePath = (strMediaPath + @"\bmp\Tulips.bmp");

            tableLabel.BackgroundImageName = tmpPicturePath;

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 127, 64, 0);
            headerTextAttribute.OutlineColor           = System.Drawing.Color.FromArgb(255, 230, 230, 230);
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 64, 25, 0);
            contentTextAttribute.OutlineColor           = System.Drawing.Color.FromArgb(255, 230, 230, 230);
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(1, contentTextAttribute);
            tableLabel.SetColumnTextAttribute(2, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            tableLabel.TitleTextAttribute               = capitalTextAttribute;

            switch (cbDepthTestMode.SelectedIndex)
            {
            case 0:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestEnable;
                break;

            case 1:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestDisable;
                break;

            case 2:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestAdvance;
                break;
            }

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
        }
示例#9
0
        /// <summary>
        /// 加载第一种样式的静态指示标签
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSecondLabel_Click(object sender, EventArgs e)
        {
            // 创建一个有3行2列的TableLabel
            tableLabel = axRenderControl1.ObjectManager.CreateTableLabel(3, 2, rootId);

            // 设定文字
            tableLabel.TitleText = "设备信息展示";
            tableLabel.SetRecord(0, 0, "生产日期");
            tableLabel.SetRecord(0, 1, "2012.8.22");
            tableLabel.SetRecord(1, 0, "生产厂商");
            tableLabel.SetRecord(1, 1, "河南许继");
            tableLabel.SetRecord(2, 0, "上次维修日期");
            tableLabel.SetRecord(2, 1, "2012.9.12");

            //标牌的位置
            position.Set(15277.55, 35737.44, 29.50);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position  = position;
            tableLabel.Position = fde_point;

            // 列宽度
            tableLabel.SetColumnWidth(0, 110);
            tableLabel.SetColumnWidth(1, 100);

            tableLabel.BorderColor          = System.Drawing.Color.FromArgb(255, 255, 255, 255);
            tableLabel.BorderWidth          = 2;
            tableLabel.TableBackgroundColor = System.Drawing.Color.FromArgb(200, 255, 255, 165);
            tableLabel.TitleBackgroundColor = System.Drawing.Color.FromArgb(180, 122, 122, 122);

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.FromArgb(120, 127, 64, 0);
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "细黑";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.FromArgb(125, 255, 127, 64);
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            tableLabel.TitleTextAttribute               = capitalTextAttribute;

            switch (cbDepthTestMode.SelectedIndex)
            {
            case 0:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestEnable;
                break;

            case 1:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestDisable;
                break;

            case 2:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestAdvance;
                break;
            }

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
        }
示例#10
0
        /// <summary>
        /// 加载第一种样式的静态指示标签
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFirstLabel_Click(object sender, EventArgs e)
        {
            // 创建一个有3行2列的TableLabel
            tableLabel = axRenderControl1.ObjectManager.CreateTableLabel(3, 2, rootId);
            // 设定表头文字
            tableLabel.TitleText = "大楼信息展示";
            // 设定表格中第1行,第1列的显示文字
            tableLabel.SetRecord(0, 0, "大楼层数");
            // 第1行,第2列
            tableLabel.SetRecord(0, 1, "2");
            // 第2行,第1列
            tableLabel.SetRecord(1, 0, "大楼高度");
            // 第2行,第2列
            tableLabel.SetRecord(1, 1, "5米");
            // 第3行,第1列
            tableLabel.SetRecord(2, 0, "施工单位");
            // 第3行,第2列
            tableLabel.SetRecord(2, 1, "金隅集团");

            //标牌的位置
            position.Set(15293.62, 35805.17, 17.92);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position  = position;
            tableLabel.Position = fde_point;

            // 列宽度
            tableLabel.SetColumnWidth(0, 80);
            tableLabel.SetColumnWidth(1, 80);

            // 表的边框颜色
            tableLabel.BorderColor = System.Drawing.Color.White;
            // 表的边框的宽度
            tableLabel.BorderWidth = 2;
            // 表的背景色
            tableLabel.TableBackgroundColor = System.Drawing.Color.Gray;

            // 标题背景色
            tableLabel.TitleBackgroundColor = System.Drawing.Color.Red;

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.White;
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            tableLabel.TitleTextAttribute               = capitalTextAttribute;

            switch (cbDepthTestMode.SelectedIndex)
            {
            case 0:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestEnable;
                break;

            case 1:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestDisable;
                break;

            case 2:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestAdvance;
                break;
            }

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
        }
示例#11
0
        private void AxRenderControl3D_RcMouseClickSelect(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                IPickResult pr = e.pickResult;
                if (pr.Type == gviObjectType.gviObjectFeatureLayer && pr is IFeatureLayerPickResult)
                {
                    IFeatureLayerPickResult flpr = pr as IFeatureLayerPickResult;
                    int           oid            = flpr.FeatureId;
                    IFeatureLayer fl             = flpr.FeatureLayer;
                    if (this._dictFeatureClass.ContainsKey(fl.FeatureClassId))
                    {
                        IFeatureClass fc = this._dictFeatureClass[fl.FeatureClassId];
                        if (fc == null)
                        {
                            return;
                        }
                        IQueryFilter filter = new QueryFilter();
                        filter.WhereClause = "oid = " + oid;
                        cursor             = fc.Search(filter, true);
                        IFieldInfoCollection        fiCol = fc.GetFields();
                        Dictionary <string, string> dict  = new Dictionary <string, string>();
                        if ((row = cursor.NextRow()) != null)
                        {
                            for (int i = 0; i < fiCol.Count; i++)
                            {
                                IFieldInfo fi  = fiCol.Get(i);
                                object     obj = row.GetValue(i);
                                if (obj == null)
                                {
                                    continue;
                                }
                                string str = "";
                                switch (fi.FieldType)
                                {
                                case gviFieldType.gviFieldBlob:
                                case gviFieldType.gviFieldUnknown:
                                case gviFieldType.gviFieldGeometry:
                                    break;

                                case gviFieldType.gviFieldFloat:
                                case gviFieldType.gviFieldDouble:
                                    double d;
                                    if (double.TryParse(obj.ToString(), out d))
                                    {
                                        str = d.ToString("0.00");
                                    }
                                    break;

                                default:
                                    str = obj.ToString();
                                    break;
                                }
                                if (!string.IsNullOrEmpty(str.Trim()))
                                {
                                    string temp = fi.Name + "(" + fi.Alias + ")";
                                    dict[temp] = str;
                                }
                            }
                        }
                        #region
                        ITableLabel tl = DrawTool.CreateTableLabel2(dict.Count);
                        tl.TitleText = "属性查询";
                        int num = 0;
                        foreach (KeyValuePair <string, string> kv in dict)
                        {
                            string k = kv.Key;
                            string v = kv.Value;
                            tl.SetRecord(num, 0, k);
                            tl.SetRecord(num, 1, v);
                            num++;
                        }
                        tl.Position = e.intersectPoint;
                        allTLGuid.Add(tl.Guid);
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#12
0
        private void GetData()
        {
            string   whereClause = _dict[_currentClass];
            SubClass sc          = _currentClass;

            if (sc.Parent == null)
            {
                return;
            }
            string[] arrFc3DId = sc.Parent.Fc3D.Split(';');
            if (arrFc3DId == null)
            {
                return;
            }
            foreach (string fc3DId in arrFc3DId)
            {
                DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId);
                if (dffc == null)
                {
                    continue;
                }
                FacilityClass facc = dffc.GetFacilityClass();
                IFeatureClass fc   = dffc.GetFeatureClass();
                if (fc == null || facc == null || facc.Name != this._facType)
                {
                    continue;
                }
                List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                if (facFields == null || facFields.Count == 0)
                {
                    return;
                }

                ISpatialFilter filter = new SpatialFilter();
                filter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                filter.Geometry      = this._geo;
                filter.GeometryField = "FootPrint";
                filter.WhereClause   = whereClause;
                _count = fc.GetCount(filter);
                if (_num > _count || _count == 0)
                {
                    return;
                }

                filter.ResultBeginIndex = _num - 1;
                filter.ResultLimit      = 1;
                IFdeCursor cursor = null;
                IRowBuffer row    = null;
                try
                {
                    cursor = fc.Search(filter, false);
                    if ((row = cursor.NextRow()) != null)
                    {
                        #region 定位
                        int geoindex = row.FieldIndex("Geometry");
                        if (geoindex == -1 || !(row.GetValue(geoindex) is IModelPoint))
                        {
                            continue;
                        }
                        DF3DApplication app = DF3DApplication.Application;
                        if (app != null && app.Current3DMapControl != null)
                        {
                            IModelPoint       geo = row.GetValue(geoindex) as IModelPoint;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(geo, mps, app.Current3DMapControl.ProjectTree.RootID);
                            //app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                            render.Glow(5000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 5000);

                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            IPoint ptTL          = null;
                            int    geoshapeindex = row.FieldIndex("Shape");
                            if (geoshapeindex != -1)
                            {
                                if (!row.IsNull(geoshapeindex))
                                {
                                    IGeometry geoShape = row.GetValue(geoshapeindex) as IGeometry;
                                    if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                                    {
                                        double         x         = 0;
                                        double         y         = 0;
                                        double         z         = 0;
                                        IMultiPolyline mPolyline = geoShape as IMultiPolyline;
                                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                                        {
                                            IPolyline polyline = mPolyline.GetPolyline(m);
                                            IPoint    pttemp   = polyline.Midpoint;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolyline.GeometryCount;
                                        y      = y / mPolyline.GeometryCount;
                                        z      = z / mPolyline.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                                    {
                                        double        x        = 0;
                                        double        y        = 0;
                                        double        z        = 0;
                                        IMultiPolygon mPolygon = geoShape as IMultiPolygon;
                                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                                        {
                                            IPolygon polygon = mPolygon.GetPolygon(m);
                                            IPoint   pttemp  = polygon.Centroid;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolygon.GeometryCount;
                                        y      = y / mPolygon.GeometryCount;
                                        z      = z / mPolygon.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolyline)
                                    {
                                        ptTL = (geoShape as IPolyline).Midpoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPoint)
                                    {
                                        ptTL = geoShape as IPoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolygon)
                                    {
                                        ptTL = (geoShape as IPolygon).Centroid;
                                    }
                                }
                            }
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            else
                            {
                                tl.Position = geo;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 5000);
                        }

                        #endregion

                        foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                        {
                            if (!facField.CanQuery)
                            {
                                continue;
                            }
                            int index = row.FieldIndex(facField.Name);
                            if (index != -1 && !row.IsNull(index))
                            {
                                object     obj  = row.GetValue(index);
                                string     str  = "";
                                IFieldInfo fiFC = row.Fields.Get(index);
                                switch (fiFC.FieldType)
                                {
                                case gviFieldType.gviFieldBlob:
                                case gviFieldType.gviFieldUnknown:
                                case gviFieldType.gviFieldGeometry:
                                    continue;

                                case gviFieldType.gviFieldFloat:
                                case gviFieldType.gviFieldDouble:
                                    double d;
                                    if (double.TryParse(obj.ToString(), out d))
                                    {
                                        str = d.ToString("0.00");
                                    }
                                    break;

                                default:
                                    str = obj.ToString();
                                    break;
                                }
                                DataRow dr = this._dtShow.NewRow();
                                dr["Property"] = facField.ToString();
                                dr["Value"]    = str;
                                this._dtShow.Rows.Add(dr);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    if (cursor != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                        cursor = null;
                    }
                    if (row != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                        row = null;
                    }
                }
            }
        }
示例#13
0
        private void showInfo(DataTable dt, IPoint location)
        {
            if (tableLabel != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(tableLabel.Guid);
            }
            if (dt != null && dt.Rows.Count == 1)
            {
                int            row        = dt.Columns.Count;
                IObjectManager objManager = this.axRenderControl1.ObjectManager;
                //创建一个TableLabel 指定 row ,column
                tableLabel = objManager.CreateTableLabel(row, 2, rootId);

                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    string columnName = dt.Columns[i].ColumnName;
                    tableLabel.SetRecord(i, 0, columnName);
                    tableLabel.SetRecord(i, 1, dt.Rows[0][columnName].ToString());
                }

                // 设定表位置
                tableLabel.Position = location;

                //表头
                tableLabel.TitleText = "拾取模型信息";
                //表头背景色
                tableLabel.TitleBackgroundColor = System.Drawing.Color.FromArgb(255, 255, 255, 200);

                tableLabel.SetColumnWidth(0, 80);

                tableLabel.SetColumnWidth(1, 200);

                //表的边框颜色
                tableLabel.BorderColor = System.Drawing.Color.Red;
                //表的边框的宽度
                tableLabel.BorderWidth = 2;
                //表的背景色
                tableLabel.TableBackgroundColor = System.Drawing.Color.FromArgb(200, 255, 255, 200);

                // 表头样式
                TextAttribute headerTextAttribute = new TextAttribute();
                headerTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 0, 0, 0);
                headerTextAttribute.OutlineColor           = System.Drawing.Color.Blue;
                headerTextAttribute.Font                   = "宋体";
                headerTextAttribute.TextSize               = 12;
                headerTextAttribute.Bold                   = false;
                headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
                tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

                // 内容样式  列的内容 样式
                TextAttribute contentTextAttribute = new TextAttribute();
                contentTextAttribute.TextColor              = System.Drawing.Color.FromArgb(255, 0, 0, 0);;
                contentTextAttribute.OutlineColor           = System.Drawing.Color.Blue;
                contentTextAttribute.Font                   = "宋体";
                contentTextAttribute.Bold                   = false;
                contentTextAttribute.TextSize               = 12;
                contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
                tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

                // 标题样式
                TextAttribute capitalTextAttribute = new TextAttribute();
                capitalTextAttribute.TextColor              = System.Drawing.Color.White;
                capitalTextAttribute.OutlineColor           = System.Drawing.Color.Green;
                capitalTextAttribute.Font                   = "华文新魏";
                capitalTextAttribute.TextSize               = 15;
                capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
                capitalTextAttribute.Bold                   = true;
                tableLabel.TitleTextAttribute               = capitalTextAttribute;

                tableLabel.MouseSelectMask = 0;
            }
        }
示例#14
0
文件: MainForm.cs 项目: batuZ/Samples
        private ITableLabel DrawTableLabel(IRowBuffer row, IPoint point)
        {
            // 创建一个有3行2列的TableLabel
            ITableLabel tableLabel = this.axRenderControl1.ObjectManager.CreateTableLabel(row.FieldCount, 2, rootId);

            // 设定表头文字
            tableLabel.TitleText = "瓦片信息展示";
            IFieldInfoCollection fieldCols = row.Fields;

            for (int k = 0; k < row.FieldCount; k++)
            {
                tableLabel.SetRecord(k, 0, fieldCols.Get(k).Name);
                tableLabel.SetRecord(k, 1, row.GetValue(k).ToString());
            }

            //标牌的位置
            tableLabel.Position = point;

            // 列宽度
            tableLabel.SetColumnWidth(0, 100);
            tableLabel.SetColumnWidth(1, 100);

            // 表的边框颜色
            tableLabel.BorderColor = System.Drawing.Color.White;
            // 表的边框的宽度
            tableLabel.BorderWidth = 2;
            // 表的背景色
            tableLabel.TableBackgroundColor = System.Drawing.Color.Gray;

            // 标题背景色
            tableLabel.TitleBackgroundColor = System.Drawing.Color.Red;

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.White;
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            tableLabel.TitleTextAttribute               = capitalTextAttribute;

            return(tableLabel);
        }
示例#15
0
        /// <summary>
        /// 绘制标签
        /// </summary>
        /// <param name="x">标签X坐标</param>
        /// <param name="y">标签Y坐标</param>
        /// <param name="z">标签Z坐标</param>
        protected void DrawTableLabel(double x, double y, double z)
        {
            int            rowCount = 3, columnCount = 2;
            IObjectManager objManager = _AxRenderControl.ObjectManager;

            if (_TableLabel == null)
            {
                _TableLabel = objManager.CreateTableLabel(rowCount, columnCount, rootId);

                _TableLabel.TitleText = "最高点";

                _TableLabel.SetRecord(0, 0, "x:");
                _TableLabel.SetRecord(1, 0, "y:");
                _TableLabel.SetRecord(2, 0, "z:");

                _TableLabel.BorderColor          = System.Drawing.Color.Yellow;
                _TableLabel.BorderWidth          = 2;
                _TableLabel.TableBackgroundColor = System.Drawing.Color.Gray;

                // 内容标题样式
                TextAttribute columeCapitalTextAttribute = new TextAttribute()
                {
                    TextColor              = System.Drawing.Color.Black,
                    OutlineColor           = System.Drawing.Color.Gray,
                    Font                   = "Calibri",
                    TextSize               = 15,
                    Bold                   = true,
                    MultilineJustification = gviMultilineJustification.gviMultilineCenter
                };
                _TableLabel.SetColumnTextAttribute(0, columeCapitalTextAttribute);

                // 内容值样式
                TextAttribute columeValueTextAttribute = new TextAttribute()
                {
                    TextColor              = System.Drawing.Color.Black,
                    OutlineColor           = System.Drawing.Color.Blue,
                    Font                   = "Calibri",
                    TextSize               = 13,
                    Bold                   = true,
                    MultilineJustification = gviMultilineJustification.gviMultilineLeft
                };
                _TableLabel.SetColumnTextAttribute(1, columeValueTextAttribute);

                // 标题样式
                _TableLabel.TitleBackgroundColor = System.Drawing.Color.Yellow;
                TextAttribute titleTextAttribute = new TextAttribute()
                {
                    TextColor = System.Drawing.Color.Black, OutlineColor = System.Drawing.Color.Green, Font = "宋体", TextSize = 15, MultilineJustification = gviMultilineJustification.gviMultilineCenter, Bold = true, BackgroundColor = System.Drawing.Color.Gray
                };
                _TableLabel.TitleTextAttribute = titleTextAttribute;
            }

            IPoint poi = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ) as IPoint;

            poi.SetCoords(x, y, z, 0, 0);
            _TableLabel.Position = poi;

            _TableLabel.SetRecord(0, 1, x.ToString());
            _TableLabel.SetRecord(1, 1, y.ToString());
            _TableLabel.SetRecord(2, 1, z.ToString());

            _TableLabel.VisibleMask = gviViewportMask.gviViewAllNormalView;
        }
示例#16
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    IPoint    pt     = null;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                    {
                        double         x         = 0;
                        double         y         = 0;
                        double         z         = 0;
                        IMultiPolyline mPolyline = objGeo as IMultiPolyline;
                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                        {
                            IPolyline polyline = mPolyline.GetPolyline(m);
                            IPoint    pttemp   = polyline.Midpoint;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolyline.GeometryCount;
                        y    = y / mPolyline.GeometryCount;
                        z    = z / mPolyline.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolyline.Glow(8000);
                        this._listRender.Add(rMPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                    {
                        double        x        = 0;
                        double        y        = 0;
                        double        z        = 0;
                        IMultiPolygon mPolygon = objGeo as IMultiPolygon;
                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                        {
                            IPolygon polygon = mPolygon.GetPolygon(m);
                            IPoint   pttemp  = polygon.Centroid;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolygon.GeometryCount;
                        y    = y / mPolygon.GeometryCount;
                        z    = z / mPolygon.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolygon.Glow(8000);
                        this._listRender.Add(rMPolygon.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolyline)
                    {
                        IPolyline polyline = objGeo as IPolyline;
                        pt = polyline.Midpoint;
                        IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolyline.Glow(8000);
                        this._listRender.Add(rPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPoint)
                    {
                        IPoint point = objGeo as IPoint;
                        pt = point;
                        IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                        rPoint.Glow(8000);
                        this._listRender.Add(rPoint.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolygon)
                    {
                        IPolygon polygon = objGeo as IPolygon;
                        pt = polygon.Centroid;
                        IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolygon.Glow(8000);
                        this._listRender.Add(rPolygon.Guid);
                    }
                    else
                    {
                        return;
                    }

                    ITableLabel tl = DrawTool.CreateTableLabel1(1);
                    tl.TitleText = dr["fcName"].ToString();
                    tl.SetRecord(0, 0, dr["Name"].ToString());
                    tl.Position = pt;

                    this._listRender.Add(tl.Guid);

                    app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                }
                break;
            }
        }
示例#17
0
        private void GetData()
        {
            if (this.cbLayer.SelectedItem == null)
            {
                return;
            }
            DF3DFeatureClass dffc = this.cbLayer.SelectedItem as DF3DFeatureClass;

            if (dffc == null)
            {
                return;
            }
            IFeatureClass fc = dffc.GetFeatureClass();

            if (fc == null)
            {
                return;
            }

            if (_num > _count || _count == 0)
            {
                return;
            }

            ISpatialFilter filter = this._filter;

            filter.ResultBeginIndex = _num - 1;
            filter.ResultLimit      = 1;
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                cursor = fc.Search(filter, false);
                if ((row = cursor.NextRow()) != null)
                {
                    #region 定位
                    int             geoindex = row.FieldIndex("Geometry");
                    DF3DApplication app      = DF3DApplication.Application;
                    if (geoindex != -1 && !row.IsNull(geoindex) && app != null && app.Current3DMapControl != null)
                    {
                        ISurfaceSymbol ss = new SurfaceSymbolClass();
                        ss.Color = 0xcc00ff00;
                        ICurveSymbol cs = new CurveSymbolClass();
                        cs.Color          = 0xff00ff00;
                        cs.Width          = -5;
                        ss.BoundarySymbol = cs;
                        ISimplePointSymbol ps = new SimplePointSymbol();
                        ps.Size      = SystemInfo.Instance.SymbolSize;
                        ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                        IGeometry geo  = row.GetValue(geoindex) as IGeometry;
                        IPoint    ptTL = null;
                        if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                        {
                            double         x         = 0;
                            double         y         = 0;
                            double         z         = 0;
                            IMultiPolyline mPolyline = geo as IMultiPolyline;
                            for (int m = 0; m < mPolyline.GeometryCount; m++)
                            {
                                IPolyline polyline = mPolyline.GetPolyline(m);
                                IPoint    pttemp   = polyline.Midpoint;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolyline.GeometryCount;
                            y      = y / mPolyline.GeometryCount;
                            z      = z / mPolyline.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                        {
                            double        x        = 0;
                            double        y        = 0;
                            double        z        = 0;
                            IMultiPolygon mPolygon = geo as IMultiPolygon;
                            for (int m = 0; m < mPolygon.GeometryCount; m++)
                            {
                                IPolygon polygon = mPolygon.GetPolygon(m);
                                IPoint   pttemp  = polygon.Centroid;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolygon.GeometryCount;
                            y      = y / mPolygon.GeometryCount;
                            z      = z / mPolygon.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolyline)
                        {
                            IPolyline polyline = geo as IPolyline;
                            ptTL = polyline.Midpoint;
                            IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPoint)
                        {
                            IPoint point = geo as IPoint;
                            ptTL = point;
                            IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                            rPoint.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPoint.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPoint.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolygon)
                        {
                            IPolygon polygon = geo as IPolygon;
                            ptTL = polygon.Centroid;
                            IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                        {
                            ptTL = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            IModelPoint mp = geo as IModelPoint;
                            ptTL.X = mp.X;
                            ptTL.Y = mp.Y;
                            ptTL.Z = mp.Z;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                            render.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                        }
                        if (ptTL != null)
                        {
                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 8000);
                        }
                    }
                    #endregion
                    FacilityClass facc = dffc.GetFacilityClass();
                    if (facc == null)
                    {
                        IFieldInfoCollection fiCol = fc.GetFields();
                        for (int i = 0; i < fiCol.Count; i++)
                        {
                            IFieldInfo fi  = fiCol.Get(i);
                            object     obj = row.GetValue(i);
                            string     str = "";
                            switch (fi.FieldType)
                            {
                            case gviFieldType.gviFieldBlob:
                            case gviFieldType.gviFieldUnknown:
                            case gviFieldType.gviFieldGeometry:
                                continue;

                            case gviFieldType.gviFieldFloat:
                            case gviFieldType.gviFieldDouble:
                                double d;
                                if (double.TryParse(obj.ToString(), out d))
                                {
                                    str = d.ToString("0.00");
                                }
                                break;

                            default:
                                str = obj.ToString();
                                break;
                            }
                            DataRow dr = this._dtShow.NewRow();
                            dr["Property"] = string.IsNullOrEmpty(fi.Alias) ? fi.Name : fi.Alias;
                            dr["Value"]    = str;
                            this._dtShow.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                        if (facFields != null)
                        {
                            foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                            {
                                if (!facField.CanQuery)
                                {
                                    continue;
                                }
                                int index = row.FieldIndex(facField.Name);
                                if (index != -1 && !row.IsNull(index))
                                {
                                    object     obj  = row.GetValue(index);
                                    string     str  = "";
                                    IFieldInfo fiFC = row.Fields.Get(index);
                                    switch (fiFC.FieldType)
                                    {
                                    case gviFieldType.gviFieldBlob:
                                    case gviFieldType.gviFieldUnknown:
                                    case gviFieldType.gviFieldGeometry:
                                        continue;

                                    case gviFieldType.gviFieldFloat:
                                    case gviFieldType.gviFieldDouble:
                                        double d;
                                        if (double.TryParse(obj.ToString(), out d))
                                        {
                                            str = d.ToString("0.00");
                                        }
                                        break;

                                    default:
                                        str = obj.ToString();
                                        break;
                                    }
                                    DataRow dr = this._dtShow.NewRow();
                                    dr["Property"] = facField.ToString();
                                    dr["Value"]    = str;
                                    this._dtShow.Rows.Add(dr);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
                if (row != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                    row = null;
                }
            }
        }