private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e) { myListNode item = (myListNode)e.Item; if (e.Item.Checked) { switch (item.type) { case TreeNodeType.NT_TERRAINLAYER: ITerrain ted = item.obj as ITerrain; ted.VisibleMask = gviViewportMask.gviViewAllNormalView; break; case TreeNodeType.NT_IMAGELAYER: IImageryLayer img = item.obj as IImageryLayer; img.VisibleMask = gviViewportMask.gviViewAllNormalView; break; } } else { switch (item.type) { case TreeNodeType.NT_TERRAINLAYER: ITerrain ted = item.obj as ITerrain; ted.VisibleMask = gviViewportMask.gviViewNone; break; case TreeNodeType.NT_IMAGELAYER: IImageryLayer img = item.obj as IImageryLayer; img.VisibleMask = gviViewportMask.gviViewNone; break; } } }
private void toolStripButtonAddImageryLayer_Click(object sender, System.EventArgs e) { try { OpenImageLayerForm form = new OpenImageLayerForm(); if (form.ShowDialog() == DialogResult.OK) { gviRasterSourceType selectType = gviRasterSourceType.gviRasterUnknown; if (form.Strtype.Equals("Image File")) { selectType = gviRasterSourceType.gviRasterSourceFile; } else if (form.Strtype.Equals("WMS")) { selectType = gviRasterSourceType.gviRasterSourceWMS; } else if (form.Strtype.Equals("WMTS")) { selectType = gviRasterSourceType.gviRasterSourceWMTS; } else if (form.Strtype.Equals("GeoRaster")) { selectType = gviRasterSourceType.gviRasterSourceGeoRaster; } else if (form.Strtype.Equals("MapServer")) { selectType = gviRasterSourceType.gviRasterSourceMapServer; } string cnnStr = this.axRenderControl1.ObjectManager.OpenRasterSourceDialog(selectType); //cnnStr为空,取消操作,关闭窗口 if (!cnnStr.Equals("")) { IImageryLayer imagelayer = this.axRenderControl1.ObjectManager.CreateImageryLayer(cnnStr, rootId); if (this.axRenderControl1.GetLastError() == 0) { if (imagelayer != null) { this.axRenderControl1.Camera.FlyToObject(imagelayer.Guid, gviActionCode.gviActionFlyTo); // 添加节点到界面控件上 myListNode item = new myListNode(cnnStr, TreeNodeType.NT_IMAGELAYER, imagelayer); item.Checked = true; listView1.Items.Add(item); } else { MessageBox.Show("ImageLayer Create Failed"); } } } } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
// Start is called before the first frame update void Awake() { map = new GameObject("Map"); //centre the map and mapHolder map.transform.position = new Vector3(0, 0, 0); MapHolder.transform.position = new Vector3(0, 0, 0); map.AddComponent <AbstractMap>(); MapOptions options = map.GetComponent <AbstractMap>().Options; options.locationOptions.latitudeLongitude = location; options.locationOptions.zoom = zoom; options.scalingOptions.unityTileSize = plotScale; IImageryLayer image = map.GetComponent <AbstractMap>().ImageLayer; image.SetLayerSource(ImagerySourceType.MapboxDark); IVectorDataLayer layer = map.GetComponent <AbstractMap>().VectorData; layer.SetLayerSource(VectorSourceType.MapboxStreets); layer.AddPolygonFeatureSubLayer("buildings", "building"); layer.FindFeatureSubLayerWithName("buildings").materialOptions.SetStyleType(StyleTypes.Light); if (enable3DTerrain) { ITerrainLayer terrain = map.GetComponent <AbstractMap>().Terrain; terrain.SetElevationType(ElevationLayerType.LowPolygonTerrain); } map.transform.parent = MapHolder.transform; map.GetComponent <AbstractMap>().SetPlacementType(MapPlacementType.AtTileCenter); InitalizeInteraction(); if (!String.IsNullOrEmpty(titleName) && Text != null) { GameObject title = Instantiate(Text, new Vector3(0, 2.5f, 0) * plotScale, Quaternion.identity); //place title so it is just above plot title.transform.position = title.transform.position + new Vector3(0, title.GetComponent <Renderer>().bounds.size.y / 2, 0) * plotScale; //add title title.transform.parent = MapHolder.transform; title.GetComponent <TextMesh>().text = titleName; title.transform.name = "title"; //scale the size of text depending on PlotScale title.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f) * plotScale; //place title so it is just above plot title.transform.position = title.transform.position + new Vector3(0, title.GetComponent <Renderer>().bounds.size.y / 2, 0); } map.AddComponent <HistoGramOnMap>(); map.GetComponent <HistoGramOnMap>().locationStrings = locationStrings; map.GetComponent <HistoGramOnMap>().heightValues = heightValues; map.GetComponent <HistoGramOnMap>().colours = colours; map.GetComponent <HistoGramOnMap>().spawnScale = spawnScale; map.GetComponent <HistoGramOnMap>().HeightScaleMax = HeightScaleMax; map.GetComponent <HistoGramOnMap>().HeightScaleMin = HeightScaleMin; map.GetComponent <HistoGramOnMap>().map = map.GetComponent <AbstractMap>(); }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (this.listView1.SelectedItems.Count == 0) { return; } myListNode item = (myListNode)this.listView1.SelectedItems[0]; item.Checked = true; switch (item.type) { case TreeNodeType.NT_TERRAINLAYER: this.axRenderControl1.Terrain.FlyTo(gviTerrainActionCode.gviFlyToTerrain); break; case TreeNodeType.NT_IMAGELAYER: IImageryLayer img = item.obj as IImageryLayer; this.axRenderControl1.Camera.FlyToObject(img.Guid, gviActionCode.gviActionFlyTo); break; } }
private void MainForm_Load(object sender, System.EventArgs e) { // 初始化RenderControl控件 IPropertySet ps = new PropertySet(); ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL); this.axRenderControl1.Initialize(true, ps); rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID; // 设置天空盒 if (System.IO.Directory.Exists(strMediaPath)) { string tmpSkyboxPath = strMediaPath + @"\skybox"; ISkyBox skybox = this.axRenderControl1.ObjectManager.GetSkyBox(0); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBack, tmpSkyboxPath + "\\1_BK.jpg"); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBottom, tmpSkyboxPath + "\\1_DN.jpg"); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageFront, tmpSkyboxPath + "\\1_FR.jpg"); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageLeft, tmpSkyboxPath + "\\1_LF.jpg"); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageRight, tmpSkyboxPath + "\\1_RT.jpg"); skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageTop, tmpSkyboxPath + "\\1_UP.jpg"); } else { MessageBox.Show("请不要随意更改SDK目录名"); return; } this.axRenderControl1.Camera.FlyTime = 0; // 注册地形 string tmpTedPath = (strMediaPath + @"\terrain\world.ted"); this.axRenderControl1.Terrain.RegisterTerrain(tmpTedPath, ""); this.axRenderControl1.Terrain.FlyTo(gviTerrainActionCode.gviFlyToTerrain); // 添加节点到界面控件上 myListNode item = new myListNode("world", TreeNodeType.NT_TERRAINLAYER, this.axRenderControl1.Terrain); item.Checked = true; listView1.Items.Add(item); // 创建影像图层 string tmpImageryPath = (strMediaPath + @"\imagery\jk1.tif"); IImageryLayer imagelayer = this.axRenderControl1.ObjectManager.CreateImageryLayer(tmpImageryPath, rootId); this.axRenderControl1.Camera.FlyToObject(imagelayer.Guid, gviActionCode.gviActionFlyTo); // 添加节点到界面控件上 item = new myListNode("jk1", TreeNodeType.NT_IMAGELAYER, imagelayer); item.Checked = true; listView1.Items.Add(item); IRasterSourceFactory rasFac = new RasterSourceFactory(); IRasterSource source = rasFac.OpenRasterSource(@"http://192.168.2.254:6163/igs/rest/ogc/WMTSServer/1.0.0/WMTSCapabilities.xml", gviRasterConnectionType.gviRasterConnectionWMTS); if (source != null) { string[] names = source.GetRasterNames(); for (int n = 0; n < names.Length; n++) { IRaster raster = source.OpenRaster(names[n]); IImageryLayer imagelayer2 = this.axRenderControl1.ObjectManager.CreateImageryLayer(raster.ConnStr, rootId); // 添加节点到界面控件上 item = new myListNode(raster.Name, TreeNodeType.NT_IMAGELAYER, imagelayer2); item.Checked = true; listView1.Items.Add(item); } } { this.helpProvider1.SetShowHelp(this.axRenderControl1, true); this.helpProvider1.SetHelpString(this.axRenderControl1, ""); this.helpProvider1.HelpNamespace = "ImageryLayer.html"; } }