Example #1
0
        private void GenerateRoofMesh(MeshData md, float minHeight, float maxHeight)
        {
            _counter = md.Vertices.Count;
            switch (_options.extrusionType)
            {
            case ExtrusionType.None:
                break;

            case ExtrusionType.PropertyHeight:
                for (var i = 0; i < _counter; i++)
                {
                    md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight, md.Vertices[i].z);
                }

                break;

            case ExtrusionType.MinHeight:
            {
                var minmax = MinMaxPair.GetMinMaxHeight(md.Vertices);
                for (var i = 0; i < _counter; i++)
                {
                    md.Vertices[i] = new Vector3(md.Vertices[i].x, minmax.min + maxHeight, md.Vertices[i].z);
                }
            }
            break;

            case ExtrusionType.MaxHeight:
            {
                var minmax = MinMaxPair.GetMinMaxHeight(md.Vertices);
                for (var i = 0; i < _counter; i++)
                {
                    md.Vertices[i] = new Vector3(md.Vertices[i].x, minmax.max + maxHeight, md.Vertices[i].z);
                }

                _height += minmax.max - minmax.min;
            }
            break;

            case ExtrusionType.RangeHeight:
                for (var i = 0; i < _counter; i++)
                {
                    md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight,
                                                 md.Vertices[i].z);
                }

                break;

            case ExtrusionType.AbsoluteHeight:
                for (var i = 0; i < _counter; i++)
                {
                    md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight,
                                                 md.Vertices[i].z);
                }

                break;

            default:
                break;
            }
        }
        protected virtual void GenerateRoofMesh(MeshData md, float minHeight, float maxHeight)
        {
            if (_options.extrusionGeometryType != ExtrusionGeometryType.SideOnly)
            {
                _counter = md.Vertices.Count;
                switch (_options.extrusionType)
                {
                case ExtrusionType.None:
                    break;

                case ExtrusionType.PropertyHeight:
                    for (int i = 0; i < _counter; i++)
                    {
                        md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight, md.Vertices[i].z);
                    }
                    break;

                case ExtrusionType.MinHeight:
                {
                    var minmax = MinMaxPair.GetMinMaxHeight(md.Vertices);
                    for (int i = 0; i < _counter; i++)
                    {
                        md.Vertices[i] = new Vector3(md.Vertices[i].x, minmax.min + maxHeight, md.Vertices[i].z);
                    }
                }
                    //hf += max - min;
                    break;

                case ExtrusionType.MaxHeight:
                {
                    var minmax = MinMaxPair.GetMinMaxHeight(md.Vertices);
                    for (int i = 0; i < _counter; i++)
                    {
                        md.Vertices[i] = new Vector3(md.Vertices[i].x, minmax.max + maxHeight, md.Vertices[i].z);
                    }
                    height += (minmax.max - minmax.min);
                }
                break;

                case ExtrusionType.RangeHeight:
                    for (int i = 0; i < _counter; i++)
                    {
                        md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight, md.Vertices[i].z);
                    }
                    break;

                case ExtrusionType.AbsoluteHeight:
                    for (int i = 0; i < _counter; i++)
                    {
                        md.Vertices[i] = new Vector3(md.Vertices[i].x, md.Vertices[i].y + maxHeight, md.Vertices[i].z);
                    }
                    break;

                default:
                    break;
                }
            }
        }
Example #3
0
        public static MinMaxPair GetMinMaxHeight(List <Vector3> vertices)
        {
            int        counter     = vertices.Count;
            MinMaxPair returnValue = new MinMaxPair
            {
                max = float.MinValue,
                min = float.MaxValue
            };

            for (int i = 0; i < counter; i++)
            {
                if (vertices[i].y > returnValue.max)
                {
                    returnValue.max = vertices[i].y;
                }
                else if (vertices[i].y < returnValue.min)
                {
                    returnValue.min = vertices[i].y;
                }
            }

            return(returnValue);
        }