Methods
(static) createMouseTool(name, type) → {PCCViewer.MouseTool}
Create a new named mouse tool of a specific type.
- If the new name matches the name of an existing mouse tool of the same type, then all properties of the existing tool will be overwritten with the defaults. Subsequent calls to
.getMouseTool(name)
will return the tool with the new properties. - If the new name already exists, but the type does not match, and error will be thrown.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
The name of the new mouse tool. This value is case-insensitive for comparison against existing mouse tools of the same name. Note: The case you provide will be persisted in the name property of the object that is returned, so it is best to pick a consistent naming scheme. |
type |
string |
The type of the new mouse tool. |
- See:
-
- PCCViewer.MouseTool.Type for a list of possible mouse tool types.
Throws:
-
If calling this function using an existing
name
when thetype
does not match the already existing one. -
- Type
- Error
Returns:
The MouseTool object that was created.
- Type
- PCCViewer.MouseTool
Example
// Create a new mouse tool with the name "MyLineAnnotationMouseTool"
var myMouseTool = PCCViewer.MouseTools.createMouseTool("MyLineAnnotationMouseTool", "LineAnnotation");
// Configure the mouse tool or the template mark of the mouse tool
myMouseTool.getTemplateMark().setOpacity(127);
// set the ViewerControl to use the mouse tool
viewerControl.setCurrentMouseTool("MyLineAnnotationMouseTool");
(static) createMouseTool(name, type) → {PCCViewer.MouseTool}
Create a new named mouse tool of a specific type.
- If the new name matches the name of an existing mouse tool of the same type, then all properties of the existing tool will be overwritten with the defaults. Subsequent calls to
.getMouseTool(name)
will return the tool with the new properties. - If the new name already exists, but the type does not match, and error will be thrown.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
The name of the new mouse tool. This value is case-insensitive for comparison against existing mouse tools of the same name. Note: The case you provide will be persisted in the name property of the object that is returned, so it is best to pick a consistent naming scheme. |
type |
string |
The type of the new mouse tool. |
- See:
-
- PCCViewer.MouseTool.Type for a list of possible mouse tool types.
Throws:
-
If calling this function using an existing
name
when thetype
does not match the already existing one. -
- Type
- Error
Returns:
The MouseTool object that was created.
- Type
- PCCViewer.MouseTool
Example
// Create a new mouse tool with the name "MyLineAnnotationMouseTool"
var myMouseTool = PCCViewer.MouseTools.createMouseTool("MyLineAnnotationMouseTool", "LineAnnotation");
// Configure the mouse tool or the template mark of the mouse tool
myMouseTool.getTemplateMark().setOpacity(127);
// set the ViewerControl to use the mouse tool
viewerControl.setCurrentMouseTool("MyLineAnnotationMouseTool");
(static) getMouseTool(name) → {PCCViewer.MouseTool|undefined}
Gets a named mouse tool.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
The name of the |
Returns:
The MouseTool
object with the specified name, or undefined
, if a MouseTool
with the specified name does not exist.
- Type
- PCCViewer.MouseTool | undefined
Example
var mouseToolName = "FooMouseTool";
// get the mouse tool
var mouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);
// check that the named mouse tool actually exists
if (mouseTool) {
// do something with the MouseTool, you can do different things based on the type of the tool
switch (mouseTool.getType()) {
case PCCViewer.MouseTool.Type.LineAnnotation:
...
break;
default:
...
}
}
(static) getMouseTool(name) → {PCCViewer.MouseTool|undefined}
Gets a named mouse tool.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
The name of the |
Returns:
The MouseTool
object with the specified name, or undefined
, if a MouseTool
with the specified name does not exist.
- Type
- PCCViewer.MouseTool | undefined
Example
var mouseToolName = "FooMouseTool";
// get the mouse tool
var mouseTool = PCCViewer.MouseTools.getMouseTool(mouseToolName);
// check that the named mouse tool actually exists
if (mouseTool) {
// do something with the MouseTool, you can do different things based on the type of the tool
switch (mouseTool.getType()) {
case PCCViewer.MouseTool.Type.LineAnnotation:
...
break;
default:
...
}
}