예제 #1
0
        public ModelPointRenderForm(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)
            {
                IModelPointSymbol tmpSymbol = new ModelPointSymbol();
                string[]          row1      = new string[] { "Color", tmpSymbol.Color.ToString() };
                string[]          row2      = new string[] { "EnableColor", tmpSymbol.EnableColor.ToString() };
                string[]          row3      = new string[] { "EnableTexture ", tmpSymbol.EnableTexture.ToString() };
                object[]          rows      = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
                return;
            }

            if (render.Symbol == null)
            {
                return;
            }

            {
                IModelPointSymbol symbol = render.Symbol as IModelPointSymbol;
                string[]          row1   = new string[] { "Color", symbol.Color.ToString() };
                string[]          row2   = new string[] { "EnableColor", symbol.EnableColor.ToString() };
                string[]          row3   = new string[] { "EnableTexture ", symbol.EnableTexture.ToString() };
                object[]          rows   = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
            }
        }
예제 #2
0
 public static void TestDrawModel(IModelPoint mp, IModel model, List <string> filesPath)
 {
     if ((mp != null) && (model != null))
     {
         string str      = Application.StartupPath + @"\..\temp";
         string str2     = Path.Combine(str, "osg");
         string filePath = string.Format(@"{0}\{1}.osg", str2, mp.ModelName);
         if (!Directory.Exists(str))
         {
             Directory.CreateDirectory(str);
         }
         if (!Directory.Exists(str2))
         {
             Directory.CreateDirectory(str2);
         }
         IPropertySet images = null;
         IImage       image  = null;
         string       key    = string.Empty;
         images = new PropertySetClass();
         if (filesPath != null)
         {
             foreach (string str5 in filesPath)
             {
                 if (File.Exists(str5) || Directory.Exists(str5))
                 {
                     key   = Path.GetFileNameWithoutExtension(str5);
                     image = resFactory.CreateImageFromFile(str5);
                     images.SetProperty(key, image);
                 }
             }
         }
         model.WriteFile(filePath, images);
         IModelPointSymbol symbol = (ModelPointSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("6BCF8C9B-E506-43AE-AD6E-44A41D748431")));
         symbol.Color     = 0xaaaaaaaa;
         mp.ModelName     = filePath;
         mp.ModelEnvelope = model.Envelope;
         IRenderModelPoint item = Ocx.ObjectManager.CreateRenderModelPoint(mp, symbol, Ocx.ProjectTree.RootID);
         item.MaxVisibleDistance = 500000.0;
         tmpList.Add(item);
         Ocx.Camera.LookAtEnvelope(item.Envelope);
     }
 }