Exemplo n.º 1
0
        void preDraw(ISurfaceSymbol symbol)
        {
            this.axRenderControl1.RcObjectEditing += new _IRenderControlEvents_RcObjectEditingEventHandler(axRenderControl1_RcObjectEditing);

            this.axRenderControl1.RcObjectEditFinish += new _IRenderControlEvents_RcObjectEditFinishEventHandler(axRenderControl1_RcObjectEditFinish);

            this.axRenderControl1.InteractMode = gviInteractMode.gviInteractEdit;

            this.axRenderControl1.ObjectEditor.FinishEdit();   //用于当拾取到基准面时,或者没有正常右键结束连续调用Start时

            if (gfactory == null)
            {
                gfactory = new GeometryFactory();
            }

            fde_polygon = (IPolygon)gfactory.CreateGeometry(gviGeometryType.gviGeometryPolygon,
                                                            gviVertexAttribute.gviVertexAttributeNone);
            rpolygon = this.axRenderControl1.ObjectManager.CreateRenderPolygon(fde_polygon, symbol, rootId);
            rpolygon.MaxVisibleDistance = 3000;
            rpolygon.MouseSelectMask    = gviViewportMask.gviViewNone;
            renderGeoToDel.Add(rpolygon);

            resultCode = this.axRenderControl1.ObjectEditor.StartEditRenderGeometry(rpolygon, gviGeoEditType.gviGeoEditCreator);
            if (!resultCode)
            {
                MessageBox.Show(this.axRenderControl1.GetLastError().ToString());
                return;
            }
        }
Exemplo n.º 2
0
        public DrawTool()
        {
            this._3DControl = DF3DApplication.Application.Current3DMapControl;
            if (this._3DControl != null)
            {
                if (this._3DControl.Terrain.IsRegistered && this._3DControl.Terrain.VisibleMask != gviViewportMask.gviViewNone)
                {
                    this._heightStyle = gviHeightStyle.gviHeightOnTerrain;
                }
                else
                {
                    this._heightStyle = gviHeightStyle.gviHeightAbsolute;
                }

                this._objectManager                  = this._3DControl.ObjectManager;
                this._geoFactory                     = new GeometryFactory();
                this._curveSymbol                    = new CurveSymbol();
                this._curveSymbol.Width              = 0;
                this._curveSymbol.Color              = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
                this._surfaceSymbol                  = new SurfaceSymbol();
                this._surfaceSymbol.Color            = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                this._surfaceSymbol.BoundarySymbol   = this._curveSymbol;
                this._simplePointSymbol              = new SimplePointSymbol();
                this._simplePointSymbol.FillColor    = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
                this._simplePointSymbol.OutlineColor = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
                this._simplePointSymbol.Size         = 10;
                this._simplePointSymbol.Style        = gviSimplePointStyle.gviSimplePointCircle;
                this._rootID = this._3DControl.ProjectTree.RootID;
            }
        }
        private void CreateRenderPolygon(IPoint point)
        {
            if (gfactory == null)
            {
                gfactory = new GeometryFactory();
            }

            fde_polygon            = (IPolygon)gfactory.CreateGeometry(i3dGeometryType.i3dGeometryPolygon, i3dVertexAttribute.i3dVertexAttributeZ);
            fde_polygon.SpatialCRS = crs;

            fde_point = (IPoint)gfactory.CreateGeometry(i3dGeometryType.i3dGeometryPoint, i3dVertexAttribute.i3dVertexAttributeZ);

            fde_point.SetCoords(point.X, point.Y, point.Z, 0, 0);
            fde_polygon.ExteriorRing.AppendPoint(fde_point);

            fde_point.SetCoords(point.X + 10, point.Y, point.Z, 0, 0);
            fde_polygon.ExteriorRing.AppendPoint(fde_point);

            fde_point.SetCoords(point.X + 10, point.Y + 10, point.Z, 0, 0);
            fde_polygon.ExteriorRing.AppendPoint(fde_point);

            fde_point.SetCoords(point.X, point.Y + 10, point.Z, 0, 0);
            fde_polygon.ExteriorRing.AppendPoint(fde_point);

            surfaceSymbol       = new SurfaceSymbolClass();
            surfaceSymbol.Color = 0xFF0000FF;  // 蓝色

            rpolygon = _axRenderControl.ObjectManager.CreateRenderPolygon(fde_polygon, surfaceSymbol);

            _axRenderControl.Camera.FlyToObject(rpolygon.Guid, i3dActionCode.i3dActionFlyTo);
        }
