Esempio 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);
            }
        }
Esempio n. 2
0
        public void DisplayModel(ITabContentHost targetWindow, IRenderGeometry model, string fileName)
        {
            var container = targetWindow.DocumentPanel;

            LogOutput($"Loading model: {fileName}");

            try
            {
                var viewer = new Controls.DXViewer
                {
                    LogOutput   = LogOutput,
                    LogError    = LogError,
                    SetStatus   = SetWorkingStatus,
                    ClearStatus = ClearWorkingStatus
                };

                viewer.LoadGeometry(model, $"{fileName}");

                container.AddItem(viewer.TabModel);

                LogOutput($"Loaded model: {fileName}");
            }
            catch (Exception e)
            {
                LogError($"Error loading model: {fileName}", e);
            }
        }
Esempio n. 3
0
        public void GeometryEditStart(DF3DFeatureClass fcInfo, IRenderGeometry renderGeo, gviGeoEditType editType)
        {
            if (this._app == null || this._app.Current3DMapControl == null)
            {
                return;
            }
            if (this._geoEditor.IsEditing)
            {
                this.StopEdit(true);
            }
            this.curGeoField     = fcInfo.GetFeatureLayer().GeometryFieldName;
            this._renderGeometry = renderGeo;
            this._FeatureClass   = fcInfo;
            Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = fcInfo.GetFeatureClass();
            this._row = featureClass.CreateRowBuffer();
            int num = this._row.FieldIndex(this.curGeoField);

            if (num != -1 && this._renderGeometry != null)
            {
                this._row.SetValue(num, this._renderGeometry.GetFdeGeometry());
            }
            this._geoEditType   = editType;
            this._InteractaMode = this._app.Current3DMapControl.InteractMode;
            this._app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit;
            if (!this._geoEditor.StartEditRenderGeometry(renderGeo, editType))
            {
                this._app.Current3DMapControl.InteractMode = this._InteractaMode;
                XtraMessageBox.Show("暂不支持该类型的编辑");
            }
            //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
        }
Esempio n. 4
0
        private void ExportBitmaps(IRenderGeometry geometry, Func <IRenderGeometry, IEnumerable <IBitmap> > getBitmaps)
        {
            string folder;

            if (!getDataFolderFunc(out folder))
            {
                return;
            }

            Task.Run(() =>
            {
                foreach (var bitm in getBitmaps(geometry))
                {
                    try
                    {
                        SetWorkingStatus($"Extracting {bitm.Name}");
                        saveImageFunc(bitm, folder);
                        LogOutput($"Extracted {bitm.Name}.{bitm.Class}");
                    }
                    catch (Exception ex)
                    {
                        LogError($"Error extracting {bitm.Name}.{bitm.Class}", ex, true);
                    }
                }

                ClearWorkingStatus();
                LogOutput($"Recursive bitmap extract complete for {geometry.Name}.{geometry.Class}");
            });
        }
Esempio n. 5
0
        public void DisplayModel(ITabContentHost targetWindow, IRenderGeometry model, string fileName)
        {
            var tabId = $"{Key}::{model.SourceFile}::{model.Id}";

            if (Substrate.ShowTabById(tabId))
            {
                return;
            }

            var container = targetWindow.DocumentPanel;

            LogOutput($"Loading model: {fileName}");

            try
            {
                var viewer = new Controls.ModelViewer
                {
                    LogOutput   = LogOutput,
                    LogError    = LogError,
                    SetStatus   = SetWorkingStatus,
                    ClearStatus = ClearWorkingStatus
                };

                viewer.TabModel.ContentId = tabId;
                viewer.LoadGeometry(model, $"{fileName}");

                container.AddItem(viewer.TabModel);

                LogOutput($"Loaded model: {fileName}");
            }
            catch (Exception e)
            {
                LogError($"Error loading model: {fileName}", e, true);
            }
        }
