Comments (9)
Hi! You all right.
I check documentation of Cesium and my code... In Cesium documentation says: The canvas element or a Promise to the canvas element that represents the generated pin. But in real always return Promise...
You can use fromUrlPromise or update master branch
from cesiumjs4gwt.
Did this help you solve the problem?
from cesiumjs4gwt.
No, if you read my comment again you'll see I also tried using the fromUrlPromise
method but received an exception doing so. Can you confirm calling that method doesn't work?
from cesiumjs4gwt.
Sorry, my mistake.
Fixed
Now
Promise<CanvasElement, Void> promise = pinBuilder.fromUrlPromise("https://cesiumjs.org/images/logos/cesium/Logo_Color_White.svg", Color.BLUE(), 48);
promise.then(new Fulfill<CanvasElement>() {
@Override
public void onFulfilled(CanvasElement value) {
Cesium.log(value.toDataUrl());
}
});
Return data:image/png;base64 string
Can you pull master and check ?
from cesiumjs4gwt.
Yes, calling toDataUrl() does return the base64 string, so that works correctly now. However, I've been wrestling with several other issues today, which is why it's taken me so long to respond...
-
I'm developing in GWT Super Dev mode, and when I built your latest master and used in my project, now the GWT compile fails when I try loading the page in Chrome (but it still compiles and loads correctly in IE and FF). When I revert back to the previous version of your project I've been using before today -- 1.37.4 -- Chrome loads correctly again. When I switched these references back and forth, I also switched the referenced Cesium.js versions between 1.37 and 1.39 too, so it "shouldn't" be a compatibility issue. So, I don't know if there's another change you recently made in your master branch that's causing this problem, but it's quite strange how it only fails in Chrome.
-
So with that issue happening, I proceeded to test the fix you made by using IE and FF. Now the problem is, when I get the image's base64 string from the CanvasElement, I want to use that to display the image on a billboard. Using a URL works for the BillboardGraphicsOptions.image property, but it seems to choke when setting it as the base64 string. Is there a recommended way to do a base64-to-URL conversion that's built into Cesium? Or should I look at using another open source lib for that? Or is there some other way to specify the billboard's image from the CanvasElement given by the Promise?
-
Once I looked further into using a pin as a billboard, then I realized that unfortunately the BillboardGraphicsOptions.height is used for specifying the height in pixels; however, I was hoping to set the height of the pin/billboard as a number of meters for it to be displayed above the surface. Is it possible to do that, or are billboards only meant to be positioned by a pixel-offset from its coordinate point?
-
After having all those issues, I was hoping instead of using the pin/billboard combination, maybe I could draw a circle/ellipse and set its material as the image I want, which would give a similar effect to the user. For this I tried to use the Cesium.loadImage method, specifying 'true' for the allowCrossOrigin parameter. However, again I had issues -- all browsers showed console errors indicating the image requests failed due to CORS, even though these images are already loaded and displayed in non-Cesium sections elsewhere in my GWT app. Would you happen to know why loading these images would fail using that method, when I'm simply trying to load images from Amazon cloudfront?
from cesiumjs4gwt.
- Last version worked fine in SuperDev mode in FF and Chrome (Can you send error of compiler ?). Maybe its critical changes in CesiumJS which i translated into gwt-cs.
- Add new example. Several methods for load images. How i understand, PinBuilder transform images to 8bit, not use them, use Canvas (see example)
- I do this, if i correct understood you, through collapse BoxGraphic by y or x coordinate, and set size BoxGraphic in metres.
ImageMaterialPropertyOptions imageMaterialPropertyOptions = new ImageMaterialPropertyOptions();
imageMaterialPropertyOptions.image = new ConstantProperty<>(video.getVideoElement());
BoxGraphicsOptions boxGraphicsOptions = new BoxGraphicsOptions();
boxGraphicsOptions.dimensions = new ConstantProperty<>(new Cartesian3(320, 0, 240));
boxGraphicsOptions.material = new ImageMaterialProperty(imageMaterialPropertyOptions);
entityOptions = new EntityOptions();
entityOptions.name = "Video";
entityOptions.position = new ConstantPositionProperty(position);
entityOptions.box = new BoxGraphics(boxGraphicsOptions);
Entity entity = viewer.entities().add(new Entity(entityOptions));
video.getElement().setId("video-" + entity.id);
4. By this, you try ask on official Cesium forum. Maybe need write proxy, and work through them.
from cesiumjs4gwt.
-
At the bottom of this post is what I see printed in the dev mode console when trying to load in Chrome.
-
OK, following the "Pin billboard through fromUrl" example, I now see my pins displayed with my images. However, now I realize that Cesium's PinBuilder displays the images as black and white :( I'll ask about this on their forum if I continue trying to use the PinBuilder (because my goal is to display the pin shape with an opaque color, along with a not-black-and-white image)
-
Thanks, I may try that instead of using the PinBuilder for the reason mentioned above.
-
Yeah, this is probably due to my current localhost/Dev Mode setup, so I'll consider a proxy if needed later.
GET /recompile/fitworld
Job com.fitworld.FitWorld_1_0
starting job: com.fitworld.FitWorld_1_0
binding: user.agent=safari
Compiling module com.fitworld.FitWorld
Unification traversed 7887 fields and methods and 1391 types. 49 are considered part of the current module and 299 had all of their fields and methods traversed.
[WARN] Some stale types ([com.fitworld.client.view.globe.UserActivityEntityItem$2]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.
Warnings in org/cesiumjs/cs/datasources/properties/ConstantPositionProperty.java
[WARN] Line 72: [unusable-by-js] Type of parameter 'referenceFrame' in 'void ConstantPositionProperty.setValue(Cartesian3, Integer)' is not usable by but exposed to JavaScript.
Warnings in org/cesiumjs/cs/datasources/properties/PositionProperty.java
[WARN] Line 53: [unusable-by-js] Type of parameter 'referenceFrame' in 'Cartesian3 PositionProperty.getValueInReferenceFrame(JulianDate, Integer)' is not usable by but exposed to JavaScript.
[WARN] Line 62: [unusable-by-js] Type of parameter 'referenceFrame' in 'Cartesian3 PositionProperty.getValueInReferenceFrame(JulianDate, Integer, Cartesian3)' is not usable by but exposed to JavaScript.
[WARN] Suppress "[unusable-by-js]" warnings by adding a @SuppressWarnings("unusable-by-js") annotation to the corresponding member.
Compiling 1 permutation
Compiling permutation 0...
[ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:111)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:130)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118)
at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146)
at com.google.gwt.dev.jjs.ast.JVisitor.acceptWithInsertRemove(JVisitor.java:168)
at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:94)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135)
at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122)
at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:786)
at com.google.gwt.dev.jjs.ast.JConstructor.traverse(JConstructor.java:142)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146)
at com.google.gwt.dev.jjs.ast.JVisitor.acceptWithInsertRemoveImmutable(JVisitor.java:172)
at com.google.gwt.dev.jjs.ast.JClassType.traverse(JClassType.java:147)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122)
at com.google.gwt.dev.jjs.ast.JProgram.visitModuleTypes(JProgram.java:1284)
at com.google.gwt.dev.jjs.ast.JProgram.traverse(JProgram.java:1249)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122)
at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.execImpl(ControlFlowRecorder.java:163)
at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.exec(ControlFlowRecorder.java:46)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.maybeRecordReferencesAndControlFlow(JavaToJavaScriptCompiler.java:474)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:349)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:272)
at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:198)
at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:50)
at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:74)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.google.gwt.dev.jjs.ast.JMethod.getJsniSignature(JMethod.java:615)
at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.computeName(ControlFlowRecorder.java:50)
at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.processMethodCall(ControlFlowRecorder.java:195)
at com.google.gwt.dev.jjs.impl.ControlFlowRecorder.visit(ControlFlowRecorder.java:158)
at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
... 32 more
[ERROR] at FitWorld.java(30): this.Object.Object()
com.google.gwt.dev.jjs.ast.JMethodCall
[ERROR] at FitWorld.java(30): this.Object.Object()
com.google.gwt.dev.jjs.ast.JExpressionStatement
[ERROR] at FitWorld.java(30): {
this.Object.Object();
this.$init();
}
com.google.gwt.dev.jjs.ast.JBlock
[ERROR] at FitWorld.java(30): {
this.Object.Object();
this.$init();
}
com.google.gwt.dev.jjs.ast.JMethodBody
[ERROR] at FitWorld.java(30): public FitWorld();
com.google.gwt.dev.jjs.ast.JConstructor
[ERROR] at FitWorld.java(30): com.fitworld.client.FitWorld (extends Object implements EntryPoint)
com.google.gwt.dev.jjs.ast.JClassType
[ERROR] at Unknown(0): <JProgram>
com.google.gwt.dev.jjs.ast.JProgram
[ERROR] Unrecoverable exception, shutting down
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.javac.CompilationProblemReporter.logAndTranslateException(CompilationProblemReporter.java:106)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:459)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:272)
at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:198)
at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:50)
at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:74)
at java.lang.Thread.run(Thread.java:748)
[ERROR] Not all permutation were compiled , completed (0/1)
[WARN] recompile failed
[WARN] continuing to serve previous version
from cesiumjs4gwt.
Sorry, i can diagnose error. If you repository is actual, then error placed in EntryPoint.
Maybe conflict in gwt-material... With gwt-material not start Jetty in IntelliJ Idea...
In last update i up GWT version to 2.8.2, JsInterop to 1.0.2 and set source compile to java 1.8....
Try update and recompile you project with clear all caches and etc..
from cesiumjs4gwt.
Yeah, I am using all those same versions, and like I said before it's a very strange error because for some reason it only happens in Chrome and there's no issue with my EntryPoint normally. I will double check clearing caches too. Maybe there's a problem in my build environment because this issue occurred when I built your master and used that Jar. So, I'll try upgrading again when you produce a new release of 1.39.*
Thanks for all the help! Since you made a fix for the PinBuilder I'll close this issue now. 👍
from cesiumjs4gwt.
Related Issues (10)
- CesiumNavigation, TypeError: e is not a function HOT 1
- Cannot Add Custom Terrain HOT 4
- Integration with Vaadin 8 HOT 5
- Error Running the clone : import org.cesiumjs.cs error HOT 2
- Property Name Spelling HOT 1
- Script injector HOT 1
- Cesium 1.42 Released HOT 2
- ProviderViewModel support for custom BaseLayerPicker HOT 1
- Entity position as CallbackProperty HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cesiumjs4gwt.