Skip to content

Commit

Permalink
feat: Align layers with native SDK (11.5.1-alpha08) (#40)
Browse files Browse the repository at this point in the history
* - add SetLayerPropertyFor

* - align Expression.Operator

* - align DslOperator

* - alpha07

* - align Layer classes
  • Loading branch information
tuyen-vuduc authored Sep 4, 2024
1 parent 4bd5113 commit b9cfada
Show file tree
Hide file tree
Showing 40 changed files with 2,684 additions and 1,871 deletions.
1 change: 1 addition & 0 deletions src/libs/Mapbox.Maui/IMapboxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void CameraForCoordinates(
ScreenPosition? offset = default
);
void SetSourcePropertyFor<T>(string sourceId, string propertyName, T value, Action<Exception> completion = default);
void SetLayerPropertyFor<T>(string layerId, string propertyName, T value, Action<Exception> completion = default);
}

public class MapTappedEventArgs : EventArgs
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Mapbox.Maui/Mapbox.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<RepositoryUrl>https://github.com/tuyen-vuduc/mapbox-maui</RepositoryUrl>
<PackageProjectUrl>https://mapbox.tuyen-vuduc.tech</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageVersion>11.5.1-alpha06</PackageVersion>
<PackageVersion>11.5.1-alpha08</PackageVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>tv-mapbox.png</PackageIcon>
Expand Down
496 changes: 0 additions & 496 deletions src/libs/Mapbox.Maui/Models/Expressions/AllExpressions.cs

This file was deleted.

181 changes: 94 additions & 87 deletions src/libs/Mapbox.Maui/Models/Expressions/DslExpression.Factories.cs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/libs/Mapbox.Maui/Models/Expressions/DslExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace MapboxMaui.Expressions;
[DebuggerDisplay("{GetString()}")]
public partial class DslExpression : List<object>
{
public ExpressionOperator Operator { get; }
public DslOperator Operator { get; }

public DslExpression(ExpressionOperator @operator)
public DslExpression(DslOperator @operator)
{
Operator = @operator;
}

public DslExpression(ExpressionOperator @operator, params object[] arguments)
public DslExpression(DslOperator @operator, params object[] arguments)
: base(arguments)
{
Operator = @operator;
Expand Down
382 changes: 99 additions & 283 deletions src/libs/Mapbox.Maui/Models/Expressions/DslOperator.cs

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions src/libs/Mapbox.Maui/Models/Styles/Layers/BackgroundLayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
namespace MapboxMaui.Styles;

/// The background color or pattern of the map.
///
/// - SeeAlso: [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#layers-background)
public class BackgroundLayer : MapboxLayer
{
public BackgroundLayer(string id)
: base(id)
{
Type = LayerType.Background;
Visibility = new PropertyValue<Visibility>(MapboxMaui.Visibility.Visible);
}
/// The color with which the background will be drawn.
/// Default value: "#000000".
public PropertyValue<Color> BackgroundColor
{
get => GetProperty<PropertyValue<Color>>(
PaintCodingKeys.BackgroundColor,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundColor,
value,
MapboxLayerKey.paint
);
}
/// Transition options for `backgroundColor`.
public PropertyValue<StyleTransition> BackgroundColorTransition
{
get => GetProperty<PropertyValue<StyleTransition>>(
PaintCodingKeys.BackgroundColorTransition,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundColorTransition,
value,
MapboxLayerKey.paint
);
}
/// Controls the intensity of light emitted on the source features.
/// Default value: 0. Minimum value: 0.
public PropertyValue<double> BackgroundEmissiveStrength
{
get => GetProperty<PropertyValue<double>>(
PaintCodingKeys.BackgroundEmissiveStrength,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundEmissiveStrength,
value,
MapboxLayerKey.paint
);
}
/// Transition options for `backgroundEmissiveStrength`.
public PropertyValue<StyleTransition> BackgroundEmissiveStrengthTransition
{
get => GetProperty<PropertyValue<StyleTransition>>(
PaintCodingKeys.BackgroundEmissiveStrengthTransition,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundEmissiveStrengthTransition,
value,
MapboxLayerKey.paint
);
}
/// The opacity at which the background will be drawn.
/// Default value: 1. Value range: [0, 1]
public PropertyValue<double> BackgroundOpacity
{
get => GetProperty<PropertyValue<double>>(
PaintCodingKeys.BackgroundOpacity,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundOpacity,
value,
MapboxLayerKey.paint
);
}
/// Transition options for `backgroundOpacity`.
public PropertyValue<StyleTransition> BackgroundOpacityTransition
{
get => GetProperty<PropertyValue<StyleTransition>>(
PaintCodingKeys.BackgroundOpacityTransition,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundOpacityTransition,
value,
MapboxLayerKey.paint
);
}
/// Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
public PropertyValue<ResolvedImage> BackgroundPattern
{
get => GetProperty<PropertyValue<ResolvedImage>>(
PaintCodingKeys.BackgroundPattern,
default,
MapboxLayerKey.paint
);
set => SetProperty(
PaintCodingKeys.BackgroundPattern,
value,
MapboxLayerKey.paint
);
}

public static class PaintCodingKeys {
public const string BackgroundColor = "background-color";
public const string BackgroundColorTransition = "background-color-transition";
public const string BackgroundEmissiveStrength = "background-emissive-strength";
public const string BackgroundEmissiveStrengthTransition = "background-emissive-strength-transition";
public const string BackgroundOpacity = "background-opacity";
public const string BackgroundOpacityTransition = "background-opacity-transition";
public const string BackgroundPattern = "background-pattern";
}

public static class LayoutCodingKeys {

}
}
Loading

0 comments on commit b9cfada

Please sign in to comment.