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 = "&lt;Classification FuncType="0"&gt;&lt;Class&gt;&lt;Condition&gt;&amp;lt;"[STATE]"="CT"&amp;gt;&lt;/Condition&gt;&lt;Value&gt;33023&lt;/Value&gt;&lt;/Class&gt;&lt;DefaultValue&gt;6579300&lt;/DefaultValue&gt;&lt;/Classification&gt;”

 

The following methods are available:

§  applyChanges

§  getPropertiesString

§  restoreProjectDefault

§  setProp

Different members are available for each of the feature layer types, as follows:

Polylines:

§  altitudeMethod

§  altitudeOffset

§  extendToGround

§  groundClampingMethod

§  lineColor

§  tooltip

§  width

Polygons:

§  altitudeMethod

§  altitudeOffset

§  extendToGround

§  fillColor

§  fillOpacity

§  groundClampingMethod

§  outlinecolor

§  outlineOpacity

§  outlineWidth

§  tooltip

§  volumeMode

Points:

§  altitudeMethod

§  altitudeOffset

§  backgroundColor

§  backgroundOpacity

§  bold

§  font

§  groundClampingMethod

§  imageColor

§  imageOpacity

§  imageUrl

§  italic

§  limitGrowth

§  minViewingHeight

§  scale

§  text

§  textColor

§  textSize

§  tooltip

 

applyChanges

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

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

restoreProjectDefault()

Restore the layer properties to the project's default settings in the TE4W project.

Example

TerraExplorer.layers.feature.items[0].properties.restoreProjectDefault();

 

setProp

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

string

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();

 

altitudeMethod

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)

altitudeOffset

static altitudeOffset : Number

Gets and sets the altitude offset. This property is valid for featurePoint, featureLine, and featurePolygon objects.

backgroundColor

static backgroundColor : Cesium.Color

Gets and sets the background color of a label. This property is only valid for featurePoint objects.

backgroundOpacity

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.

bold

static bold : Boolean

Gets and sets a Boolean that determines whether the label text is bold. This property is only valid for featurePoint objects.

extendToGround

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.

fillColor

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();

fillOpacity

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.

font

static font : String

Gets and sets the font of the label's text. This property is only valid for featurePoint objects.

groundClampingMethod

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).

imageColor

static imageColor : Cesium.Color

Gets and sets the label's image color. This property is only valid for featurePoint objects.

imageOpacity

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.

imageUrl

static imageURL : String

Gets and sets the URL of the label's image file. This property is only valid for featurePoint objects.

italic

static italic : Boolean

Gets and sets a Boolean that determines whether the label text is italicized. This property is only valid for featurePoint objects.

limitGrowth

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.

lineColor

static lineColor : Cesium.Color

Gets and sets the polyline's color. This property is only valid for featureLine objects.

minViewingHeight

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.

outlineColor

static outlineColor : Cesium.Color

Gets and sets the polygon's outline color. This property is only valid for featurePolygon objects.

outlineOpacity

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.

outlineWidth

static outlineWidth : Number

Gets and sets the width of the polygon's outline. This property is only valid for featurePolygon objects.

scale

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.

text

static text : String

Gets and sets the label's text. This property is only valid for featurePoint objects.

textColor

static textColor : Cesium.Color

Gets and sets the color of the label's text. This property is only valid for featurePoint objects.

textSize

static textSize : Number

Gets and sets the font size of the label's text. This property is only valid for featurePoint objects.

tooltip

static tooltip : String

Gets and sets the feature object's tooltip. This property is valid for featurePoint, featureLine, and featurePolygon objects.

volumeMode

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.

width

static width : Number

Gets and sets the polyline's width. This property is only valid for featureLine objects.