Exemplo n.º 4
0
        public static void TestDrawTriMesh(IModelPoint mp, IModel model)
        {
            ISurfaceSymbol symbol = (SurfaceSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("4D5F0624-50A1-43E2-A0EC-A9713CB25608")));

            symbol.Color = 0xff0000ff;
            ICurveSymbol symbol2 = (CurveSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("E02C69C4-828D-40D5-869D-DAEB189B7F6F")));

            symbol2.Color         = 0xffff0000;
            symbol.BoundarySymbol = symbol2;
            IMultiPolygon multiPolygon = geoFactory.CreateGeometry(gviGeometryType.gviGeometryMultiPolygon, gviVertexAttribute.gviVertexAttributeZ) as IMultiPolygon;

            if (multiPolygon != null)
            {
                IPolygon geometry   = null;
                IPoint   pointValue = null;
                for (int i = 0; i < model.GroupCount; i++)
                {
                    IDrawGroup group = model.GetGroup(i);
                    for (int j = 0; j < group.PrimitiveCount; j++)
                    {
                        IDrawPrimitive primitive = group.GetPrimitive(j);
                        for (int k = 0; k < (primitive.IndexArray.Length / 3); k++)
                        {
                            geometry     = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
                            pointValue   = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[k * 3] * 3];
                            pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[k * 3] * 3) + 1];
                            pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[k * 3] * 3) + 2];
                            geometry.ExteriorRing.AppendPoint(pointValue);
                            pointValue   = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[(k * 3) + 1] * 3];
                            pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 1] * 3) + 1];
                            pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 1] * 3) + 2];
                            geometry.ExteriorRing.AppendPoint(pointValue);
                            pointValue   = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[(k * 3) + 2] * 3];
                            pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 2] * 3) + 1];
                            pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 2] * 3) + 2];
                            geometry.ExteriorRing.AppendPoint(pointValue);
                            geometry.Close();
                            multiPolygon.AddGeometry(geometry);
                        }
                    }
                }
                IRenderMultiPolygon item = Ocx.ObjectManager.CreateRenderMultiPolygon(multiPolygon, symbol, Ocx.ProjectTree.RootID);
                item.MaxVisibleDistance = 5000000.0;
                tmpList.Add(item);
            }
        }
Exemplo n.º 5
0
        private FrmNormalRegionQuery()
        {
            InitializeComponent();
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                this.Enabled = false; return;
            }
            this._3DControl                    = app.Current3DMapControl;
            this._curveSymbol                  = new CurveSymbol();
            this._curveSymbol.Width            = -2;
            this._curveSymbol.Color            = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
            this._surfaceSymbol                = new SurfaceSymbol();
            this._surfaceSymbol.Color          = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
            this._surfaceSymbol.BoundarySymbol = this._curveSymbol;
        }
