leelight's blog

WebGIS-China - Interactive maps, data and diagrams about China Recent Climate Change

I found one WebGIS application for china recent climate change here, http://www.webgis-china.de/, some scholars from Gutenberg University did that. The website assesses recent Climate Change in China over the past 50 years. " Well-adopted statistical methods of trend computations that are commonly applied for climatic change studies were applied for this study based on monthly temperature records over the 50 year observation period 1951 - 2000 for totally 165 main meteorological stations. The reference stations are located all over China though they are preferably distributed over the eastern part of the country."

53 CSS-Techniques You Couldn’t Live Without-and many other CSS and Scripts from smashing magazine

If you are a web designer, I am sure you will like it, 53 CSS-Techniques You Couldn’t Live Without, from a wonderful site, smashing magazine. The webmaster of the site did great effort to collect those things, I really appreciate that! Here I just list some of it, and take it into my bookmark. You can go there to get the full list.
4. CSS Bar Graphs (CSS For Bar Graphs)

CSS-Technique

Combine PDF with GIS?

Is there some relationship between PDF and GIS? As I thought before, it is enough to display the map using PDF. Interaction with PDF? Just like SVG, Flash, or Ajax? Interesting but impossible. But GeoPDF from Terragotech has broken the embarrass.
You need download one small plugin for Arcobat PDF reader, it is free.
The GeoPDF Toolbar allows you to view multiple coordinate display, re-project to most coordinate systems, measure distance and bearing, zoom to any coordinate, and connect to GPS and track. Here you can view some demo how to use it.

Touch J2ME Polish--6. GUI DIY with CSS style definition

I MUST say firstly that using CSS to define the GUI in J2ME application is a VERY VERY SMART idea!
What is CSS?
Cascading Style Sheets, was widely used in XHTML and webdesigning, the designers cant separate the style from the HTML userinterface, that means the programmer can only do his part of HTML interface designing, and the beautification and decoration of interface could be left to art designer. For example, look at the menu of this page, if one day I am tired of the current style of easywms.com, I DO NOT have to modify the HTML code for each page, I just need modify the css file and every page will change its style. 

Overlaying Google Map with MapInfo point data using Map2GMap

For MapInfo Professional a small MapBasic application called Map2GMap (right-click for download) has been programmed which generates a complete HTML page which integrates Google's Map object overlayed with point data from a MapInfo table. By clicking on a marker an info window pops up displaying attribute information gained from the objects in the table.

Prof. Behr has brought us this software 2 years ago, but I just got to know this morning. I think more people could need it. What you need is install this plugin in MapInfo and apply for a Google map key for your website and output the fully html file. The html containing the points geometries and javascript code for controlling. Copy the html file to your website and view.

WMS Sites, A collection of useful Web Mapping Service sites

Today I happened to find one interesting site for WMS server: http://wms-sites.com/
This site is one collection of useful Web Mapping Service sites, which aimimg to be a visual catalog of public Web Mapping Service (WMS) resources online.

The webmaster has collected many WMS servers, and you can view the WMS Layers.
To browse the WMS sites in the catalog, enter some keywords in search box above, or see site listings in the catalog.  By following links to individual layers, you can see those mapped layers.  Sample searches: weather, ortho-photos, boundaries, topography, transportation.

Happy Chinese New Year for Everyone Here!!!

Hi, everyone who visits my site today, happy chinese new year!
Today is chinese New Year's Eve, And tomorrow is chinese Pig Year~~
Pig in Germany means lucky, in China also means prosperity and happiness.

And I wish you  and your family, your lover will be happy, peace and health in the new year!!!!

yours
leelight
2007.02.17

Touch J2ME Polish--5. First Application, begin with Loading Splash Screen

If you have used some J2ME applicaitons, e.g. some games, almost all of them will give you one loading splash screen when you start the game, or before you enter the next stage the waiting splash screen will tell you the progress of data loading. The standard solution is to provide a splash screen and do the necessary initialization in a background thread. And if you have done this before, your code will look like this:

//firstly difine one class to draw the logo and string on canvas
    public class SplashCanvas extends Canvas {
    
        protected void paint(Graphics g){
            try {
                icon_start=Image.createImage("/welcome.png");
            } catch (java.io.IOException e) {
                icon_start=null;
                System.out.println("Load image error when initializing Exception happens:" + e.getMessage());
            }
            g.drawImage(icon_start,getWidth()/2, getHeight()/2-15, Graphics.BOTTOM| Graphics.HCENTER);
           
            g.drawString("EasyWMS 1.00", getWidth()/2, getHeight()/2, Graphics.BOTTOM| Graphics.HCENTER );
            g.drawString("Loading...", getWidth()/2, getHeight()/2+15, Graphics.BOTTOM| Graphics.HCENTER );
            splashIsShown=true;
           
        }
        protected Graphics clearScreen(Graphics g) {
              // clear screen
              g.setColor(255, 255, 255);
              g.drawRect(0, 0, this.getWidth(), this.getHeight());
              return g;
             }
       
    }