Esempio n. 6
0
        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_TerrainModifier:
                ITerrainModifier modifier = item.obj as ITerrainModifier;
                modifier.Highlight(System.Drawing.Color.Yellow);
                this.axRenderControl1.Camera.FlyToObject(modifier.Guid, gviActionCode.gviActionFlyTo);
                break;

            case TreeNodeType.NT_RenderGeomtry:
                IRenderGeometry geo = item.obj as IRenderGeometry;
                this.axRenderControl1.Camera.FlyToObject(geo.Guid, gviActionCode.gviActionFlyTo);
                break;
            }
        }
Esempio n. 7
0
        private void toolStripButtonCreateCutFill_Click(object sender, System.EventArgs e)
        {
            if (currentRenderGeometry != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(currentRenderGeometry.Guid);
                currentRenderGeometry = null;
            }
            if (cutrmp != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(cutrmp.Guid);
                cutrmp = null;
            }
            if (fillrmp != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(fillrmp.Guid);
                fillrmp = null;
            }

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

            sf.Color = System.Drawing.Color.FromArgb(Convert.ToInt32("0x55ffff80", 16));
            ICurveSymbol cs = new CurveSymbol();

            cs.Color              = System.Drawing.Color.FromArgb(Convert.ToInt32("0x55ffff80", 16));
            sf.BoundarySymbol     = cs;
            currentRenderGeometry = this.axRenderControl1.ObjectManager.CreateRenderPolygon(currentGeometry as IPolygon, sf, rootId);
            (currentRenderGeometry as IRenderPolygon).HeightStyle = gviHeightStyle.gviHeightOnTerrain;
            this.axRenderControl1.InteractMode = gviInteractMode.gviInteractEdit;
            this.axRenderControl1.ObjectEditor.StartEditRenderGeometry(currentRenderGeometry, gviGeoEditType.gviGeoEditCreator);
        }
Esempio n. 8
0
 private void toolStripButtonDeleteHole_Click(object sender, EventArgs e)
 {
     this.axRenderControl1.Terrain.SetOceanRegion(null);
     if (this.currentRenderGeometry != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(currentRenderGeometry.Guid);
         this.currentRenderGeometry = null;
     }
 }
Esempio n. 9
0
        public void LoadGeometry(IRenderGeometry geometry, string fileName)
        {
            TabModel.ToolTip = fileName;
            TabModel.Header  = Utils.GetFileName(fileName);
            this.geometry    = geometry;

            AvailableLods = AllLods.Take(geometry.LodCount);
            SetLod(0);
        }
Esempio n. 10
0
 public void GeometryEditStart(IRenderGeometry renderGeo)
 {
     if (this._app == null || this._app.Current3DMapControl == null)
     {
         return;
     }
     this._isSpatialQuery = true;
     this._InteractaMode  = this._app.Current3DMapControl.InteractMode;
     this._app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit;
     this._geoEditor.StartEditRenderGeometry(renderGeo, gviGeoEditType.gviGeoEditCreator);
 }
Esempio n. 11
0
 private void Clear()
 {
     if (_rPolygon != null)
     {
         this._3DControl.ObjectManager.DeleteObject(_rPolygon.Guid);
         _rPolygon = null;
     }
     this._3DControl.HighlightHelper.VisibleMask = 0;
     this._3DControl.HighlightHelper.Color       = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
     this._3DControl.HighlightHelper.SetRegion(null);
 }
Esempio n. 12
0
        private bool SaveModel(IRenderGeometry geometry, string baseDir)
        {
            var fileName = MakePath(geometry.Class, geometry.Name, baseDir);
            var ext      = getModelExtensionFunc?.Value(Settings.ModelFormat);

            if (!Settings.OverwriteExisting && File.Exists($"{fileName}.{ext}"))
            {
                return(false);
            }

            writeModelFileFunc?.Invoke(geometry.ReadGeometry(0), fileName, Settings.ModelFormat);
            return(true);
        }
Esempio n. 13
0
        public static bool TryGetGeometryContent(Halo5.ModuleItem item, out IRenderGeometry content)
        {
            content = null;

            if (item.ClassCode != render_model)
            {
                return(false);
            }

            content = item.ReadMetadata <Halo5.render_model>();

            return(content != null);
        }
