Interface ITopicCreationBuilder
An interface that defines all the steps necessary to build a TopicCreation object.
Namespace: Unity.Cloud.Annotation.Runtime
Syntax
public interface ITopicCreationBuilder
Examples
public async Task<ITopic> CreateTopicInRepository(IAnnotationRepository repository,
string instanceId,
Vector3 topicPosition,
Transform cameraTransform,
ITopicObject objectToAnnotate)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetInstanceId(instanceId)
.SetTitle("Topic Title")
.SetDescription("A descriptive description")
.CalculateAndSetTransforms(topicPosition, cameraTransform, objectToAnnotate);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
Methods
CalculateAndSetTransforms(Vector3, Transform, ITopicObject)
Calculates and sets the world and local transform properties of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder 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 |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Remarks
This method automatically calculates the local and world transforms for the topic based on the desired world position for the annotation (such as a click position on the object), the UnityEngine.Transform of the camera viewing the object, and 3D information about the object in the form of an ITopicObject.
Examples
public async Task<ITopic> CreateTopicInRepository(IAnnotationRepository repository,
Vector3 topicPosition,
Transform cameraTransform,
ITopicObject objectToAnnotate)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.CalculateAndSetTransforms(topicPosition, cameraTransform, objectToAnnotate);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
GetTopicCreation()
Returns the instance of the TopicCreation that is being built.
Declaration
ITopicCreation GetTopicCreation()
Returns
| Type | Description |
|---|---|
| ITopicCreation | The instance of the TopicCreation that is being built. |
Examples
public ITopicCreation GetTopicCreation()
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetTitle("A topic title")
.SetDescription("A description");
return topicCreationBuilder.GetTopicCreation();
}
SetDescription(String)
Assigns a value to the Description property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetDescription(string description)
Parameters
| Type | Name | Description |
|---|---|---|
| String | description | The new Description value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithDescription(IAnnotationRepository repository,
string description)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetDescription(description);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetInitialComment(String)
Assigns a value to the InitialComment property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetInitialComment(string initialComment)
Parameters
| Type | Name | Description |
|---|---|---|
| String | initialComment | The new InitialComment value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithInitialComment(IAnnotationRepository repository,
string initialComment)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetInitialComment(initialComment);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetInstanceId(String)
Assigns a value to the InstanceId property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetInstanceId(string instanceId)
Parameters
| Type | Name | Description |
|---|---|---|
| String | instanceId | The new InstanceId value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithInstanceId(IAnnotationRepository repository,
string instanceId)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetInstanceId(instanceId);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetLocalCameraTransform(AnnotationTransform)
Assigns a value to the LocalCameraTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetLocalCameraTransform(AnnotationTransform cameraTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | cameraTransform | The new LocalCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithLocalCameraTransform(IAnnotationRepository repository,
AnnotationTransform localCameraTransform)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetLocalCameraTransform(localCameraTransform);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetLocalCameraTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the LocalCameraTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder 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 |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithLocalCameraPositionAndRotation(IAnnotationRepository repository,
Vector3 localPosition,
Quaternion localRotation)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetLocalCameraTransform(localPosition, localRotation);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetLocalTransform(AnnotationTransform)
Assigns a value to the LocalTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetLocalTransform(AnnotationTransform localTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | localTransform | The new LocalTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithLocalTransform(IAnnotationRepository repository,
AnnotationTransform localTransform)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetLocalTransform(localTransform);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetLocalTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the LocalTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder 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 |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithLocalPositionAndRotation(IAnnotationRepository repository,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetLocalTransform(worldPosition, worldRotation);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetTitle(String)
Assigns a value to the Title property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetTitle(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| String | title | The new Title value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithTitle(IAnnotationRepository repository,
string title)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetTitle(title);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetWorldCameraTransform(AnnotationTransform)
Assigns a value to the WorldCameraTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetWorldCameraTransform(AnnotationTransform cameraTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | cameraTransform | The new WorldCameraTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithWorldCameraTransform(IAnnotationRepository repository,
AnnotationTransform worldCameraTransform)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetWorldCameraTransform(worldCameraTransform);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetWorldCameraTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the WorldCameraTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder 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 |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithWorldCameraPositionAndRotation(IAnnotationRepository repository,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetWorldCameraTransform(worldPosition, worldRotation);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetWorldTransform(AnnotationTransform)
Assigns a value to the WorldTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder SetWorldTransform(AnnotationTransform worldTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationTransform | worldTransform | The new WorldTransform value. |
Returns
| Type | Description |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithWorldTransform(IAnnotationRepository repository,
AnnotationTransform worldTransform)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetWorldTransform(worldTransform);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}
SetWorldTransform(Vector3, Quaternion)
Creates a AnnotationTransform object from a UnityEngine.Vector3 and a UnityEngine.Quaternion and assigns it to the WorldTransform property of the TopicCreation that is being built.
Declaration
ITopicCreationBuilder 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 |
|---|---|
| ITopicCreationBuilder | The current instance of the ITopicCreationBuilder interface. |
Examples
public async Task<ITopic> CreateTopicWithWorldPositionAndRotation(IAnnotationRepository repository,
Vector3 worldPosition,
Quaternion worldRotation)
{
ITopicCreationBuilder topicCreationBuilder = new TopicCreationBuilder();
topicCreationBuilder.SetWorldTransform(worldPosition, worldRotation);
ITopicCreation topicCreation = topicCreationBuilder.GetTopicCreation();
ITopic createdTopic = await repository.CreateTopicAsync(topicCreation);
return createdTopic;
}