PropertiesObject
An object that controls the properties of the features in a feature layer. Properties can be set using either the PropertiesObject members or the setProp method. After properties are set, changes must be applied using applyChanges. Different properties are available for each of the feature layer types.
Example
Set a property value:
TerraExplorer.layers.feature.items[0].properties.text = "ExampleText";
Get a property value:
var x = TerraExplorer.layers.feature.items[0].properties.text;
Set multiple properties using setProp:
TerraExplorer.layers.feature.items[0].properties
.setProp("italic", true)
.setProp("text", "textValue")
.applyChanges();
The PropertiesObject members support attribute-based styling that was set in TerraExplorer Desktop. See "About Basing Native Feature Layer Properties on Layer Attribute Fields" in the TerraExplorer User Guide for information. This can be used to copy classification attribute-based information styling from a published TE4W project to other layers or to modify values.
The classification script should be written in the following format. The following expression is intended only to describe the structure of the classification script, and should not be copied as is. Note that a valid script example follows this one.
<Classification FuncType="0"><Class><Condition><"[STATE]"="CT"></Condition><Value>1234</Value><DefaultValue>5678</DefaultValue></Classification>
Example
TerraExplorer.layers.feature.items[0].properties.lineColor = "<Classification FuncType="0"><Class><Condition>&lt;"[STATE]"="CT"&gt;</Condition><Value>33023</Value></Class><DefaultValue>6579300</DefaultValue></Classification>”
The following methods are available:
§ setProp
Different members are available for each of the feature layer types, as follows:
Polylines:
§ tooltip
§ width
Polygons:
§ tooltip
Points:
§ bold
§ font
§ imageUrl
§ italic
§ scale
§ text
§ textSize
§ tooltip
applyChanges()
Applies the property changes set in setProp or using the PropertiesObject object.
Example
TerraExplorer.layers.feature.items[0].properties.setProp("text", "Something");
TerraExplorer.layers.feature.items[0].properties.applyChanges();
getProperties()
Gets the JSON of the layer's style properties. This JSON can then be used to create a new layer using the create method, where the returned JSON (“props” in the example below) is passed for the style parameter.
Example
var props = TerraExplorer.layers.feature.items[0].properties.getProperties();
restoreProjectDefault()
Restore the layer properties to the project's default settings in the TE4W project.
Example
TerraExplorer.layers.feature.items[0].properties.restoreProjectDefault();
setProp(name, value) → PropertiesObject
Sets property changes to the features in a feature layer. Properties can also be set using the PropertiesObject's members. After properties are set, changes must be applied using applyChanges. Different properties are available for each of the feature layer types.
Parameters
Name |
Type |
Description |
name |
The name of a PropertiesObject member, e.g., "textSize", "fillColor", "fillOpacity" |
|
value |
object |
The value to set for the "name" property, of the expected type. |
Returns
A PropertiesObject object.
Example
The following example sets property changes to a point feature layer.
TerraExplorer.layers.feature.items[0].properties
.setProp("text", "New York")
.setProp("textSize", "26")
.applyChanges();
static altitudeMethod : AltitudeMethod
Gets and sets an AltitudeMethod object that determines how the feature layer is displayed. This property is valid for featurePoint, featureLine, and featurePolygon objects. The following are the possible values:
§ RELATIVE_TO_TERRAIN
§ ABSOLUTE
§ RELATIVE_TO_MODEL (only for FeaturePoint objects)
§ ON_TERRAIN (only for featurePolyline and featurePolygon objects)
static altitudeOffset : Number
Gets and sets the altitude offset. This property is valid for featurePoint, featureLine, and featurePolygon objects.
static backgroundColor : Cesium.Color
Gets and sets the background color of a label. This property is only valid for featurePoint objects.
static backgroundOpacity : Number
Gets and sets the opacity of the label's background. The opacity can be any value between 0, for transparent, and 1 for opaque. This property is only valid for featurePoint objects.
static bold : Boolean
Gets and sets a Boolean that determines whether the label text is bold. This property is only valid for featurePoint objects.
static extendToGround : Boolean
Gets and sets a Boolean that determines whether the feature layer objects are extended vertically to the ground (to create a partition such as a wall or fence). This property is only valid for featureLine and featurePolygon objects.
static fillColor : Cesium.Color
Gets and sets the polygon's fill color. This property is only valid for featurePolygon objects.
Example
TerraExplorer.layers.feature.items[0].properties.fillColor = Cesium.Color.fromCssColorString("#008736");
TerraExplorer.layers.feature.items[0].properties.applyChanges();
static fillOpacity : Number
Gets and sets the opacity of the polygon's fill color. The opacity can be any value between 0, for transparent, and 1 for opaque. This property is only valid for featurePolygon objects.
static font : String
Gets and sets the font of the label's text. This property is only valid for featurePoint objects.
static groundClampingMethod : GroundClampingMethod
Gets and sets a GroundClampingMethod object that determines how the layer objects clamp to the surfaces below them. This property is valid for featureLine and featurePolygon objects. The following are the possible values:
§ CLAMPS_TO_TERRAIN - Clamps to the terrain only and appears underneath the models.
§ CLAMPS_TO_MODEL - Clamps to the terrain/model (Covers everything below it).
static imageColor : Cesium.Color
Gets and sets the label's image color. This property is only valid for featurePoint objects.
static imageOpacity : Number
Gets and sets the image opacity in the image label. The opacity can be any value between 0, for transparent, and 1 for opaque. This property is only valid for featurePoint objects.
static imageURL : String
Gets and sets the URL of the label's image file. This property is only valid for featurePoint objects.
static italic : Boolean
Gets and sets a Boolean that determines whether the label text is italicized. This property is only valid for featurePoint objects.
static limitGrowth : Boolean
Gets and sets a Boolean that determines whether the label keeps its original size in pixels (Text Size) or grows as you fly closer. This property is only valid for featurePoint objects.
static lineColor : Cesium.Color
Gets and sets the polyline's color. This property is only valid for featureLine objects.
static minViewingHeight : Number
Gets and sets the minimum viewing height at which the label is visible. The label disappears when flying lower than the minViewingHeight. This property is only valid for featurePoint objects.
static outlineColor : Cesium.Color
Gets and sets the polygon's outline color. This property is only valid for featurePolygon objects.
static outlineOpacity : Number
Gets and sets the opacity of the polygon's outline. The opacity can be any value between 0, for transparent, and 1 for opaque. This property is only valid for featurePolygon objects.
static outlineWidth : Number
Gets and sets the width of the polygon's outline. This property is only valid for featurePolygon objects.
static scale : Number
Gets and sets the dimensions, in meters per pixel, of the label. The maximum character height is the textSize times the scale value. This property is only valid for featurePoint objects.
static text : String
Gets and sets the label's text. This property is only valid for featurePoint objects.
static textColor : Cesium.Color
Gets and sets the color of the label's text. This property is only valid for featurePoint objects.
static textSize : Number
Gets and sets the font size of the label's text. This property is only valid for featurePoint objects.
static tooltip : String
Gets and sets the feature object's tooltip. This property is valid for featurePoint, featureLine, and featurePolygon objects.
static volumeMode : VolumeClassificationMode
Gets and sets a VolumeClassificationMode object that determines whether to use a polygon layer as a classification layer, and if it is used for classification, how to represent the classification. This property is valid for featurePolygon objects. The following are the possible values:
§ NO = 0
Do not use for classification.
§ POLYGON_3D = 1
Classify by displaying 3D polygons (based on the extruded polygons).
§ COLORIZE_OBJECTS = 2
Classify by colorizing all objects and layers contained within the extruded polygons.
static width : Number
Gets and sets the polyline's width. This property is only valid for featureLine objects.