Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
##### Additions :tada:

- Added support for the Linux platform (x86-64 only).
- Added `CesiumVectorPointStyle` and a `pointStyle` field on `CesiumVectorStyle`, enabling `CesiumGeoJsonDocumentRasterOverlay` to render GeoJSON `Point` and `MultiPoint` features.

## v1.24.0 - 2026-07-01

Expand Down
64 changes: 63 additions & 1 deletion Source/Runtime/CesiumVectorStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,61 @@ public struct CesiumVectorPolygonStyle
};
}

/// <summary>
/// The style used to draw points.
/// </summary>
[Serializable]
public struct CesiumVectorPointStyle
{
/// <summary>
/// The radius of the point in pixels.
/// </summary>
[Tooltip("The radius of the point in pixels.")]
[Min(0)]
public double radius;

/// <summary>
/// Whether the point should be filled.
/// </summary>
[Tooltip("Whether the point should be filled.")]
public bool fill;

/// <summary>
/// If fill is true, this style will be used when filling the point.
/// </summary>
[Tooltip("If fill is true, this style will be used when filling the point.")]
public CesiumVectorPolygonFillStyle fillStyle;

/// <summary>
/// Whether the point should be outlined.
/// </summary>
[Tooltip("Whether the point should be outlined.")]
public bool outline;

/// <summary>
/// If outline is true, this style will be used when outlining the point.
/// </summary>
[Tooltip("If outline is true, this style will be used when outlining the point.")]
public CesiumVectorLineStyle outlineStyle;

/// <summary>
/// Creates a default point style with a 5 pixel radius, fill enabled, and
/// outline disabled.
/// </summary>
/// <remarks>
/// Fill is enabled by default because the underlying native point style
/// renders nothing when neither fill nor outline is set.
/// </remarks>
public static CesiumVectorPointStyle Default => new CesiumVectorPointStyle
{
radius = 5.0,
fill = true,
fillStyle = CesiumVectorPolygonFillStyle.Default,
outline = false,
outlineStyle = CesiumVectorLineStyle.Default
};
}

/// <summary>
/// Style information to use when drawing vector data.
/// </summary>
Expand All @@ -174,13 +229,20 @@ public struct CesiumVectorStyle
[Tooltip("Styles to use when drawing polygons.")]
public CesiumVectorPolygonStyle polygonStyle;

/// <summary>
/// Styles to use when drawing points.
/// </summary>
[Tooltip("Styles to use when drawing points.")]
public CesiumVectorPointStyle pointStyle;

/// <summary>
/// Creates a default vector style.
/// </summary>
public static CesiumVectorStyle Default => new CesiumVectorStyle
{
lineStyle = CesiumVectorLineStyle.Default,
polygonStyle = CesiumVectorPolygonStyle.Default
polygonStyle = CesiumVectorPolygonStyle.Default,
pointStyle = CesiumVectorPointStyle.Default
};
}
}
12 changes: 12 additions & 0 deletions Source/Runtime/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,18 @@ Cesium3DTilesetLoadFailureDetails tilesetDetails
polygonStyleV.outline = outlineEnabled;
CesiumVectorLineStyle outlineStyle = polygonStyleV.outlineStyle;
polygonStyleV.outlineStyle = outlineStyle;
CesiumVectorPointStyle pointStyleV = vectorStyle.pointStyle;
vectorStyle.pointStyle = pointStyleV;
double pointRadius = pointStyleV.radius;
pointStyleV.radius = pointRadius;
bool pointFillEnabled = pointStyleV.fill;
pointStyleV.fill = pointFillEnabled;
CesiumVectorPolygonFillStyle pointFillStyle = pointStyleV.fillStyle;
pointStyleV.fillStyle = pointFillStyle;
bool pointOutlineEnabled = pointStyleV.outline;
pointStyleV.outline = pointOutlineEnabled;
CesiumVectorLineStyle pointOutlineStyle = pointStyleV.outlineStyle;
pointStyleV.outlineStyle = pointOutlineStyle;
baseOverlay = geoJsonOverlay;

TestGltfModel testModel = new TestGltfModel();
Expand Down
45 changes: 45 additions & 0 deletions Tests/TestCesiumVectorStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,46 @@ public void PolygonStyleCanDisableBothFillAndOutline()

#endregion

#region CesiumVectorPointStyle Tests

