Interface ITopicUpdateBuilder
An interface that defines all the steps necessary to build a TopicUpdate object.
Namespace: Unity.Cloud.Annotation.Runtime
Syntax
public interface ITopicUpdateBuilder
Examples
public async Task<ITopic> UpdateTopicInRepository(IAnnotationRepository repository,
ITopic topicToUpdate,
string instanceId,
Vector3 topicPosition,
Transform cameraTransform,
ITopicObject objectToAnnotate)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetInstanceId(instanceId)
.SetTitle("Topic Title")
.SetDescription("A descriptive description")
.CalculateAndSetTransforms(topicPosition, cameraTransform, objectToAnnotate);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
Methods
CalculateAndSetTransforms(Vector3, Transform, ITopicObject)
Calculates and sets the world and local transform properties of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder CalculateAndSetTransforms(Vector3 worldPosition, Transform cameraTransform, ITopicObject topicObject)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | worldPosition | The topic's position in world space. |
| UnityEngine.Transform | cameraTransform | The transform of the main camera. |
| ITopicObject | topicObject | The object to which the topic is attached. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicInRepository(AnnotationRepository repository,
ITopic topicToUpdate,
Vector3 topicPosition,
Transform cameraTransform,
ITopicObject objectToAnnotate)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.CalculateAndSetTransforms(topicPosition, cameraTransform, objectToAnnotate);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
GetTopicUpdate()
Returns the instance of the TopicUpdate that is being built.
Declaration
ITopicUpdate GetTopicUpdate()
Returns
| Type | Description |
|---|---|
| ITopicUpdate | The instance of the TopicUpdate that is being built. |
Examples
public ITopicUpdate GetTopicUpdate(ITopic topicToUpdate)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetTitle("A topic title")
.SetDescription("A description");
return topicUpdateBuilder.GetTopicUpdate();
}
SetDescription(String)
Assigns a value to the Description property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetDescription(string description)
Parameters
| Type | Name | Description |
|---|---|---|
| String | description | The new Description value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithDescription(AnnotationRepository repository,
ITopic topicToUpdate,
string description)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetDescription(description);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetId(Guid)
Assigns a value to the Id property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetId(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The new Id value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicById(AnnotationRepository repository,
Guid topicId)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder();
topicUpdateBuilder.SetId(topicId)
.SetTitle("Updated title");
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetInstanceId(String)
Assigns a value to the InstanceId property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetInstanceId(string instanceId)
Parameters
| Type | Name | Description |
|---|---|---|
| String | instanceId | The new InstanceId value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithInstanceId(AnnotationRepository repository,
ITopic topicToUpdate,
string instanceId)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetInstanceId(instanceId);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetLocalCameraTransform(AnnotationTransform)
Assigns a value to the LocalCameraTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetLocalCameraTransform(AnnotationTransform cameraTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | cameraTransform | The new LocalCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithLocalCameraTransform(AnnotationRepository repository,
ITopic topicToUpdate,
AnnotationTransform localCameraTransform)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetLocalCameraTransform(localCameraTransform);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetLocalCameraTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the LocalCameraTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetLocalCameraTransform(Vector3 cameraPosition, Quaternion cameraRotation)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | cameraPosition | The position of the new LocalCameraTransform value. |
| UnityEngine.Quaternion | cameraRotation | The rotation of the new LocalCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithLocalCameraPositionAndRotation(AnnotationRepository repository,
ITopic topicToUpdate,
Vector3 localPosition,
Quaternion localRotation)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetLocalCameraTransform(localPosition, localRotation);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetLocalTransform(AnnotationTransform)
Assigns a value to the LocalTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetLocalTransform(AnnotationTransform localTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | localTransform | The new LocalTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithLocalTransform(AnnotationRepository repository,
ITopic topicToUpdate,
AnnotationTransform localTransform)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetLocalTransform(localTransform);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetLocalTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the LocalTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetLocalTransform(Vector3 position, Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | position | The position of the new LocalTransform value. |
| UnityEngine.Quaternion | rotation | The rotation of the new LocalTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithLocalPositionAndRotation(AnnotationRepository repository,
ITopic topicToUpdate,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetLocalTransform(worldPosition, worldRotation);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetMarkAsRead(Boolean)
Assigns a value to the MarkAsRead property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetMarkAsRead(bool markAsRead)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | markAsRead | The new MarkAsRead value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithMarkAsRead(AnnotationRepository repository,
ITopic topicToUpdate,
bool markAsRead)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetMarkAsRead(markAsRead);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetState(TopicState)
Assigns a value to the State property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetState(TopicState state)
Parameters
| Type | Name | Description |
|---|---|---|
| TopicState | state | The new State value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithState(AnnotationRepository repository,
ITopic topicToUpdate,
TopicState state)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetState(state);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetTitle(String)
Assigns a value to the Title property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetTitle(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| String | title | The new Title value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithTitle(AnnotationRepository repository,
ITopic topicToUpdate,
string title)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetTitle(title);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetWorldCameraTransform(AnnotationTransform)
Assigns a value to the WorldCameraTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetWorldCameraTransform(AnnotationTransform cameraTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | cameraTransform | The new WorldCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithWorldCameraTransform(AnnotationRepository repository,
ITopic topicToUpdate,
AnnotationTransform worldCameraTransform)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetWorldCameraTransform(worldCameraTransform);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetWorldCameraTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the WorldCameraTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetWorldCameraTransform(Vector3 cameraPosition, Quaternion cameraRotation)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | cameraPosition | The position of the new WorldCameraTransform value. |
| UnityEngine.Quaternion | cameraRotation | The rotation of the new WorldCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithWorldCameraPositionAndRotation(AnnotationRepository repository,
ITopic topicToUpdate,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetWorldCameraTransform(worldPosition, worldRotation);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetWorldTransform(AnnotationTransform)
Assigns a value to the WorldTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetWorldTransform(AnnotationTransform worldTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | worldTransform | The new WorldTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithWorldTransform(AnnotationRepository repository,
ITopic topicToUpdate,
AnnotationTransform worldTransform)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetWorldTransform(worldTransform);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}
SetWorldTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the WorldTransform property of the TopicUpdate that is being built.
Declaration
ITopicUpdateBuilder SetWorldTransform(Vector3 position, Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | position | The position of the new WorldTransform value. |
| UnityEngine.Quaternion | rotation | The rotation of the new WorldTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicUpdateBuilder | The current instance of the ITopicUpdateBuilder interface. |
Examples
public async Task<ITopic> UpdateTopicWithWorldPositionAndRotation(AnnotationRepository repository,
ITopic topicToUpdate,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicUpdateBuilder topicUpdateBuilder = new TopicUpdateBuilder(topicToUpdate);
topicUpdateBuilder.SetWorldTransform(worldPosition, worldRotation);
ITopicUpdate topicUpdate = topicUpdateBuilder.GetTopicUpdate();
ITopic updatedTopic = await repository.UpdateTopicAsync(topicUpdate);
return updatedTopic;
}