how to display lightmaps in the appcreator - archilogic

running on macbook iOs X(yosemite) and chrome browser,
i try to view an archilogic model:
Model Used
in https://appcreator.3d.io/
but the result doesn't seem to display the same lightmaps mapping on interiors:
https://app.3d.io/lLOkYR

This might be due to the fact that the lighting system in spaces editor is a different one than the lighting system in aframe. I recommend you to adjust the lighting in your aframe scene using the following parameters (search for these values inside your html code in the app creator):
lightMapIntensity: 1.887; lightMapExposure: 0.55
also you can adjust overall lighting intensity by modifying:
<a-scene io3d-lighting="intensity:0.9">

Related

Rendering problems when saving multiple Dygraphs as a PNG on mobile devices

I have a web application that uses Dygraphs to create charts.
The application allows a user to create multiple Dygraph charts (each with their own Y-Axis) that will be stacked on top of each other.
Here's an example of what the multiple Dygraphs look like on a PC browser: Notice that the example displays three different Dygraphs each having their own Y-axis, but the X-axis is hidden for the top 2 charts and visible on the bottom chart.
I will allow the user to save the chart to disk as a PNG. - The way I currently save the multiple Dygraphs as one PNG is:
Create a target canvas that will be used to contain all the visible Dygraphs
Extract each canvas out of each Dygraph, then add each canvas to the target canvas **
Create a PNG via the .toDataURL() function on the target canvas
Here's an example of what the above screenshot looks like when saved as one PNG: (This is exactly what I want from the PNG)
The procedure works fine on browsers on a PC. But when I attempt to save the multiple Dygraphs into one PNG on a phone/tablet browser, the resultant PNG doesn't match the graph that is visible on the screen.
Example:
Here's what the multiple Dygraphs look like on an iPad (screenshot)
And here's what the resultant PNG looks like (Notice how the width and height of each chart does not match the actual iPad display).
I don't understand why the PNG is rendered correctly when I use a PC browser, but is not rendered correctly when I use a browser on a mobile device.
I'm not sure if this problem is due to limitations of the Canvas.toDataURL() function or if this is a Dygraphs problem or something else. I'm fishing for advice that may point me in the right direction and/or shed light on this particular problem.
**I should mention that I use Juan Manuel Caicedo Carvajal's Dygraph-Export extension
I'm guessing the Problem occurs, because the generated canvas isn't rendered fully to the responsive screen of an iPad.
You can try to export the original canvas (instead of generating a new one with the said library) yourself with toDataUrl https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL
Dygraphs generates 2 canvas, one for the legend and one for the actual graph and lays them ontop of each other. So make sure you choose the right one (not the _hidden_canvas). If the examples works you can draw the legend onto the graph canvas with canvas.drawImage(otherCanvas)
How to Copy Contents of One Canvas to Another Canvas Locally
Hope this helps. Keep me updated!
My workaround/hack for the problem stated in my OP was to make a change to the Dygraph source in the Dygraph.getContextPixelRatio function.
Notice in the code below that I set devicePixelRatio = 1
dygraph-combined.js
Dygraph.getContextPixelRatio = function (context) {
try {
//var devicePixelRatio = window.devicePixelRatio;
var devicePixelRatio = 1; // Hack!!!
var backingStoreRatio = context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
if (devicePixelRatio !== undefined) {
return devicePixelRatio / backingStoreRatio;
} else {
// At least devicePixelRatio must be defined for this ratio to make sense.
// We default backingStoreRatio to 1: this does not exist on some browsers
// (i.e. desktop Chrome).
return 1;
}
} catch (e) {
return 1;
}
};
In my case, this hack fixed my problem (stated in the OP) and didn't negatively affect any other parts of my application that uses Dygraphs. That said, if you find a better/correct way to fix the problem stated in the OP, please share.

Drupal OpenLayers how to solve : The layer cannot be reprojected to the map projection: EPSG:

