use of org.cesiumjs.cs.js.JsObject in project gwt-cs by iSergio.
the class Materials method applyPolylineOutlineMaterial.
public void applyPolylineOutlineMaterial(Polyline primitive) {
JsObject jsOobject = JsObject.create();
primitive.material = Material.fromType("PolylineOutline", JsObject.$(jsOobject, "outlineWidth", primitive.width / 2.0));
}
use of org.cesiumjs.cs.js.JsObject in project gwt-cs by iSergio.
the class Materials method applyPolylineGlowMaterial.
public void applyPolylineGlowMaterial(Polyline primitive) {
JsObject jsOobject = JsObject.create();
primitive.material = Material.fromType("PolylineGlow", JsObject.$(jsOobject, "innerWidth", primitive.width / 2.0));
}
use of org.cesiumjs.cs.js.JsObject in project gwt-cs by iSergio.
the class CirclePrimitive method getPositions.
public Cartesian3[] getPositions() {
EllipsePositionsOptions options = new EllipsePositionsOptions();
options.semiMajorAxis = getRadius();
options.semiMinorAxis = getRadius();
options.center = getCenter();
options.granularity = granularity;
options.rotation = 0;
JsObject jsObject = EllipseGeometryLibrary.computeEllipsePositions(options, false, true);
if (jsObject.getObject("outerPositions") == null) {
return null;
}
List<Cartesian3> positions = new ArrayList<>();
JsArray<Number> nativePositions = (JsArray<Number>) jsObject.getObject("outerPositions");
for (int i = 0; i < nativePositions.length(); i += 3) {
double x = JsObject.getNumber(nativePositions, i).doubleValue();
double y = JsObject.getNumber(nativePositions, i + 1).doubleValue();
double z = JsObject.getNumber(nativePositions, i + 2).doubleValue();
positions.add(new Cartesian3(x, y, z));
}
return positions.toArray(new Cartesian3[positions.size()]);
}
use of org.cesiumjs.cs.js.JsObject in project gwt-cs by iSergio.
the class CustomGeocoder method buildPanel.
@Override
public void buildPanel() {
OpenStreetMapNominatimGeocoder openStreetMapNominatimGeocoder = new OpenStreetMapNominatimGeocoder();
openStreetMapNominatimGeocoder.geocode = new OpenStreetMapNominatimGeocoder.Geocode() {
@Override
public Promise<JsObject, Void> function(String input) {
String endpoint = "http://nominatim.openstreetmap.org/search?";
String query = "format=json&q=" + input;
String requestString = endpoint + query;
Promise<JsObject, Void> promise = Resource.fetchJson(requestString);
promise.then(new Fulfill<JsObject>() {
@Override
public void onFulfilled(JsObject value) {
JSONArray jsonArray = new JSONArray(value);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.get(i).isObject();
JSONArray bboxDegrees = jsonObject.get("boundingbox").isArray();
Rectangle destination = Rectangle.fromDegrees(Double.parseDouble(bboxDegrees.get(2).isString().toString().replace("\"", "")), Double.parseDouble(bboxDegrees.get(0).isString().toString().replace("\"", "")), Double.parseDouble(bboxDegrees.get(3).isString().toString().replace("\"", "")), Double.parseDouble(bboxDegrees.get(1).isString().toString().replace("\"", "")));
GeocoderResult geocoderResult = new GeocoderResult();
geocoderResult.displayName = jsonObject.get("display_name").isString().toString();
geocoderResult.destinationRectangle = destination;
jsonArray.set(i, new JSONObject((JsObject) (Object) geocoderResult));
}
}
});
return promise;
}
};
ViewerOptions viewerOptions = new ViewerOptions();
viewerOptions.geocoder = openStreetMapNominatimGeocoder;
csVPanel = new ViewerPanel(viewerOptions);
contentPanel.add(new HTML("<p>Example of a custom geocoder.</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
Aggregations