[Test]
public void PointStyleDefaultHasFillEnabledOutlineDisabled()
{
CesiumVectorPointStyle style = CesiumVectorPointStyle.Default;

Assert.AreEqual(5.0, style.radius, 0.001);
Assert.IsTrue(style.fill);
Assert.IsFalse(style.outline);
}

[Test]
public void PointStyleCanEnableBothFillAndOutline()
{
CesiumVectorPointStyle style = new CesiumVectorPointStyle();
style.radius = 8.0;
style.fill = true;
style.fillStyle = CesiumVectorPolygonFillStyle.Default;
style.outline = true;
style.outlineStyle = CesiumVectorLineStyle.Default;

Assert.AreEqual(8.0, style.radius, 0.001);
Assert.IsTrue(style.fill);
Assert.IsTrue(style.outline);
}

[Test]
public void PointStyleCanDisableBothFillAndOutline()
{
CesiumVectorPointStyle style = new CesiumVectorPointStyle();
style.fill = false;
style.outline = false;

Assert.IsFalse(style.fill);
Assert.IsFalse(style.outline);
}

#endregion

#region CesiumVectorStyle Tests

[Test]
Expand All @@ -120,6 +160,11 @@ public void VectorStyleDefaultHasCorrectSubStyles()
// Polygon style defaults
Assert.IsTrue(style.polygonStyle.fill);
Assert.IsFalse(style.polygonStyle.outline);

// Point style defaults
Assert.AreEqual(5.0, style.pointStyle.radius, 0.001);
Assert.IsTrue(style.pointStyle.fill);
Assert.IsFalse(style.pointStyle.outline);
}

[Test]
Expand Down
40 changes: 40 additions & 0 deletions native~/src/Runtime/CesiumVectorStyleConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <DotNet/CesiumForUnity/CesiumVectorColorMode.h>
#include <DotNet/CesiumForUnity/CesiumVectorLineStyle.h>
#include <DotNet/CesiumForUnity/CesiumVectorLineWidthMode.h>
#include <DotNet/CesiumForUnity/CesiumVectorPointStyle.h>
#include <DotNet/CesiumForUnity/CesiumVectorPolygonFillStyle.h>
#include <DotNet/CesiumForUnity/CesiumVectorPolygonStyle.h>
#include <DotNet/CesiumForUnity/CesiumVectorStyle.h>
Expand Down Expand Up @@ -52,6 +53,22 @@ inline CesiumVectorData::ColorStyle fromUnityFillStyle(
return native;
}

inline CesiumVectorData::PointStyle fromUnityPointStyle(
const DotNet::CesiumForUnity::CesiumVectorPointStyle& pointStyle) {
CesiumVectorData::PointStyle native;
native.radius = pointStyle.radius;

if (pointStyle.fill) {
native.fill = fromUnityFillStyle(pointStyle.fillStyle);
}

if (pointStyle.outline) {
native.outline = fromUnityLineStyle(pointStyle.outlineStyle);
}

return native;
}

inline CesiumVectorData::VectorStyle
fromUnityStyle(const DotNet::CesiumForUnity::CesiumVectorStyle& style) {
CesiumVectorData::VectorStyle native;
Expand All @@ -66,6 +83,8 @@ fromUnityStyle(const DotNet::CesiumForUnity::CesiumVectorStyle& style) {
fromUnityLineStyle(style.polygonStyle.outlineStyle);
}

native.point = fromUnityPointStyle(style.pointStyle);

return native;
}

Expand Down Expand Up @@ -133,6 +152,27 @@ toUnityStyle(const CesiumVectorData::VectorStyle& style) {
toUnityLineWidthMode(style.polygon.outline->widthMode);
}

// Point style
result.pointStyle.radius = style.point.radius;

result.pointStyle.fill = style.point.fill.has_value();
if (style.point.fill.has_value()) {
result.pointStyle.fillStyle.color = toUnityColor(style.point.fill->color);
result.pointStyle.fillStyle.colorMode =
toUnityColorMode(style.point.fill->colorMode);
}

result.pointStyle.outline = style.point.outline.has_value();
if (style.point.outline.has_value()) {
result.pointStyle.outlineStyle.color =
toUnityColor(style.point.outline->color);
result.pointStyle.outlineStyle.colorMode =
toUnityColorMode(style.point.outline->colorMode);
result.pointStyle.outlineStyle.width = style.point.outline->width;
result.pointStyle.outlineStyle.widthMode =
toUnityLineWidthMode(style.point.outline->widthMode);
}

return result;
}

Expand Down