Esempio n. 14
0
        private void toolStripButtonCreateTerrainHole_Click(object sender, System.EventArgs e)
        {
            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);
        }
Esempio n. 15
0
        private void toolStripButtonCreateRenderArrow_Click(object sender, System.EventArgs e)
        {
            currentGeometry            = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
            currentGeometry.SpatialCRS = crs as ISpatialCRS;

            ICurveSymbol curveSym = new CurveSymbol();

            curveSym.Width        = -2;
            curveSym.Color        = System.Drawing.Color.Red;
            currentRenderGeometry = this.axRenderControl1.ObjectManager.CreateRenderPolyline(currentGeometry as IPolyline, curveSym, rootId);
            (currentRenderGeometry as IRenderPolyline).HeightStyle = gviHeightStyle.gviHeightOnTerrain;
            this.axRenderControl1.InteractMode = gviInteractMode.gviInteractEdit;
            this.axRenderControl1.ObjectEditor.StartEditRenderGeometry(currentRenderGeometry, gviGeoEditType.gviGeoEditCreator);
        }
Esempio n. 16
0
        private void sbtn_BrowseFile_Click(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Multiselect     = false;
            openFileDialog.CheckFileExists = true;
            openFileDialog.Filter          = "Shp File(*.shp)|*.shp";
            openFileDialog.DefaultExt      = ".shp";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string        fileName             = openFileDialog.FileName;
                IMultiPolygon multiPolygonFromFile = this.GetMultiPolygonFromFile(fileName);
                if (multiPolygonFromFile != null)
                {
                    IGeometryFactory geometryFactory = new GeometryFactoryClass();
                    IGeometry        geometry        = multiPolygonFromFile.Clone2(gviVertexAttribute.gviVertexAttributeNone);
                    ISurfaceSymbol   surfaceSymbol   = new SurfaceSymbolClass();
                    surfaceSymbol.Color          = 1442840448u;
                    surfaceSymbol.BoundarySymbol = new CurveSymbolClass
                    {
                        Color = 1442840448u
                    };
                    this._renderGeo = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(geometry as IMultiPolygon, surfaceSymbol, app.Current3DMapControl.ProjectTree.RootID);
                    int    lastError = app.Current3DMapControl.GetLastError();
                    string str       = string.Empty;
                    if (lastError != 0)
                    {
                        //str = Logger.GetRenderCtrlError(lastError);
                    }
                    if (this._renderGeo == null)
                    {
                        XtraMessageBox.Show("多边形创建失败!" + str);
                    }
                    else
                    {
                        app.Current3DMapControl.HighlightHelper.VisibleMask = 1;
                        app.Current3DMapControl.HighlightHelper.SetRegion(this._renderGeo.GetFdeGeometry());
                        app.Current3DMapControl.Camera.FlyToObject(this._renderGeo.Guid, gviActionCode.gviActionFlyTo);
                        this.textEdit_FilePath.Text = fileName;
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(multiPolygonFromFile);
                    }
                }
            }
        }
Esempio n. 17
0
        private void DeleteRenderGeo(ref IRenderGeometry renderGeo)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (renderGeo != null && System.Runtime.InteropServices.Marshal.IsComObject(renderGeo))
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(renderGeo.Guid);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(renderGeo);
                renderGeo = null;
            }
        }
Esempio n. 18
0
        public void LoadGeometry(IRenderGeometry geometry, string fileName)
        {
            TabModel.ToolTip = fileName;
            TabModel.Header  = Utils.GetFileName(fileName);

            ClearChildren();
            modelId = geometry.Id;
            modelFactory.LoadGeometry(geometry, true);

            AvailableLods = AllLods.Take(geometry.LodCount);
            SetLod(0);

            renderGeometry = geometry;
            IsExportable   = true;
        }
Esempio n. 19
0
        private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            myListNode item = (myListNode)e.Item;

            switch (item.type)
            {
            case TreeNodeType.NT_TiltedLAYER:
                I3DTileLayer ted = item.obj as I3DTileLayer;
                ted.VisibleMask = e.Item.Checked ? gviViewportMask.gviViewAllNormalView : gviViewportMask.gviViewNone;
                break;

            case TreeNodeType.NT_RenderGeomtry:
                IRenderGeometry geo = item.obj as IRenderGeometry;
                geo.VisibleMask = e.Item.Checked ? gviViewportMask.gviViewAllNormalView : gviViewportMask.gviViewNone;
                break;
            }
        }
