-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc31551
commit b206919
Showing
13 changed files
with
229 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include "cesium.h" | ||
#include "simfil/model/model.h" | ||
#include "mapget/model/featurelayer.h" | ||
#include "../rule.h" | ||
#include "points.h" | ||
|
||
namespace erdblick | ||
{ | ||
|
||
struct CesiumBillboardCollection | ||
{ | ||
CesiumBillboardCollection(); | ||
|
||
/** | ||
* Add an individual billboard to the collection. | ||
*/ | ||
void addBillboard( | ||
const JsValue& position, | ||
FeatureStyleRule const& style, | ||
JsValue const& id, | ||
BoundEvalFun const& evalFun); | ||
|
||
/** | ||
* Get the parameters for a BillboardCollection::add() call. | ||
*/ | ||
static JsValue billboardParams( | ||
const JsValue& position, | ||
FeatureStyleRule const& style, | ||
JsValue const& id, | ||
BoundEvalFun const& evalFun); | ||
|
||
/** | ||
* Construct a JS Primitive from the provided Geometry instances. | ||
*/ | ||
[[nodiscard]] NativeJsValue toJsObject() const; | ||
|
||
/** | ||
* Check if any geometry has been added to the primitive. | ||
*/ | ||
bool empty() const; | ||
|
||
private: | ||
/** Number of billboards in this collection. */ | ||
size_t numGeometryInstances_ = 0; | ||
|
||
/** Wrapped billboard primitive object from Cesium */ | ||
JsValue billboardCollection_; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "cesium-interface/billboards.h" | ||
#include "cesium-interface/cesium.h" | ||
#include "simfil/model/model.h" | ||
|
||
#include <iostream> | ||
|
||
namespace erdblick | ||
{ | ||
|
||
CesiumBillboardCollection::CesiumBillboardCollection() : | ||
billboardCollection_(Cesium().PointPrimitiveCollection.New()) | ||
{} | ||
|
||
JsValue CesiumBillboardCollection::billboardParams( | ||
const JsValue& position, | ||
const FeatureStyleRule& style, | ||
const JsValue& id, | ||
const BoundEvalFun& evalFun) | ||
{ | ||
auto result = CesiumPointPrimitiveCollection::pointParams(position, style, id, evalFun); | ||
if (style.hasIconUrl()) { | ||
result.set("image", JsValue(style.iconUrl(evalFun))); | ||
} | ||
return result; | ||
} | ||
|
||
void CesiumBillboardCollection::addBillboard( | ||
const JsValue& position, | ||
FeatureStyleRule const& style, | ||
JsValue const& id, | ||
BoundEvalFun const& evalFun) | ||
{ | ||
auto params = billboardParams(position, style, id, evalFun); | ||
billboardCollection_.call<void>("add", *params); | ||
++numGeometryInstances_; | ||
} | ||
|
||
[[nodiscard]] NativeJsValue CesiumBillboardCollection::toJsObject() const | ||
{ | ||
return *billboardCollection_; | ||
} | ||
|
||
bool CesiumBillboardCollection::empty() const | ||
{ | ||
return numGeometryInstances_ == 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters