Exemple #1
0
 public GeometryExtrusionWithAtlasOptions(GeometryExtrusionOptions extrusionOptions)
 {
     extrusionType         = extrusionOptions.extrusionType;
     extrusionGeometryType = extrusionOptions.extrusionGeometryType;
     propertyName          = extrusionOptions.propertyName;
     minimumHeight         = extrusionOptions.minimumHeight;
     maximumHeight         = extrusionOptions.maximumHeight;
     extrusionScaleFactor  = extrusionOptions.extrusionScaleFactor;
 }
        public GeometryExtrusionWithAtlasOptions(GeometryExtrusionOptions extrusionOptions, UVModifierOptions uvOptions)
        {
            extrusionType         = extrusionOptions.extrusionType;
            extrusionGeometryType = extrusionOptions.extrusionGeometryType;
            propertyName          = extrusionOptions.propertyName;
            minimumHeight         = extrusionOptions.minimumHeight;
            maximumHeight         = extrusionOptions.maximumHeight;

            texturingType = uvOptions.texturingType;
            atlasInfo     = uvOptions.atlasInfo;
        }
Exemple #3
0
 /// <summary>
 /// Changes extrusion type to "Range Height" and extrudes all features by
 /// the choosen property's value such that all vertices (roof) will be
 /// flat at the highest vertex elevation (after terrain elevation taken into account).
 /// </summary>
 /// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
 /// <param name="propertyName">Name of the property to use for extrusion</param>
 /// <param name="extrusionScaleFactor">Height multiplier</param>
 void ISubLayerExtrusionOptions.EnableMaxExtrusion(ExtrusionGeometryType extrusionGeometryType, string propertyName, float extrusionScaleFactor)
 {
     if (extrusionType != ExtrusionType.MaxHeight ||
         this.extrusionGeometryType != extrusionGeometryType ||
         this.propertyName != propertyName ||
         !Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
     {
         this.extrusionType         = ExtrusionType.MaxHeight;
         this.extrusionGeometryType = extrusionGeometryType;
         this.propertyName          = propertyName;
         this.extrusionScaleFactor  = extrusionScaleFactor;
         HasChanged = true;
     }
 }
Exemple #4
0
 /// <summary>
 /// Changes extrusion type to "Minimum Height" and extrudes all features by
 /// the choosen property's value such that all vertices (roof) will be
 /// flat at the lowest vertex elevation (after terrain elevation taken into account).
 /// </summary>
 /// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
 /// <param name="propertyName">Name of the property to use for extrusion</param>
 /// <param name="extrusionScaleFactor">Height multiplier</param>
 public virtual void EnableMinExtrusion(ExtrusionGeometryType extrusionGeometryType, string propertyName = "height", float extrusionScaleFactor = 1)
 {
     if (extrusionType != ExtrusionType.MinHeight ||
         this.extrusionGeometryType != extrusionGeometryType ||
         this.propertyName != propertyName ||
         !Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
     {
         extrusionType = ExtrusionType.MinHeight;
         this.extrusionGeometryType = extrusionGeometryType;
         this.propertyName          = propertyName;
         this.extrusionScaleFactor  = extrusionScaleFactor;
         HasChanged = true;
     }
 }
Exemple #5
0
 /// <summary>
 /// Changes extrusion type to "Property" and extrudes all features by
 /// the choosen property's value.
 /// </summary>
 /// <param name="geometryType">Option to create top and side polygons after extrusion.</param>
 /// <param name="propertyAttribute">Name of the property to use for extrusion</param>
 /// <param name="scaleFactor">Height multiplier</param>
 public virtual void EnablePropertyExtrusion(ExtrusionGeometryType geometryType, string propertyAttribute = "height", float scaleFactor = 1)
 {
     if (extrusionType != ExtrusionType.PropertyHeight ||
         extrusionGeometryType != geometryType ||
         propertyName != propertyAttribute ||
         !Mathf.Approximately(extrusionScaleFactor, scaleFactor))
     {
         extrusionType         = ExtrusionType.PropertyHeight;
         extrusionGeometryType = geometryType;
         propertyName          = propertyAttribute;
         extrusionScaleFactor  = scaleFactor;
         HasChanged            = true;
     }
 }
Exemple #6
0
 /// <summary>
 /// Changes extrusion type to "Absolute height" and extrudes all features by
 /// the given fixed value.
 /// </summary>
 /// <param name="geometryType">Option to create top and side polygons after extrusion.</param>
 /// <param name="height">Extrusion value</param>
 /// <param name="scaleFactor">Height multiplier</param>
 public virtual void EnableAbsoluteExtrusion(ExtrusionGeometryType geometryType, float height, float scaleFactor = 1)
 {
     if (extrusionType != ExtrusionType.AbsoluteHeight ||
         extrusionGeometryType != geometryType ||
         !Mathf.Approximately(maximumHeight, height) ||
         !Mathf.Approximately(extrusionScaleFactor, scaleFactor))
     {
         extrusionType         = ExtrusionType.AbsoluteHeight;
         extrusionGeometryType = geometryType;
         maximumHeight         = height;
         extrusionScaleFactor  = scaleFactor;
         HasChanged            = true;
     }
 }
Exemple #7
0
 /// /// <summary>
 /// Changes extrusion type to "Minimum Height" and extrudes all features by
 /// the choosen property's value such that they'll be in provided range.
 /// Lower values will be increase to Minimum Height and higher values will
 /// be lowered to Maximum height.
 /// </summary>
 /// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
 /// <param name="minHeight">Lower bound to be used for extrusion</param>
 /// <param name="maxHeight">Top bound to be used for extrusion</param>
 /// <param name="extrusionScaleFactor">Height multiplier</param>
 public virtual void EnableRangeExtrusion(ExtrusionGeometryType extrusionGeometryType, float minHeight, float maxHeight, float extrusionScaleFactor = 1)
 {
     if (extrusionType != ExtrusionType.RangeHeight ||
         this.extrusionGeometryType != extrusionGeometryType ||
         !Mathf.Approximately(minimumHeight, minHeight) ||
         !Mathf.Approximately(maximumHeight, maxHeight) ||
         !Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
     {
         extrusionType = ExtrusionType.RangeHeight;
         this.extrusionGeometryType = extrusionGeometryType;
         minimumHeight             = minHeight;
         maximumHeight             = maxHeight;
         this.extrusionScaleFactor = extrusionScaleFactor;
         HasChanged = true;
     }
 }
        /// <summary>
        /// Gets the default sub layer properties for the chosen preset type.
        /// </summary>
        /// <returns>The sub layer properties.</returns>
        /// <param name="type">Type.</param>
        public static VectorSubLayerProperties GetSubLayerProperties(PresetFeatureType type)
        {
            //CoreOptions properties
            VectorPrimitiveType geometryType = VectorPrimitiveType.Polygon;
            string layerName    = "building";
            string sublayerName = "Untitled";

            //Line Geometry Options
            float lineWidth = 1.0f;

            //Geometry Extrusion Options
            ExtrusionType         extrusionType         = ExtrusionType.None;
            ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
            string propertyName         = "height";
            float  extrusionScaleFactor = 1.0f;
            float  extrusionHeight      = 1.0f;

            //Filter Options
            LayerFilterCombinerOperationType combinerType = LayerFilterCombinerOperationType.Any;
            List <LayerFilter> filters = new List <LayerFilter>();


            // Material Options
            StyleTypes style = StyleTypes.Realistic;

            //Misc options
            bool buildingsWithUniqueIds           = true;
            PositionTargetType positionTargetType = PositionTargetType.TileCenter;

            //Modifiers
            List <MeshModifier>       meshModifiers       = new List <MeshModifier>();
            List <GameObjectModifier> gameObjectModifiers = new List <GameObjectModifier>();
            ColliderType colliderType = ColliderType.None;

            switch (type)
            {
            case PresetFeatureType.Buildings:
                layerName             = "building";
                geometryType          = VectorPrimitiveType.Polygon;
                extrusionType         = ExtrusionType.PropertyHeight;
                extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
                propertyName          = "height";
                style = StyleTypes.Realistic;
                break;

            case PresetFeatureType.Roads:
                layerName             = "road";
                geometryType          = VectorPrimitiveType.Line;
                lineWidth             = 1.0f;
                style                 = StyleTypes.Dark;
                extrusionType         = ExtrusionType.AbsoluteHeight;
                extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
                break;

            case PresetFeatureType.Points:
                layerName    = "poi_label";
                geometryType = VectorPrimitiveType.Point;
                break;

            case PresetFeatureType.Landuse:
                layerName    = "landuse";
                geometryType = VectorPrimitiveType.Polygon;
                style        = StyleTypes.Color;
                break;

            case PresetFeatureType.Custom:
                layerName    = "";
                geometryType = VectorPrimitiveType.Custom;
                style        = StyleTypes.Custom;
                break;

            default:
                break;
            }

            VectorSubLayerProperties _properties = new VectorSubLayerProperties();

            _properties.presetFeatureType = type;

            _properties.coreOptions = new CoreVectorLayerProperties
            {
                isActive      = true,
                layerName     = layerName,
                geometryType  = geometryType,
                snapToTerrain = true,
                combineMeshes = false,
                sublayerName  = sublayerName
            };

            _properties.lineGeometryOptions = new LineGeometryOptions
            {
                Width = lineWidth
            };

            _properties.extrusionOptions = new GeometryExtrusionOptions
            {
                extrusionType         = extrusionType,
                extrusionGeometryType = extrusionGeometryType,
                propertyName          = propertyName,
                extrusionScaleFactor  = extrusionScaleFactor,
                maximumHeight         = extrusionHeight
            };

            _properties.filterOptions = new VectorFilterOptions
            {
                combinerType = combinerType,
                filters      = filters
            };

            _properties.materialOptions = new GeometryMaterialOptions
            {
                style           = style,
                colorStyleColor = Constants.GUI.Colors.EDITOR_FEATURE_DEFAULT_COLOR
            };
            _properties.materialOptions.SetDefaultMaterialOptions();
            _properties.buildingsWithUniqueIds = buildingsWithUniqueIds;
            _properties.moveFeaturePositionTo  = positionTargetType;
            _properties.MeshModifiers          = meshModifiers;
            _properties.GoModifiers            = gameObjectModifiers;
            _properties.colliderOptions        = new ColliderOptions
            {
                colliderType = colliderType
            };

            return(_properties);
        }