Esempio n. 20
0
        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_TerrainModifier:
                    ITerrainModifier modifier = item.obj as ITerrainModifier;
                    modifier.VisibleMask = gviViewportMask.gviViewAllNormalView;
                    break;

                case TreeNodeType.NT_RenderGeomtry:
                    IRenderGeometry geo = item.obj as IRenderGeometry;
                    geo.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_TerrainModifier:
                    ITerrainModifier modifier = item.obj as ITerrainModifier;
                    modifier.VisibleMask = gviViewportMask.gviViewNone;
                    break;

                case TreeNodeType.NT_RenderGeomtry:
                    IRenderGeometry geo = item.obj as IRenderGeometry;
                    geo.VisibleMask = gviViewportMask.gviViewNone;
                    break;
                }
            }
        }
        private bool LoadRenderGeometry(IRenderGeometry geom, bool lods)
        {
            if (geometryCache.ContainsKey(geom.Id))
            {
                return(true);
            }

            try
            {
                var lodCount  = lods ? geom.LodCount : 1;
                var lodModels = Enumerable.Repeat(0, lodCount).Select(i => geom.ReadGeometry(i)).ToList();
                var col       = new TemplateCollection(this, lodModels);

                if (!geometryCache.TryAdd(geom.Id, col))
                {
                    return(true); //looks like another thread is already working on this model
                }
                foreach (var lod in lodModels)
                {
                    //cache all referenced textures
                    var matIndexes = lod.Meshes.SelectMany(m => m.Submeshes)
                                     .Select(m => m.MaterialIndex)
                                     .Where(i => i >= 0)
                                     .Distinct();

                    foreach (var index in matIndexes)
                    {
                        ReadTexture(lod.Materials[index]);
                    }
                }

                foreach (var lod in lodModels)
                {
                    lod.Dispose();
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Esempio n. 22
0
        /// <summary>
        /// 设置相机飞到或跟随模型的方式
        /// </summary>
        /// <param name="actionCode">方式</param>
        /// <param name="modelPoint">模型</param>
        private void SetFollowingPerspective(i3dActionCode actionCode, IRenderGeometry modelPoint)
        {
            if (modelPoint != null)
            {
                switch (actionCode)
                {
                case i3dActionCode.i3dActionFollowAbove:     // 上帝视角
                    modelPoint.ViewingDistance = 500;
                    break;

                case i3dActionCode.i3dActionFollowBehindAndAbove:      // 第三人称
                    modelPoint.ViewingDistance = 50;
                    break;

                default:
                    modelPoint.ViewingDistance = 100;
                    break;
                }
                _axRenderControl.Camera.FlyToObject(modelPoint.Guid, actionCode);
            }
        }
Esempio n. 23
0
        private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            myListNode item = (myListNode)e.Item;

            switch (item.type)
            {
            case TreeNodeType.NT_TERRAINLAYER:
                ITerrain ted = item.obj as ITerrain;
                ted.VisibleMask = e.Item.Checked ? gviViewportMask.gviViewAllNormalView : gviViewportMask.gviViewNone;
                break;

            case TreeNodeType.NT_TerrainHole:
                ITerrainHole hole = item.obj as ITerrainHole;
                hole.VisibleMask = e.Item.Checked ? gviViewportMask.gviViewAllNormalView : gviViewportMask.gviViewNone;
                break;

            case TreeNodeType.NT_RenderGeomtry:
                IRenderGeometry geo = item.obj as IRenderGeometry;
                geo.VisibleMask = e.Item.Checked ? gviViewportMask.gviViewAllNormalView : gviViewportMask.gviViewNone;
                break;
            }
        }
Esempio n. 24
0
        private void SetMakePolygonMode()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            this.textEdit_FilePath.Text = string.Empty;
            this.DeleteRenderGeo(ref this._renderGeo);
            app.Current3DMapControl.HighlightHelper.SetRegion(null);
            IGeometryFactory geometryFactory = new GeometryFactoryClass();

            if (this.radioGroup1.SelectedIndex == 1)
            {
                base.WindowState = System.Windows.Forms.FormWindowState.Minimized;
                this.textEdit_FilePath.Enabled = false;
                this.sbtn_BrowseFile.Enabled   = false;
                IPolygon polygon = geometryFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
                polygon.SpatialCRS = CommonUtils.Instance().GetCurrentFeatureDataset().SpatialReference;
                ISurfaceSymbol surfaceSymbol = new SurfaceSymbolClass();
                surfaceSymbol.Color          = 1442840448u;
                surfaceSymbol.BoundarySymbol = new CurveSymbolClass
                {
                    Color = 1442840448u
                };
                this._renderGeo = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, surfaceSymbol, app.Current3DMapControl.ProjectTree.RootID);
                GeometryEdit.Instance().GeometryEditStart(this._renderGeo);
            }
            else
            {
                if (this.radioGroup1.SelectedIndex == 0)
                {
                    this.textEdit_FilePath.Enabled = true;
                    this.sbtn_BrowseFile.Enabled   = true;
                }
            }
        }