//will run the splash screen in one background thread, for the further calling
   public class SplashScreen implements Runnable{
        private SplashCanvas splashCanvas;
       
        public void run(){
            splashCanvas = new SplashCanvas ();     
            display.setCurrent(splashCanvas);
            splashCanvas.repaint();
            splashCanvas.serviceRepaints();
            while(!isInitialized){
                try{
                    Thread.yield();
                }catch(Exception e){}
            }
        }     
    }  

//impletement this class as one thread, like this:
//public class genisMIDlet extends MIDlet implements Runnable{
//then give the run method
    public void run(){
        while(!splashIsShown){
            Thread.yield();
        }      
        doTimeConsumingInit();      
        while(true){
            // soft loop          
            Thread.yield();
        }
    }
   
//the splash will keep on displaying 3 seconds and then go to the main form automatically
    private void doTimeConsumingInit(){
        // Just mimic some lengthy initialization for 3 secs
        long endTime= System.currentTimeMillis()+3000;
        while(System.currentTimeMillis()<endTime ){}

        controller=new UIController(this);
        controller.init();
        isInitialized=true;
    }

//at last,  open 2 threads when initialize the application
    protected void startApp() throws MIDletStateChangeException {
        Thread splashthread= new Thread(new genisMIDlet.SplashScreen());
        splashthread.start();

     //now you can also load the data from database or something.....
        Thread thisThread = new Thread(this);
        thisThread.start();
    }

And if there are others progress need to give the user one waiting screen, those code will be write again with differnt string and image. Are you tired? Yes, I am tired of this.Polish provides the de.enough.polish.ui.splash.InitializerSplashScreen for this task. The splash screen shows an image along with an optional string message and initialize the actual application in a backgroud thread.  This is the code example:

package de.enough.polish.sample.splashScreen;

import java.io.IOException;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
import de.enough.polish.ui.splash.InitializerSplashScreen;
import de.enough.polish.ui.splash.ApplicationInitializer;;

public class SplashScreenDemo extends MIDlet
//#if !polish.clases.ApplicationInitializer:defined
    implements ApplicationInitializer
//#endif
{
    private Screen mainScreen;
    private Display display;
   
    protected void startApp() throws MIDletStateChangeException {
        this.display = Display.getDisplay(this);
        if(this.mainScreen !=null){
            //the MIDlet has been paused;
            this.display.setCurrent(this.mainScreen);
        }else{
              //the MIDlet is started for this first time
              try{
                  Image image = Image.createImage("/welcome.png");
                  int backgroundColor = 0xFFFFFF;
                  String readyMessage = "Press any key to continue...";
                  //Set readyMessage = null to forward to the next
                  //displayabe as soon as it's available
                  int messageColor = 0xFF0000;
                  InitializerSplashScreen splashScreen = new InitializerSplashScreen(this.display
                  ,image, backgroundColor, readyMessage,messageColor,this);
                  this.display.setCurrent(splashScreen);
              }catch(IOException e){
                throw new MIDletStateChangeException("Unable to load splash image");
              }
        }
    }

    public Displayable initApp(){
        //initialize the application.e.g. read data from record store,etc
        //.......
        //now create the main menu screen:
        //e.g. this.mainScreen = new Form("Main Form");

        this.mainScreen = new Form("Main Form");

        return this.mainScreen;

    }
   
    protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
        // TODO Auto-generated method stub
       
    }

    protected void pauseApp() {
        // TODO Auto-generated method stub
       
    }
}
Splash Loading Screen:

Go to the main Form:

Have you seen that, only one function could do everything, creates a new InitializerSplashScreen using the internal default view.
public InitializerSplashScreen(Display display, Image image, int backgroundColor, java.lang.String readyMessage, int messageColor, ApplicationInitializer initializer)The message will be shown in the default font.Parameters:

Touch J2ME Polish--4. Test with Polish Example

If you selected install the polish example when you install the polish, now you can find about 10 examples in samples folder in your polish root folder. You havnt found? I have told you before, please update your harddisk to a big one~
Those examples are very very valuable for the polish beginners, including me. They are the basic interface of Polish UI and some simple application to help you create your own project.

Before the testing of these example, I record one error I have met today, maybe it is useful for you.

Touch J2ME Polish--3. Debug and Build with Ant

At first you should pay attenion to the source folder, if you have converted one existing project to Polish project. Polish's default source directoty is source/src, and default resource directory is resources. Please go to the project's properties and change the Java Build Path setting like this. Otherwise you can not build it successfully.

Now you can debug or build the project with Ant.

Syndicate content