Exemplo n.º 6
0
        public PolygonRenderForm(IGeometryRender geoRender, object[] fieldNamesItems)
        {
            InitializeComponent();

            {
                this.comboBox1.Items.AddRange(fieldNamesItems);
                this.comboBox1.Text = "";

                if (geoRender != null)
                {
                    int index = Utils.getIndexFromItems(fieldNamesItems, geoRender.RenderGroupField);
                    this.comboBox1.SelectedIndex = index;
                }
            }

            ISimpleGeometryRender render = geoRender as ISimpleGeometryRender;

            if (render == null || render.Symbol == null)
            {
                ISurfaceSymbol tmpSurfaceSymbol = new SurfaceSymbol();
                string[]       row1             = new string[] { "Color", tmpSurfaceSymbol.Color.ToString() };
                string[]       row2             = new string[] { "EnableLight", tmpSurfaceSymbol.EnableLight.ToString() };
                string[]       row3             = new string[] { "RepeatLengthU", tmpSurfaceSymbol.RepeatLengthU.ToString() };
                string[]       row4             = new string[] { "RepeatLengthV", tmpSurfaceSymbol.RepeatLengthV.ToString() };
                string[]       row5             = new string[] { "Rotation", tmpSurfaceSymbol.Rotation.ToString() };
                ICurveSymbol   tmpCurveSymbol   = new CurveSymbol();
                string[]       row6             = new string[] { "BoundaryColor", tmpCurveSymbol.Color.ToString() };
                string[]       row7             = new string[] { "RepeatLength", tmpCurveSymbol.RepeatLength.ToString() };
                string[]       row8             = new string[] { "Width", tmpCurveSymbol.Width.ToString() };
                object[]       rows             = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
                return;
            }

            if (render.Symbol == null)
            {
                this.textBoxSurfacePictureName.Text = "";
                return;
            }

            {
                ISurfaceSymbol surfaceSymbol  = render.Symbol as ISurfaceSymbol;
                ICurveSymbol   boundarySymbol = surfaceSymbol.BoundarySymbol as ICurveSymbol;
                if (boundarySymbol != null)
                {
                    string[] row1  = new string[] { "Color", surfaceSymbol.Color.ToString() };
                    string[] row2  = new string[] { "EnableLight", surfaceSymbol.EnableLight.ToString() };
                    string[] row3  = new string[] { "RepeatLengthU", surfaceSymbol.RepeatLengthU.ToString() };
                    string[] row4  = new string[] { "RepeatLengthV", surfaceSymbol.RepeatLengthV.ToString() };
                    string[] row5  = new string[] { "Rotation", surfaceSymbol.Rotation.ToString() };
                    string[] row6  = new string[] { "BoundaryColor", boundarySymbol.Color.ToString() };
                    string[] row7  = new string[] { "RepeatLength", boundarySymbol.RepeatLength.ToString() };
                    string[] row8  = new string[] { "Width", boundarySymbol.Width.ToString() };
                    object[] rows2 = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }
                    this.textBoxCurvePictureName.Text = boundarySymbol.ImageName;
                    this.textBoxCurvePicturePath.Text = boundarySymbol.ImageName;
                }
                else
                {
                    ICurveSymbol boundarySymbolNew = new CurveSymbol();
                    string[]     row1  = new string[] { "Color", surfaceSymbol.Color.ToString() };
                    string[]     row2  = new string[] { "EnableLight", surfaceSymbol.EnableLight.ToString() };
                    string[]     row3  = new string[] { "RepeatLengthU", surfaceSymbol.RepeatLengthU.ToString() };
                    string[]     row4  = new string[] { "RepeatLengthV", surfaceSymbol.RepeatLengthV.ToString() };
                    string[]     row5  = new string[] { "Rotation", surfaceSymbol.Rotation.ToString() };
                    string[]     row6  = new string[] { "BoundaryColor", boundarySymbolNew.Color.ToString() };
                    string[]     row7  = new string[] { "RepeatLength", boundarySymbolNew.RepeatLength.ToString() };
                    string[]     row8  = new string[] { "Width", boundarySymbolNew.Width.ToString() };
                    object[]     rows2 = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }
                    this.textBoxCurvePictureName.Text = "";
                    this.textBoxCurvePicturePath.Text = "";
                }

                this.textBoxSurfacePictureName.Text = surfaceSymbol.ImageName;
                this.textBoxSurfacePicturePath.Text = surfaceSymbol.ImageName;
            }
        }
