Пример #1
0
 //左键单击
 bool sgworld_OnLButtonDown(int Flags, int X, int Y)
 {
     try
     {
         if (pbhander == "modify")
         {
             LClickCount++;
             //点击三个点以前画线,三个点以后画面
             double longitude, latitude, height;
             (this.TerraExplorer as IRender5).ScreenToTerrain(X, Y, out longitude, out latitude, out height);
             IPosition61 pIPosition = this.SgWorld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_RELATIVE);
             if (LClickCount < 3)
             {
                 this.pITerrainPolyline.AddVertex(longitude, height, latitude, 0);
                 ListVerticsArray.Add(longitude);
                 ListVerticsArray.Add(latitude);
                 ListVerticsArray.Add(pIPosition.Distance);
             }
             else
             {
                 if (LClickCount == 3)
                 {
                     ListVerticsArray.Add(longitude);
                     ListVerticsArray.Add(latitude);
                     ListVerticsArray.Add(pIPosition.Distance);
                     double[] tripletArray = new double[ListVerticsArray.Count];
                     ListVerticsArray.CopyTo(tripletArray, 0);
                     IColor61         LineColor         = this.SgWorld.Creator.CreateColor(Color.Red.R, Color.Red.G, Color.Red.B, Color.Red.A);
                     IColor61         FillColor         = this.SgWorld.Creator.CreateColor(Color.Red.R, Color.Red.G, Color.Red.B, 0);
                     AltitudeTypeCode eAltitudeTypeCode = AltitudeTypeCode.ATC_TERRAIN_RELATIVE;
                     pITerrainPolygon = this.SgWorld.Creator.CreatePolygonFromArray(tripletArray, LineColor, FillColor, eAltitudeTypeCode, GroupID, "TempPolygon");
                     this.SgWorld.ProjectTree.DeleteItem(this.pITerrainPolyline.InfoTreeItemID);
                 }
                 else
                 {
                     if (pITerrainPolygon != null)
                     {
                         IPolygon pPolygon = pITerrainPolygon.Geometry as IPolygon;
                         pPolygon.StartEdit();
                         foreach (ILinearRing r in pPolygon.Rings)
                         {
                             r.Points.AddPoint(longitude, latitude, pIPosition.Distance);
                         }
                         pITerrainPolygon.Geometry = pPolygon.EndEdit();
                     }
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("地形调整范围绘制失败!");
     }
     return(true);
 }
Пример #2
0
 //透明度调整
 private void zoomOpacity_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (this.CurrentControlHeight != null)
         {
             int      Alpha     = (int)(255 * (this.zoomOpacity.Value / 100.0));
             IColor61 FillColor = Program.pCreator6.CreateColor(this.colorEditLmtHeight.Color.R, this.colorEditLmtHeight.Color.G,
                                                                this.colorEditLmtHeight.Color.B, Alpha);
             this.CurrentControlHeight.FillStyle.Color = FillColor;
         }
     }
     catch
     {
         MessageBox.Show("透明度调整失败!");
     }
 }
Пример #3
0
        //右键结束画面,同时根据设置生成限高面
        void TE_OnRButtonDown(int Flags, int X, int Y, ref object pbHandled)
        {
            if (StartDraw)
            {
                try
                {
                    StartDraw = false;
                    pbHandled = true;
                    Program.pRender.SetMouseInputMode(MouseInputMode.MI_FREE_FLIGHT);
                    Program.sgworld.ProjectTree.DeleteItem(this.polyLine.InfoTreeItemID);

                    IColor61 LineColor = Program.pCreator6.CreateColor(this.colorEditLmtHeight.Color.R, this.colorEditLmtHeight.Color.G,
                                                                       this.colorEditLmtHeight.Color.B, this.colorEditLmtHeight.Color.A);
                    int      Alpha     = (int)(255 * (this.zoomOpacity.Value / 100.0));
                    IColor61 FillColor = Program.pCreator6.CreateColor(this.colorEditLmtHeight.Color.R, this.colorEditLmtHeight.Color.G,
                                                                       this.colorEditLmtHeight.Color.B, Alpha);
                    if (list != null)
                    {
                        if (list.Count > 2)
                        {
                            double[] tripletArray = new double[list.Count];
                            list.CopyTo(tripletArray, 0);
                            CurrentControlHeight = Program.pCreator6.CreatePolygonFromArray(tripletArray, LineColor, FillColor, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, GroupID, "Controlheight");
                            list.Clear();
                            this.simpleBtnClear.Enabled = true;
                        }
                        else
                        {
                            MessageBox.Show("至少绘制三个点!");
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("绘制失败!");
                    list.Clear();
                    if (this.polyLine.NumOfVertices > 0)
                    {
                        for (int i = this.polyLine.NumOfVertices; i > 0; i--)
                        {
                            this.polyLine.DeleteVertex(i);
                        }
                    }
                }
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string          s1          = textBox1.Text;
            string          s2          = textBox2.Text;
            string          s3          = textBox3.Text;
            string          s4          = textBox4.Text;
            string          s5          = textBox4.Text + "\r\n" + textBox5.Text;
            string          mes         = String.Empty;
            IPosition61     cpos        = null;
            ILabelStyle61   clabelstyle = null;
            ITerrainLabel61 ctextlabel  = null;

            try
            {
                double           dxcoord  = double.Parse(s1);
                double           dycoord  = double.Parse(s2);
                double           altitude = double.Parse(s3);
                AltitudeTypeCode ealit    = AltitudeTypeCode.ATC_TERRAIN_RELATIVE;
                cpos = MainForm.sgworld.Creator.CreatePosition(dxcoord, dycoord, altitude, ealit, -30, -30, 0.0, 10000);
                {
                    SGLabelStyle elabelstyle = SGLabelStyle.LS_DEFAULT;
                    clabelstyle = MainForm.sgworld.Creator.CreateLabelStyle(elabelstyle);
                    {
                        double   alpha       = 0.5;
                        IColor61 cbackground = clabelstyle.BackgroundColor;
                        cbackground.FromBGRColor(nrgb);
                        cbackground.SetAlpha(alpha);
                        clabelstyle.FontName = "Arial";
                        clabelstyle.FontSize = 50;
                        clabelstyle.TextColor.FromABGRColor(nrgb);
                        clabelstyle.Italic = true;
                        clabelstyle.Scale  = 3;
                        ctextlabel         = MainForm.sgworld.Creator.CreateTextLabel(cpos, s5, clabelstyle, 0, s4);
                        IPosition61 cflypos = cpos.Copy();
                        cflypos.Pitch = -30.0;
                        MainForm.sgworld.Navigate.FlyTo(cflypos, ActionCode.AC_FLYTO);
                    }
                }
            }
            catch (Exception ex)
            {
                mes = String.Format("CreateLabelButton_Click Exception :{0}", ex.Message);
                Log4NetHelper.WriteLog(typeof(LabelForm), ex);
                MessageBox.Show(mes);
            }
        }