Here is my adventure. On this page I would like to display our bicycle route.
I am using in drupal 7:
Openlayers 7.x-2.0-beta3
OpenLayers KML Layer 7.x-1.0-beta1 (I'm not sure if I need this module as well)
layer: openlayers_kml_example with the source a url to a file.
map : example_kml Example KML Map
The result is that the layer is displayed very very small on the big map. So if you zoom in to the airplane eventually you can see the track.
Map Projection set to 3857
Display Map Projection set to 4326 (the KML is made with Google earth. I think not important as there is no interaction only displaying.
LAYER SPECIFIC OPTIONS FOR KM extract styles and attributes ON.
If I put tracks on then I will miss the nice airplane icon.
I keep getting the same logs and of course no display on the page:
MESSAGE The layer cannot be reprojected to the map projection: EPSG:
MESSAGE Notice: Undefined variable: map in openlayers_layer_sanity_check() (line 399
MESSAGE Notice: Undefined property: stdClass::$name in openlayers_layer_sanity_check()
As it is not nice for people to think that I'm cycling constantly in water I would like to solve it :-)
Any suggestions?
John is correct in describing the issues but here is the solution :-)
Update drupal module openlayers to the latest version, currently 7.x-2.0-beta9.
Take care of the needed dependencies.
I reset all my layers and maps to the orginial and then adjusted the source of the kml layer to a file.

Online Maps (google, nokia)

Is it possible to highlight a list of countries with a different colors?
I need to display some countries' statistics on the world map.
Now I use an image and fill a region with color (calculated for each country) by country's coordinates. It's a simple solution and it works well. But now I need to specify the countries' name too (and I think it's not the last customization).
There is a polygon solution, but it uses an array of coordinates. I don't think it's a suitable solution to highlight countries's territory.
I haven't found a solution yet. Any suggestions?
Thanks in advance.
Highlighting countries or regions to support statistics is known as Choropleth Mapping
, but unfortunately there usually isn't direct library support for Choropleth maps bundled into an online map API. This means you'll have to create your own framework, but fortunately it is possible to create one - I wrote an example using jQuery + HERE Maps to
answer the question here
Updated WKT solution now available
Access to KML shapes is no longer required, since the Geocoder API now offers an IncludeShapes attribute which returns the shape of a country in WKT format. A WKT parser can be found here.
A simple WKT choropleth example can be found here.
KML Base solution
For any framework you will need to have a file holding the boundaries of the countries or regions you need. The example uses a KML file, but you could also start with polygons if you had them. Country borders are a political minefield, which is the reason I guess most online mapping APIs steer clear of them. As a hint: try starting with something like http://geocommons.com/overlays/119819 and simplify it as much as possible to speed up the rendering- many small wiggles in the coast lines and small outlying islands are unnecessary.
Of course you could also try searching for "create choropleth map" from a search engine of your choice and use an tool to create a static image for your data (potentially at several zoom levels) and then use this as the basis of an map tile overlay. This requires a lot more work up front, but would push all the calculations server side and hence be faster to display.
Working example can be found on GitHub here
You could put the country's name into the image. It's not that difficult to place text into an image. The only tricky bit is if you are using tiles, you need to deal with names that cross tile boundaries by drawing the name once for each tile.

how to adapt my cocos2d-x app on iphone 5

My game is designed with cocos2d-x, the picture resource size is 320x480, which is adapted to iphone4, now I want my game adapt to iphone5, what should I do?, thanks!
It actually depends on your current cocos2d-x version and the resolutions you're planning to support. But basically if you're running the latest stable release (2.0.4) and you only want to support iPhone4 and iphone5 resolutions then you have to:
create the art for both resolutions (this is not mandatory but the graphics might be scaled too much and lose quality).
define at runtime the DesignResolutionSize and ContentScaleFactor based on the actual device's resolution
select the correct resource path
Here a simple example on how it can be implemented:
// Get the real screen size
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// Set the design resolution. Please see the doc for the different modes
pEGLView->setDesignResolutionSize(480, 320, kResolutionNoBorder);
// Here you have to chose between width or height depending your game's design
if (frameSize.width > 480) {
// iphone5
pDirector->setContentScaleFactor(1136/480);
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
} else {
// iphone4
pDirector->setContentScaleFactor(1);
CCFileUtils::sharedFileUtils()->setResourceDirectory("sd");
}
/// Now load the sprites....
If you're want to support more iOS/android resolutions please refer to the following links for fullscreen multi-resolution solutions offered by cocos2d-x:
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources
Hope it helped.
Cocos2D-x 2.0.4+ have very easy solution for multi-resolution problem. ( either iDevices or Android devices.)
In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution.
If target device really has this resolution ( or some other but with same ratio) cocos2d will handle to fix screen and your game looks same in all devices.
And when ratio of target device is different, you have many option ( as cocos2d language, policy) to manage that.
For example if you use Exact fit policy, cocos2d will force your game ( and design) to fit target device screen (without that black boarder).
Exact fit
The entire application is visible in the specified area without trying
to preserve the original aspect ratio. Distortion can occur, and the
application may appear stretched or compressed.
For more detail just take a look at this link : http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support

Stock chart in ExtJS 4

How can I draw an stock chart or a line chart with hundreds points?
I disabled animation in regular line chart, but not successful and still too heavy and slow.
I've recently written a blog post on creating stock charts in Ext JS 4 - http://www.scottlogic.co.uk/2011/12/ext-js-4-stock-charts/. It uses a couple of hundred points and performs fine in modern browsers and isn't too bad in IE7-8.
This said however, even after messing with the Ext JS build system, the minimum Ext build required to run the charts is still something like .5MB which is too heavy weight for some applications. The CSS however can be chopped down to just a few rules - if you're willing to spend the time trying to figure out which ones you need out of the huge ext-all.css!
My app is completely Ext-JS based. However, when performance is a problem, I use flot. The API is much better designed (and I'm an Ext-JS fan boy) and it performs much better. This is at the expense of working with raw pixel data (canvas, which is pixel based) if you need to interact with the chart. Since in Ext-JS, everything is an SVG object, you can simply attach event handlers to the lines, or anything else you draw yourself.
For example. For a wave monitor, we use flot. For another chart where we let the user drag and drop some lines on the screen, we use Ext-JS charts.
Here's a simplistic wrapper to use flot as an Ext.Component
Ext.define('cci.view.wavemon.Flot', {
extend: 'Ext.Component',
alias: 'widget.cci-flot',
/**
* #cfg {number[][]} data The data to be drawn when it gets rendered
*/
data: null,
/**
* #cfg {object} flotOptions
* The options to be passed in to $.plot
*/
flotOptions: null,
/**
* #property
* The Flot object used to render the chart and to manipulate it in the future. It will only
* be available after the first resize event
* You may not set this property but you are free to call methods on it
*/
flot: null,
initComponent: function() {
this.callParent(arguments);
// The only time that we're guaranteed to have dimensions is after the first resize event
this.on('resize', function(comp) {
if (!this.flot) {
this.flot = $.plot(this.getTargetEl().dom, this.data, this.flotOptions);
} else {
// Flot knows to look at the containers size and resize itself
this.flot.resize();
}
}, this);
}
});
If you generate extjs code dynamically (php, python, asp.net...) and data source is static - you can easily generate chart to png and load it at ext.panel.
I've found flot (http://code.google.com/p/flot/) to have much better performance with many points / series, whereas the performance of the ExtJS 4 charts was unacceptable. Flot also has a clearer API and reads data in a simple format.
There's a complete example on how to create stock line charts for Sencha Charts here:
http://dev.sencha.com/deploy/touch-charts-1.0.0/examples/Stock/
As you can see, the example handles > 100 data points easily.
The example is for touch charts, but the API is nearly identical to what's in Sencha's ExtJS 4. Copy and pasting the chart instanciation code should do the work.

Resources