Esempio n. 25
0
 private void toolStripButtonDeleteHole_Click(object sender, EventArgs e)
 {
     if (this.hole != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(this.hole.Guid);
         this.hole = null;
     }
     if (this.rpolygon != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(this.rpolygon.Guid);
         this.rpolygon = null;
     }
     if (this.rmpolygon != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(this.rmpolygon.Guid);
         this.rmpolygon = null;
     }
     if (this.currentRenderGeometry != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(currentRenderGeometry.Guid);
         this.currentRenderGeometry = null;
     }
 }
Esempio n. 26
0
        public void LoadGeometry(IIndexItem modelTag, string fileName)
        {
            if (!CanOpenTag(modelTag))
            {
                throw new NotSupportedException($"{modelTag.ClassName} tags are not supported.");
            }

            if (DirectContentTags.Any(t => modelTag.ClassCode.ToLower() == t))
            {
                IRenderGeometry geometry;
                if (ContentFactory.TryGetGeometryContent(modelTag, out geometry))
                {
                    LoadGeometry(geometry, fileName);
                    return;
                }
                else
                {
                    throw new ArgumentException($"Could not load geometry from tag", nameof(modelTag));
                }
            }

            TabModel.ToolTip = fileName;
            TabModel.Header  = Utils.GetFileName(fileName);

            ClearChildren();
            modelId = modelTag.Id;
            modelFactory.LoadTag(modelTag, false);

            element       = modelFactory.CreateObjectModel(modelId);
            AvailableLods = objectModel.Variants;
            modelGroup.Children.Add(element);
            SetVariant(Math.Max(0, AvailableLods.ToList().IndexOf(objectModel.DefaultVariant)));

            renderGeometry = null;
            IsExportable   = false;
        }
