Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement placemark level of details selector #843

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/shapes/Placemark.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,7 @@ define([
* cannot be created or should not be created at the time this method is called.
*/
Placemark.prototype.makeOrderedRenderable = function (dc) {
var w, h, s,
offset;

this.determineActiveAttributes(dc);
if (!this.activeAttributes) {
return null;
}
var w, h, s, offset;

// Compute the placemark's model point and corresponding distance to the eye point. If the placemark's
// position is terrain-dependent but off the terrain, then compute it ABSOLUTE so that we have a point for
Expand All @@ -442,6 +436,14 @@ define([

this.eyeDistance = this.alwaysOnTop ? 0 : dc.eyePoint.distanceTo(this.placePoint);

// Extension point to override placemark attributes depending on camera distance
this.selectLevelOfDetail(dc, this, this.eyeDistance);

this.determineActiveAttributes(dc);
if (!this.activeAttributes) {
return null;
}

if (this.mustDrawLeaderLine(dc)) {
dc.surfacePointForMode(this.position.latitude, this.position.longitude, 0,
this.altitudeMode, this.groundPoint);
Expand Down Expand Up @@ -513,6 +515,17 @@ define([
return this;
};

/**
* Set the placemark attributes for the current distance to the camera and highlighted state.
*
* @param {DrawContext} dc The current render context
* @param {Placemark} placemark The placemark needing a level of detail selection
* @param {Number} cameraDistance The distance from the placemark to the camera (meters)
*/
Placemark.prototype.selectLevelOfDetail = function (dc, placemark, cameraDistance) {
// Intentionally empty. Can be override in application if required.
};

// Internal. Intentionally not documented.
Placemark.prototype.determineActiveAttributes = function (dc) {
if (this.highlighted && this.highlightAttributes) {
Expand Down