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
class MyClass { | |
void loadData() { | |
String data_url = "http://4pcbr.com"; | |
HTTPLoader loader = new HTTPLoader(); | |
try { | |
loader.load( data_url, new LambdaHandler() { | |
public void success( String res ) { | |
handleResponse( res ); | |
} | |
} ); |
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
import java.net.*; | |
import java.io.*; | |
interface LambdaHandler { | |
public void success( String response ); | |
} | |
class XMLLoader implements Runnable { | |
LambdaHandler handler; |
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 == current PApplet instance */ | |
HTMLRequest req1 = new HTMLRequest(this,"http://url1.com/req1"); | |
HTMLRequest req2 = new HTMLRequest(this,"http://url2.com/req2"); |
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
Vec2f next_point = Vec2f( lat * 180 / M_PI, lon * 180 / M_PI ); | |
Vec2f tmp_next_point = next_point; | |
if ( this->via_pacific ) { | |
if ( next_point.y * current_point.y < 0 ) { | |
this->shape.moveTo( Mercator::mapLatLon( Vec2f( next_point.x, ( next_point.y > 0 ) ? ( next_point.y - 180 ) : ( next_point.y + 180 ) ) ) ); | |
} | |
tmp_next_point = Vec2f( next_point.x, ( next_point.y > 0 ) ? ( next_point.y - 180 ) : ( next_point.y + 180 ) ); | |
} |
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
if ( ( ( this->lon_range ) > ( 360 - this->lon_range ) ) && ( this->from.y * this->to.y < 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
current_point = this->from; | |
/* just a direction */ | |
this->sign = ( ( this->from.y - this->to.y ) > 0 ) ? -1 : 1; | |
for ( int j = 0; j < this->steps; ++j ) { | |
float lon = ( current_point.y + this->sign * this->step_lon ) * M_PI / 180; | |
float lat = atan( ( tan( this->lat1 ) * sin( this->lon2 - lon ) / sin( this->lon2 - this->lon1 ) ) + ( tan( this->lat2 ) * sin( lon - this->lon1 ) / sin( this->lon2 - this->lon1 ) ) ); | |
Vec2f next_point = Vec2f( lat * 180 / M_PI, lon * 180 / M_PI ); | |
/* draw line */ | |
current_point = next_point; |
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
#include "Mercator.h" | |
#include "cinder/app/AppBasic.h" | |
#include "cinder/Vector.h" | |
using namespace ci; | |
using namespace std; | |
/* static method to map latitude and longitude to mercator 2d coords */ | |
Vec2f Mercator::mapLatLon( const Vec2f lat_lon ) { | |
/* mercator projection center was screen centered */ | |
Vec2f offset = Vec2f( app::getWindowWidth() / 2, app::getWindowHeight() / 2 ); |
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
import org.json.*; | |
import simpleML.*; | |
XMLRequest xmlRequest; | |
String apiHost = "http://example.com"; | |
void setup() { | |
HTMLRequest req = new HTMLRequest( this, apiHost + "/data.json" ); | |
req.makeRequest(); | |
} |
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
window.i18n = (() -> | |
__def_loc = "en_US" | |
{ | |
locale: (loc) -> | |
if loc != undefined | |
__def_loc = loc | |
else | |
__def_loc | |
, bind: (o) -> | |
if o.i18ze == undefined |
NewerOlder