Exemplo n.º 7
0
        void axRenderControl1_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            if (PickResult.Type == gviObjectType.gviObjectLabel)
            {
                ILabelPickResult tlpr = PickResult as ILabelPickResult;
                gviObjectType    type = tlpr.Type;
                ILabel           fl   = tlpr.Label;
                MessageBox.Show("拾取到" + type + "类型,内容为" + fl.Text);
            }
            else if (PickResult.Type == gviObjectType.gviObjectRenderModelPoint)
            {
                IRenderModelPointPickResult tlpr = PickResult as IRenderModelPointPickResult;
                gviObjectType     type           = tlpr.Type;
                IRenderModelPoint fl             = tlpr.ModelPoint;
                MessageBox.Show("拾取到" + type + "类型,模型名称为" + fl.ModelName);
            }
            else if (PickResult.Type == gviObjectType.gviObjectRenderPoint)
            {
                IRenderPointPickResult tlpr = PickResult as IRenderPointPickResult;
                gviObjectType          type = tlpr.Type;
                IRenderPoint           fl   = tlpr.Point;
                MessageBox.Show("拾取到" + type + "类型,大小为" + fl.Symbol.Size);
            }
            else if (PickResult.Type == gviObjectType.gviObjectRenderPolyline)
            {
                IRenderPolylinePickResult tlpr = PickResult as IRenderPolylinePickResult;
                gviObjectType             type = tlpr.Type;
                IRenderPolyline           fl   = tlpr.Polyline;
                MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid);
            }
            else if (PickResult.Type == gviObjectType.gviObjectRenderPolygon)
            {
                IRenderPolygonPickResult tlpr = PickResult as IRenderPolygonPickResult;
                gviObjectType            type = tlpr.Type;
                IRenderPolygon           fl   = tlpr.Polygon;
                MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid);
            }
            else if (PickResult.Type == gviObjectType.gviObjectRenderPOI)
            {
                IRenderPOIPickResult tlpr = PickResult as IRenderPOIPickResult;
                gviObjectType        type = tlpr.Type;
                IRenderPOI           fl   = tlpr.POI;
                MessageBox.Show("拾取到" + type + "类型,名称为" + ((IPOI)fl.GetFdeGeometry()).Name);
            }
            else if (PickResult.Type == gviObjectType.gviObjectTerrainRegularPolygon)
            {
                ITerrainRegularPolygonPickResult regPolygonPick = PickResult as ITerrainRegularPolygonPickResult;
                gviObjectType          type       = regPolygonPick.Type;
                ITerrainRegularPolygon regPolygon = regPolygonPick.TerrainRegularPolygon;
                MessageBox.Show("拾取到" + type + "类型,geometryCount为" + regPolygon.GetFdeGeometry().GeometryType);
            }
            else if (PickResult.Type == gviObjectType.gviObjectTerrainArrow)
            {
                ITerrainArrowPickResult arrowPickResult = PickResult as ITerrainArrowPickResult;
                gviObjectType           type            = arrowPickResult.Type;
                ITerrainArrow           arrow           = arrowPickResult.TerrainArrow;
                MessageBox.Show("拾取到" + type + "类型,geometryType" + arrow.GetFdeGeometry().GeometryType);
            }
            else if (PickResult.Type == gviObjectType.gviObjectReferencePlane)
            {
                switch (this.toolStripComboBoxObjectManager.Text)
                {
                case "CreateLabel":
                {
                    label                     = this.axRenderControl1.ObjectManager.CreateLabel(rootId);
                    label.Text                = "我是testlabel";
                    label.Position            = IntersectPoint;
                    textSymbol                = new TextSymbol();
                    textAttribute             = new TextAttribute();
                    textAttribute.TextColor   = System.Drawing.Color.Yellow;
                    textAttribute.TextSize    = 20;
                    textAttribute.Underline   = true;
                    textAttribute.Font        = "楷体";
                    textSymbol.TextAttribute  = textAttribute;
                    textSymbol.VerticalOffset = 10;
                    textSymbol.DrawLine       = true;
                    textSymbol.MarginColor    = System.Drawing.Color.Yellow;
                    label.TextSymbol          = textSymbol;
                    this.axRenderControl1.Camera.FlyToObject(label.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateRenderModelPoint":
                {
                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }

                    string tmpOSGPath = (strMediaPath + @"\osg\Buildings\Apartment\Apartment.osg");
                    fde_modelpoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint,
                                                             gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                    fde_modelpoint.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_modelpoint.ModelName = tmpOSGPath;
                    rmodelpoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(fde_modelpoint, null, rootId);
                    rmodelpoint.MaxVisibleDistance = double.MaxValue;
                    rmodelpoint.MinVisiblePixels   = 0;
                    rmodelpoint.ShowOutline        = checkShowOutline.Checked;
                    IEulerAngle angle = new EulerAngle();
                    angle.Set(0, -20, 0);
                    this.axRenderControl1.Camera.LookAt(IntersectPoint.Position, 100, angle);
                }
                break;

                case "CreateRenderPoint":
                {
                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }

                    fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                                gviVertexAttribute.gviVertexAttributeZ);
                    fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);

                    pointSymbol           = new SimplePointSymbol();
                    pointSymbol.FillColor = System.Drawing.Color.Red;
                    pointSymbol.Size      = 10;
                    rpoint             = this.axRenderControl1.ObjectManager.CreateRenderPoint(fde_point, pointSymbol, rootId);
                    rpoint.ShowOutline = checkShowOutline.Checked;
                    this.axRenderControl1.Camera.FlyToObject(rpoint.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateRenderPolyline":
                {
                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }

                    fde_polyline = (IPolyline)gfactory.CreateGeometry(gviGeometryType.gviGeometryPolyline,
                                                                      gviVertexAttribute.gviVertexAttributeZ);
                    fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                                gviVertexAttribute.gviVertexAttributeZ);
                    fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_polyline.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_polyline.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y + 20, IntersectPoint.Z, 0, 0);
                    fde_polyline.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y + 20, IntersectPoint.Z + 20, 0, 0);
                    fde_polyline.AppendPoint(fde_point);

                    lineSymbol            = new CurveSymbol();
                    lineSymbol.Color      = System.Drawing.Color.Red;     // 紫红色
                    rpolyline             = this.axRenderControl1.ObjectManager.CreateRenderPolyline(fde_polyline, lineSymbol, rootId);
                    rpolyline.ShowOutline = checkShowOutline.Checked;
                    this.axRenderControl1.Camera.FlyToObject(rpolyline.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateRenderPolygon":
                {
                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }

                    fde_polygon = (IPolygon)gfactory.CreateGeometry(gviGeometryType.gviGeometryPolygon,
                                                                    gviVertexAttribute.gviVertexAttributeZ);

                    fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                                gviVertexAttribute.gviVertexAttributeZ);
                    fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_polygon.ExteriorRing.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X + 10, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_polygon.ExteriorRing.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X + 10, IntersectPoint.Y + 10, IntersectPoint.Z, 0, 0);
                    fde_polygon.ExteriorRing.AppendPoint(fde_point);
                    fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y + 10, IntersectPoint.Z, 0, 0);
                    fde_polygon.ExteriorRing.AppendPoint(fde_point);

                    surfaceSymbol        = new SurfaceSymbol();
                    surfaceSymbol.Color  = System.Drawing.Color.Blue;         // 蓝色
                    rpolygon             = this.axRenderControl1.ObjectManager.CreateRenderPolygon(fde_polygon, surfaceSymbol, rootId);
                    rpolygon.ShowOutline = checkShowOutline.Checked;
                    this.axRenderControl1.Camera.FlyToObject(rpolygon.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateRenderPOI":
                {
                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }

                    fde_poi = (IPOI)gfactory.CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ);
                    fde_poi.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_poi.ImageName = "#(1)";
                    fde_poi.Name      = (++poiCount).ToString();
                    fde_poi.Size      = 50;
                    rpoi             = this.axRenderControl1.ObjectManager.CreateRenderPOI(fde_poi);
                    rpoi.ShowOutline = checkShowOutline.Checked;
                    this.axRenderControl1.Camera.FlyToObject(rpoi.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateFixedBillboard":
                {
                    TextAttribute ta = new TextAttribute();
                    ta.TextSize  = 10;
                    ta.TextColor = System.Drawing.Color.Yellow;
                    IImage image     = null;
                    IModel model     = null;
                    string imageName = "";
                    this.axRenderControl1.Utility.CreateFixedBillboard("I'm fixed billboard!", ta, 50, 100, true, out model, out image, out imageName);
                    this.axRenderControl1.ObjectManager.AddModel("fixedModel", model);
                    this.axRenderControl1.ObjectManager.AddImage(imageName, image);

                    if (gfactory == null)
                    {
                        gfactory = new GeometryFactory();
                    }
                    fde_modelpoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint,
                                                             gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                    fde_modelpoint.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0);
                    fde_modelpoint.ModelName = "fixedModel";
                    rmodelpoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(fde_modelpoint, null, rootId);
                    rmodelpoint.MaxVisibleDistance = double.MaxValue;
                    rmodelpoint.MinVisiblePixels   = 0;
                    rmodelpoint.ShowOutline        = checkShowOutline.Checked;
                    IEulerAngle angle = new EulerAngle();
                    angle.Set(0, -20, 0);
                    this.axRenderControl1.Camera.LookAt(IntersectPoint.Position, 100, angle);
                }
                break;

                case "CreateRegularPolygon":
                {
                    IPosition pos = new Position();
                    pos.X        = IntersectPoint.X;
                    pos.Y        = IntersectPoint.Y;
                    pos.Altitude = IntersectPoint.Z;
                    ITerrainRegularPolygon regPolygon = this.axRenderControl1.ObjectManager.CreateRegularPolygon(pos, 10, 10, System.Drawing.Color.Red, System.Drawing.Color.White, rootId);
                    this.axRenderControl1.Camera.FlyToObject(regPolygon.Guid, gviActionCode.gviActionFlyTo);
                }
                break;

                case "CreateArrow":
                {
                    IPosition pos = new Position();
                    pos.X        = IntersectPoint.X;
                    pos.Y        = IntersectPoint.Y;
                    pos.Altitude = IntersectPoint.Z;
                    ITerrainArrow regArrow = this.axRenderControl1.ObjectManager.CreateArrow(pos, 30, 4, System.Drawing.Color.Red, System.Drawing.Color.White, rootId);
                    this.axRenderControl1.Camera.FlyToObject(regArrow.Guid, gviActionCode.gviActionFlyTo);
                }
                break;
                }
            }
        }
