-
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.
Merge pull request #60 from ndsev/feature/point-visualization
Basic point support with test data
- Loading branch information
Showing
15 changed files
with
275 additions
and
31 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
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,41 @@ | ||
#pragma once | ||
|
||
#include "cesium.h" | ||
#include "simfil/model/model.h" | ||
#include "mapget/model/featurelayer.h" | ||
#include "../rule.h" | ||
|
||
namespace erdblick | ||
{ | ||
|
||
struct CesiumPointPrimitiveCollection | ||
{ | ||
CesiumPointPrimitiveCollection(); | ||
|
||
/** | ||
* Add an individual point to the collection | ||
*/ | ||
void addPoint( | ||
const JsValue& position, | ||
FeatureStyleRule const& style, | ||
uint32_t id); | ||
|
||
/** | ||
* 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 points in this collection. */ | ||
size_t numGeometryInstances_ = 0; | ||
|
||
/** Wrapped point primitive object from Cesium */ | ||
JsValue pointPrimitiveCollection_; | ||
}; | ||
|
||
} |
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,52 @@ | ||
#include "cesium-interface/points.h" | ||
#include "cesium-interface/cesium.h" | ||
#include "cesium-interface/point-conversion.h" | ||
#include "simfil/model/model.h" | ||
|
||
#include <iostream> | ||
|
||
namespace erdblick | ||
{ | ||
|
||
CesiumPointPrimitiveCollection::CesiumPointPrimitiveCollection() : | ||
pointPrimitiveCollection_(Cesium().PointPrimitiveCollection.New()) | ||
{} | ||
|
||
void CesiumPointPrimitiveCollection::addPoint( | ||
const JsValue& position, | ||
FeatureStyleRule const& style, | ||
uint32_t id) | ||
{ | ||
auto const& color = style.color(); | ||
auto const& oColor = style.outlineColor(); | ||
|
||
auto options = JsValue::Dict({ | ||
{"position", position}, | ||
{"color", Cesium().Color.New(color.r, color.g, color.b, color.a)}, | ||
{"pixelSize", JsValue(style.width())}, | ||
{"id", JsValue(id)}, | ||
{"outlineColor", Cesium().Color.New(oColor.r, oColor.g, oColor.b, oColor.a)}, | ||
{"outlineWidth", JsValue(style.outlineWidth())}, | ||
}); | ||
|
||
if (auto const& nfs = style.nearFarScale()) { | ||
options.set( | ||
"scaleByDistance", | ||
Cesium().NearFarScalar.New((*nfs)[0], (*nfs)[1], (*nfs)[2], (*nfs)[3])); | ||
} | ||
|
||
pointPrimitiveCollection_.call<void>("add", *options); | ||
++numGeometryInstances_; | ||
} | ||
|
||
[[nodiscard]] NativeJsValue CesiumPointPrimitiveCollection::toJsObject() const | ||
{ | ||
return *pointPrimitiveCollection_; | ||
} | ||
|
||
bool CesiumPointPrimitiveCollection::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
Oops, something went wrong.