Esempio n. 27
0
        private void OnFinishedDraw()
        {
            try
            {
                if (this._drawTool != null && this._drawTool.GetGeo() != null)
                {
                    switch (this._drawTool.GeoType)
                    {
                    case DrawType.Point:
                        break;

                    case DrawType.Polyline:
                        break;

                    case DrawType.Circle:
                        break;

                    case DrawType.Rectangle:
                        break;

                    case DrawType.Polygon:
                        break;

                    default:
                        return;
                    }

                    IGeometry geo = this._drawTool.GetGeo();
                    if (geo == null)
                    {
                        return;
                    }
                    IGeometry geoBuffer = (geo as ITopologicalOperator2D).Buffer2D(Convert.ToDouble(this.seBufferDis.Value.ToString()), gviBufferStyle.gviBufferCapround);
                    if (geoBuffer == null)
                    {
                        return;
                    }
                    if (this._drawTool != null)
                    {
                        this._drawTool.OnStartDraw    -= new OnStartDraw(this.OnStartDraw);
                        this._drawTool.OnFinishedDraw -= new OnFinishedDraw(this.OnFinishedDraw);
                        this._drawTool.Close();
                        this._drawTool.End();
                    }
                    this._3DControl.HighlightHelper.VisibleMask = 1;
                    this._3DControl.HighlightHelper.SetRegion(geoBuffer);

                    if (geoBuffer.GeometryType == gviGeometryType.gviGeometryPolygon)
                    {
                        this._rPolygon = this._3DControl.ObjectManager.CreateRenderPolygon(geoBuffer as IPolygon, this._surfaceSymbol, this._3DControl.ProjectTree.RootID);
                        if (this._3DControl.Terrain.IsRegistered && this._3DControl.Terrain.VisibleMask != gviViewportMask.gviViewNone)
                        {
                            (this._rPolygon as IRenderPolygon).HeightStyle = gviHeightStyle.gviHeightOnTerrain;
                        }
                        else
                        {
                            (this._rPolygon as IRenderPolygon).HeightStyle = gviHeightStyle.gviHeightAbsolute;
                        }
                    }
                    else if (geoBuffer.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                    {
                        this._rPolygon = this._3DControl.ObjectManager.CreateRenderMultiPolygon(geoBuffer as IMultiPolygon, this._surfaceSymbol, this._3DControl.ProjectTree.RootID);
                        if (this._3DControl.Terrain.IsRegistered && this._3DControl.Terrain.VisibleMask != gviViewportMask.gviViewNone)
                        {
                            (this._rPolygon as IRenderMultiPolygon).HeightStyle = gviHeightStyle.gviHeightOnTerrain;
                        }
                        else
                        {
                            (this._rPolygon as IRenderMultiPolygon).HeightStyle = gviHeightStyle.gviHeightAbsolute;
                        }
                    }
                    else
                    {
                        return;
                    }

                    if (this.cmbLayer.SelectedItem == null)
                    {
                        return;
                    }
                    ISpatialFilter filter = new SpatialFilter();
                    filter.Geometry = geoBuffer;
                    if (this.cmbSpatialRelation.Text == "包含")
                    {
                        filter.SpatialRel = gviSpatialRel.gviSpatialRelContains;
                    }
                    else
                    {
                        filter.SpatialRel = gviSpatialRel.gviSpatialRelIntersects;
                    }
                    DF3DFeatureClass dffc = this.cmbLayer.SelectedItem as DF3DFeatureClass;
                    IFeatureClass    fc   = dffc.GetFeatureClass();
                    if (fc == null)
                    {
                        return;
                    }
                    IFeatureLayer fl = dffc.GetFeatureLayer();
                    if (fl == null)
                    {
                        return;
                    }
                    filter.GeometryField = fl.GeometryFieldName;
                    int count = fc.GetCount(filter);
                    if (count == 0)
                    {
                        XtraMessageBox.Show("查询结果为空", "提示");
                        return;
                    }
                    WaitForm.Start("正在查询...", "请稍后");
                    this._uPanel               = new UIDockPanel("查询结果", "查询结果", this.Location1, this._width, this._height);
                    this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
                    this._dockPanel.Visibility = DockVisibility.Visible;
                    this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
                    this._dockPanel.Width      = this._width;
                    this._dockPanel.Height     = this._height;
                    this._uc = new UCPropertyInfo();
                    this._uc.Init();
                    this._uc.Dock = System.Windows.Forms.DockStyle.Fill;
                    this._uPanel.RegisterEvent(new PanelClose(this.Close));
                    this._dockPanel.Controls.Add(this._uc);
                    this._uc.SetInfo(dffc, filter, count);
                    WaitForm.Stop();
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 28
0
 public void ExportSelectedBitmaps(IRenderGeometry geometry, IEnumerable <int> shaderIndexes)
 {
     ExportBitmaps(geometry, g => g.GetBitmaps(shaderIndexes));
 }
Esempio n. 29
0
 public void ExportBitmaps(IRenderGeometry geometry)
 {
     ExportBitmaps(geometry, g => g.GetAllBitmaps());
 }
Esempio n. 30
0
 public void StopEdit(bool bSave)
 {
     if (this._app == null || this._app.Current3DMapControl == null)
     {
         return;
     }
     try
     {
         if (this._isSpatialQuery)
         {
             if (!bSave)
             {
                 this._geoEditor.CancelEdit();
             }
             else
             {
                 this._geoEditor.FinishEdit();
             }
             if (this.spatialQueryEditStopEvent != null)
             {
                 this.spatialQueryEditStopEvent(bSave);
             }
             this._isSpatialQuery = false;
             this._app.Current3DMapControl.InteractMode = this._InteractaMode;
         }
         else
         {
             if (this._FeatureClass != null && this._row != null)
             {
                 if (!bSave)
                 {
                     this._geoEditor.CancelEdit();
                     if (this._renderGeometry != null)
                     {
                         this._app.Current3DMapControl.ObjectManager.DeleteObject(this._renderGeometry.Guid);
                         System.Runtime.InteropServices.Marshal.ReleaseComObject(this._renderGeometry);
                         this._renderGeometry = null;
                     }
                     this._app.Current3DMapControl.InteractMode = this._InteractaMode;
                 }
                 else
                 {
                     if (this._geoEditor.IsEditing && bSave)
                     {
                         this._geoEditor.FinishEdit();
                     }
                     Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = this._FeatureClass.GetFeatureClass();
                     int       position = this._row.FieldIndex(this._FeatureClass.GetFeatureLayer().GeometryFieldName);
                     IGeometry geometry = this._row.GetValue(position) as IGeometry;
                     if (this._geoEditType == gviGeoEditType.gviGeoEditCreator)
                     {
                         ITopologicalOperator2D topologicalOperator2D = geometry as ITopologicalOperator2D;
                         if (topologicalOperator2D == null || !topologicalOperator2D.IsSimple2D())
                         {
                             XtraMessageBox.Show("创建的对象无效!");
                             this._app.Current3DMapControl.ObjectManager.DeleteObject(this._renderGeometry.Guid);
                             System.Runtime.InteropServices.Marshal.ReleaseComObject(this._renderGeometry);
                             this._renderGeometry = null;
                         }
                         else
                         {
                             CommandManagerServices.Instance().StartCommand();
                             FDECommand fDECommand = new FDECommand(true, true);
                             SelectCollection.Instance().Clear();
                             IRowBufferCollection rowBufferCollection = new RowBufferCollectionClass();
                             rowBufferCollection.Add(this._row);
                             CommonUtils.Instance().FdeUndoRedoManager.InsertFeatures(featureClass, rowBufferCollection);
                             CommonUtils.Instance().Insert(this._FeatureClass, rowBufferCollection, true, true);
                             this._app.Current3DMapControl.FeatureManager.CreateFeature(featureClass, this._row);
                             this._app.Current3DMapControl.ObjectManager.DeleteObject(this._renderGeometry.Guid);
                             fDECommand.SetSelectionMap();
                             CommandManagerServices.Instance().CallCommand(fDECommand);
                             this._app.Workbench.UpdateMenu();
                             System.Runtime.InteropServices.Marshal.ReleaseComObject(this._renderGeometry);
                             this._renderGeometry = null;
                         }
                     }
                     else
                     {
                         CommandManagerServices.Instance().StartCommand();
                         FDECommand cmd = new FDECommand(false, true);
                         CommonUtils.Instance().FdeUndoRedoManager.UpdateFeature(featureClass, this._row);
                         CommandManagerServices.Instance().CallCommand(cmd);
                         this._app.Workbench.UpdateMenu();
                     }
                     if (this._row != null)
                     {
                         System.Runtime.InteropServices.Marshal.ReleaseComObject(this._row);
                         this._row = null;
                     }
                     this._app.Current3DMapControl.InteractMode = this._InteractaMode;
                 }
             }
         }
     }
     catch (System.Runtime.InteropServices.COMException ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
     catch (System.UnauthorizedAccessException)
     {
         XtraMessageBox.Show("拒绝访问");
     }
     catch (System.Exception ex2)
     {
         XtraMessageBox.Show(ex2.Message);
     }
 }