Exemplo n.º 8
0
        public static void TestDrawTriangle(double offX, double offY, double offZ, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, ISurfaceSymbol sfSymbol)
        {
            IPolygon polygon    = null;
            IPoint   pointValue = null;

            polygon      = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
            pointValue   = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            pointValue.X = offX + x1;
            pointValue.Y = offY + y1;
            pointValue.Z = offZ + z1;
            polygon.ExteriorRing.AppendPoint(pointValue);
            pointValue.X = offX + x2;
            pointValue.Y = offY + y2;
            pointValue.Z = offZ + z2;
            polygon.ExteriorRing.AppendPoint(pointValue);
            pointValue.X = offX + x3;
            pointValue.Y = offY + y3;
            pointValue.Z = offZ + z3;
            polygon.ExteriorRing.AppendPoint(pointValue);
            polygon.Close();
            IRenderPolygon item = Ocx.ObjectManager.CreateRenderPolygon(polygon, sfSymbol, Ocx.ProjectTree.RootID);

            item.MaxVisibleDistance = maxVisibleDis;
            tmpList.Add(item);
        }
Exemplo n.º 9
0
 public static void TestDrawPolygon(double offX, double offY, double offZ, double[] vtxs, ISurfaceSymbol sfSymbol)
 {
     if ((vtxs.Length >= 9) && ((vtxs.Length % 3) == 0))
     {
         IPolygon polygon    = null;
         IPoint   pointValue = null;
         polygon = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
         for (int i = 0; i < (vtxs.Length / 3); i++)
         {
             pointValue   = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
             pointValue.X = offX + vtxs[i * 3];
             pointValue.Y = offY + vtxs[(i * 3) + 1];
             pointValue.Z = offZ + vtxs[(i * 3) + 2];
             polygon.ExteriorRing.AppendPoint(pointValue);
         }
         if (!polygon.IsClosed)
         {
             polygon.Close();
         }
         IRenderPolygon item = Ocx.ObjectManager.CreateRenderPolygon(polygon, sfSymbol, Ocx.ProjectTree.RootID);
         item.MaxVisibleDistance = maxVisibleDis;
         tmpList.Add(item);
     }
 }