コード例 #1
0
        //Update the painter when correspounding single's data changed
        private void GEMSSingle_DataChanged(object sender, GEMSSingle.SingleDataChangedEventArgs e)
        {
            if (sender is GEMSSingle && (sender as GEMSSingle) == source)
            {
                switch (e.changedType)
                {
                case GEMSSingle.SingleDataChangedEventArgs.DataChangeType.DisplayStyleChanged:
                {
                    //Re-create all the material
                    CreateMaterial();
                }
                break;

                case GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged:
                {
                    //Re-create all the material
                    CreateMaterial();

                    //Re-create the eo single model
                    if (source.EOSymbolModel != null)
                    {
                        eoSymbolRender = new SingleEOSymbolRender(d3d, source.EOSymbolModel);
                        eoSymbolRender.Initialize( );
                    }
                    else
                    {
                        eoSymbolRender.Dispose( );
                        eoSymbolRender = null;
                    }
                }
                break;

                case GEMSSingle.SingleDataChangedEventArgs.DataChangeType.GeometryChanged:
                {
                    //Re-create the primaryModelRender
                    if (source.PrimaryModel != null)
                    {
                        primaryModelRender = GeometryRender.Create(d3d, source.PrimaryModel);
                    }

                    if (source.EOSymbolModel != null)
                    {
                        eoSymbolRender = new SingleEOSymbolRender(d3d, source.EOSymbolModel);
                        eoSymbolRender.Initialize( );
                    }
                }
                break;

                default:
                    break;
                }
            }
            else
            {
                return;
            }
        }
コード例 #2
0
        public static GeometryRender Create(Direct3d d3d, GeometryModel source)
        {
            GeometryRender render = null;

            //Create the geometry object based type
            switch (source.GetType().Name)
            {
            case "ConeModel":
                render = new ConeRender(d3d, source);
                break;

            case "CylinderModel":
                render = new CylinderRender(d3d, source);
                break;

            case "CuboidModel":
                render = new CuboidRender(d3d, source);
                break;

            case "LineModel":
                render = new LineRender(d3d, source);
                break;

            case "PointModel":
                render = new PointRender(d3d, source);
                break;

            case "RectangleModel":
                render = new RectangleRender(d3d, source);
                break;

            case "SphereModel":
                render = new SphereRender(d3d, source);
                break;

            case "RoundModel":
                render = new RoundRender(d3d, source);
                break;

            case "SingleEOSymbolModel":
                render = new SingleEOSymbolRender(d3d, source);
                break;

            default:
                break;
            }

            if (render != null)
            {
                render.Initialize( );
            }

            return(render);
        }
コード例 #3
0
        public override void Initialize( )
        {
            if (source.PrimaryModel != null)
            {
                primaryModelRender = GeometryRender.Create(d3d, source.PrimaryModel);

                if (source.EOSymbolModel != null)
                {
                    eoSymbolRender = new SingleEOSymbolRender(d3d, source.EOSymbolModel);
                    eoSymbolRender.Initialize( );
                }
            }

            CreateMaterial();
        }