Ejemplo n.º 1
0
        private void toolStripButtonCreateTerrainModifier_Click(object sender, System.EventArgs e)
        {
            TerrainModifierSettingForm form = new TerrainModifierSettingForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                order = form.Order;
                switch (form.Strtype)
                {
                case "用定义了高程的多边形替代相应地形区域中大于多边形高程部分的高程值":
                    mode = gviElevationBehaviorMode.gviElevationBehaviorAbove;
                    break;

                case "用定义了高程的多边形替代相应地形区域中小于多边形高程部分的高程值":
                    mode = gviElevationBehaviorMode.gviElevationBehaviorBelow;
                    break;

                case "用定义了高程的多边形替代相应的地形区域的高程值":
                    mode = gviElevationBehaviorMode.gviElevationBehaviorReplace;
                    break;
                }

                currentGeometry            = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
                currentGeometry.SpatialCRS = crs as ISpatialCRS;

                ISurfaceSymbol sfbottom = new SurfaceSymbol();
                sfbottom.Color        = System.Drawing.Color.Red;
                currentRenderGeometry = this.axRenderControl1.ObjectManager.CreateRenderPolygon(currentGeometry as IPolygon, sfbottom, rootId);
                (currentRenderGeometry as IRenderPolygon).HeightStyle = gviHeightStyle.gviHeightOnTerrain;
                this.axRenderControl1.InteractMode = gviInteractMode.gviInteractEdit;
                this.axRenderControl1.ObjectEditor.StartEditRenderGeometry(currentRenderGeometry, gviGeoEditType.gviGeoEditCreator);
            }
        }
Ejemplo n.º 2
0
        private void 属性ToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            myListNode selectNode = this.listView1.SelectedItems[0] as myListNode;

            if (selectNode != null)
            {
                ITerrainModifier modifier = selectNode.obj as ITerrainModifier;
                if (modifier == null)
                {
                    return;
                }
                int index = 0;
                switch (modifier.ElevationBehavior)
                {
                case gviElevationBehaviorMode.gviElevationBehaviorAbove:
                    index = 2;
                    break;

                case gviElevationBehaviorMode.gviElevationBehaviorBelow:
                    index = 1;
                    break;

                case gviElevationBehaviorMode.gviElevationBehaviorReplace:
                    index = 0;
                    break;
                }
                TerrainModifierSettingForm form = new TerrainModifierSettingForm(modifier.DrawOrder, index);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    order = form.Order;
                    switch (form.Strtype)
                    {
                    case "用定义了高程的多边形替代相应地形区域中大于多边形高程部分的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorAbove;
                        break;

                    case "用定义了高程的多边形替代相应地形区域中小于多边形高程部分的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorBelow;
                        break;

                    case "用定义了高程的多边形替代相应的地形区域的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorReplace;
                        break;
                    }
                    modifier.DrawOrder         = order;
                    modifier.ElevationBehavior = mode;
                }
            }
        }
Ejemplo n.º 3
0
        private void 生成地形编辑ToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            myListNode selectNode = this.listView1.SelectedItems[0] as myListNode;

            if (selectNode != null)
            {
                IRenderPolygon rgeo    = selectNode.obj as IRenderPolygon;
                IPolygon       polygon = rgeo.GetFdeGeometry() as IPolygon;

                // 生成带洞polygon,可注释掉
                IEnvelope env    = rgeo.Envelope;
                IRing     ring   = (new GeometryFactory()).CreateGeometry(gviGeometryType.gviGeometryRing, gviVertexAttribute.gviVertexAttributeZ) as IRing;
                IPoint    center = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                center.Position   = env.Center;
                center.SpatialCRS = crs as ISpatialCRS;
                ring.AppendPoint(center);
                center.Y = env.Center.Y - 10;
                ring.AppendPoint(center);
                center.X = env.Center.X + 10;
                ring.AppendPoint(center);
                center.Y = env.Center.Y;
                ring.AppendPoint(center);
                polygon.AddInteriorRing(ring);
                // To here

                ISurfaceSymbol sfbottom = new SurfaceSymbol();
                sfbottom.Color = System.Drawing.Color.Red;
                IRenderPolygon rgeoNew = this.axRenderControl1.ObjectManager.CreateRenderPolygon(polygon, sfbottom, rootId);

                TerrainModifierSettingForm form = new TerrainModifierSettingForm();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    order = form.Order;
                    switch (form.Strtype)
                    {
                    case "用定义了高程的多边形替代相应地形区域中大于多边形高程部分的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorAbove;
                        break;

                    case "用定义了高程的多边形替代相应地形区域中小于多边形高程部分的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorBelow;
                        break;

                    case "用定义了高程的多边形替代相应的地形区域的高程值":
                        mode = gviElevationBehaviorMode.gviElevationBehaviorReplace;
                        break;
                    }

                    ITerrainModifier modifier = this.axRenderControl1.ObjectManager.CreateTerrainModifier(polygon, rootId);
                    if (modifier != null)
                    {
                        modifier.DrawOrder         = order;
                        modifier.ElevationBehavior = mode;

                        // 添加节点到界面控件上
                        myListNode item = new myListNode(string.Format("TerrainModifier_{0}", modifier.Guid), TreeNodeType.NT_TerrainModifier, modifier);
                        item.Checked = true;
                        listView1.Items.Add(item);

                        // 添加节点到界面控件上
                        item         = new myListNode(string.Format("RenderPolygon_{0}", modifier.Guid), TreeNodeType.NT_RenderGeomtry, rgeoNew);
                        item.Checked = true;
                        listView1.Items.Add(item);
                    }
                }
            }
        }