Skip to content
Merged
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
51 changes: 46 additions & 5 deletions docs/schemas/CommonTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,47 @@
"pattern": "^[a-zA-Z0-9 ?!@+-.:=_/]*$",
"description": "String containing only web safe characters"
},
"expressionString": {
"type": "string",
"isJsep": true,
"description": "A JavaScript (JSEP) expression for frontend rendering that excludes potentially dangerous constructs. It's up to the frontend to validate and execute this expression safely."
},
"expressionOrConditions": {
"description": "Expression that determines styling conditions or a single expression.",
"oneOf": [
{
"$ref": "/schemas/CommonTypes#/definitions/expressionString",
"description": "Single expression string"
},
{
"type": "object",
"additionalProperties": false,
"required": [ "conditions" ],
"properties": {
"conditions": {
"type": "array",
"description": "Array of condition-value pairs for determining styling",
"minItems": 1,
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"$ref": "/schemas/CommonTypes#/definitions/expressionString",
"description": "Condition expression that evaluates to a boolean"
},
{
"$ref": "/schemas/CommonTypes#/definitions/expressionString",
"description": "Expression that returns a value when the condition is true"
}
]
}
}
}
}
]
},
"dateTime": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z$",
Expand Down Expand Up @@ -49,7 +90,7 @@
"description": "Z coordinate"
}
},
"required": ["x", "y", "z"]
"required": [ "x", "y", "z" ]
},
"transform": {
"type": "array",
Expand Down Expand Up @@ -82,7 +123,7 @@
"description": "Used by iTwin.Js. Interior planes should not generate edges when clipping geometry in the view."
}
},
"required": []
"required": [ ]
},
"clipPlaneSet": {
"description": "Collection of ClipPlanes, often used for bounding regions of space.",
Expand All @@ -97,7 +138,7 @@
}
}
},
"required": ["planes"]
"required": [ "planes" ]
},
"colorDef": {
"description": "An unsigned 32-bit integer in 0xTTBBGGRR format.",
Expand Down Expand Up @@ -129,7 +170,7 @@
"description": "Blue component of the color"
}
},
"required": ["r", "g", "b"]
"required": [ "r", "g", "b" ]
},
"linePixels": {
"enum": [
Expand Down Expand Up @@ -163,7 +204,7 @@
"description": "If defined and non-zero, the width of the edges in pixels. If undefined (or 0), edges are drawn using the element's line width.\n Non-integer values are truncated, and values are clamped to the range [1, 32]."
}
},
"required": []
"required": [ ]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"$id": "/schemas/FeatureStyling.1.0.0",
"description": "Defines styling options for features.",
"type": "object",
"additionalProperties": false,
"properties": {
"stylingOptions": {
"description": "Styling options for features.",
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"required": [ "styleType", "color" ],
"properties": {
"styleType": {
"enum": [ "Expression" ],
"description": "Specifies the type of styling: 'Expression' or 'Category'. This is used to differentiate between different styling methods."
},
"defines": {
"type": "object",
"description": "Named expressions that can be reused within other expressions",
"additionalProperties": false,
"patternProperties": {
"^[a-zA-Z0-9 ?!@+-.:=_/]*$": {
"$ref": "/schemas/CommonTypes#/definitions/expressionString",
"description": "Expression string that can define conditions or calculations for styling"
}
}
},
"show": {
"$ref": "/schemas/CommonTypes#/definitions/expressionOrConditions",
"description": "Expression or conditions that determines if the feature is visible"
},
"color": {
"description": "Expression or conditions that determine the feature's color, can also be a set of conditions",
"$ref": "/schemas/CommonTypes#/definitions/expressionOrConditions"
},
"lineWeight": {
"$ref": "/schemas/CommonTypes#/definitions/expressionString",
"description": "Expression that determines the feature's line weight/thickness"
},
"lineColor": {
"$ref": "/schemas/CommonTypes#/definitions/expressionOrConditions",
"description": "Color definition for the feature's lines"
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [ "styleType", "rules" ],
"properties": {
"styleType": {
"enum": [ "Category" ],
"description": "Specifies the type of styling: 'Expression' or 'Category'. This is used to differentiate between different styling methods."
},
"rules": {
"type": "array",
"description": "Array of Attribute rules",
"items": {
"type": "object",
"additionalProperties": false,
"required": [ "name", "value", "symbology" ],
"properties": {
"name": {
"$ref": "/schemas/CommonTypes#/definitions/safeString",
"description": "Name of the attribute to match"
},
"value": {
"description": "Value of the attribute to match",
"oneOf": [
{
"$ref": "/schemas/CommonTypes#/definitions/expressionString"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
},
"symbology": {
"type": "object",
"description": "Symbology settings to apply when the rule matches",
"additionalProperties": false,
"required": [ "lineColor", "fillColor", "weight" ],
"properties": {
"lineColor": {
"$ref": "/schemas/CommonTypes#/definitions/colorDef",
"description": "Color of the feature's lines"
},
"fillColor": {
"$ref": "/schemas/CommonTypes#/definitions/colorDef",
"description": "Fill color of the feature"
},
"weight": {
"type": "number",
"description": "Thickness of the feature's lines"
},
"linePixels": {
"$ref": "/schemas/CommonTypes#/definitions/linePixels",
"description": "Line pattern for the feature's lines"
}
}
}
}
}
}
}
}
]
}
}
}