From: serkan eminoglu (seminoglu@meteor.gov.tr)
Date: Wed 17 Nov 2004 - 15:56:11 EET
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.*;
import java.lang.*;
import java.util.*;
import java.net.*;
public class sicaklik extends Applet {
Image img, backimg;
int[] pixels;
int width, height;
String stemp, slat, slong;
int curX, curY;
FontMetrics fm;
Font myFont, boldFont;
public void init() {
String fn = getParameter("filename");
if (fn == null) fn = "tr_irgray.gif";
try {
URL u = new URL(getDocumentBase(), fn);
URLConnection uc = u.openConnection();
uc.setUseCaches(false);
img = getImage(uc.getURL() );
slat = " ";
slong = " ";
stemp = " ";
curX = 0;
curY = 0;
MediaTracker track = new MediaTracker(this);
track.addImage(img,0);
track.checkAll(true);
track.waitForID(0);
}
catch (Exception ie) {return ;}
width = img.getWidth(this);
height = img.getHeight(this);
pixels = new int[width * height];
backimg = createImage( width, height);
PixelGrabber pg = new
PixelGrabber(img,0,0,width,height,pixels,0,width);
try { pg.grabPixels(); }
catch (Exception ep) {System.out.println("Pixeller: "+ep);}
int stat = pg.status();
System.out.println("pg durumu = "+stat);
Font myFont = getFont();
boldFont = new Font(myFont.getName(), Font.BOLD, myFont.getSize());
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
Graphics gb = backimg.getGraphics();
gb.drawImage(img,0,0,this);
gb.setFont(boldFont);
fm = gb.getFontMetrics();
String te = "Sýcaklýk = -99.9xC";
int w = fm.stringWidth(te);
int h = fm.getHeight();
int xPos = curX+10;
if ( (curX + 25 + w) > width) {
xPos = curX - w - 10;
}
int yPos = curY;
if ( (yPos - h) < 5) {
yPos = h+5;
} else if ( (yPos + 2*h+5) > height) {
yPos = height - 2*h - 5;
}
drawBold(gb,"Sicaklik = "+stemp,xPos,yPos);
drawBold(gb,"Enlem = "+slat,xPos+4,yPos+h);
drawBold(gb,"Boylam = "+slong,xPos+8,yPos+2*h);
g.drawImage(backimg,0,0,this);
}
void drawBold(Graphics g, String s, int x, int y) {
g.setColor(Color.black);
g.drawString(s,x-1,y-1);
g.drawString(s,x+1,y-1);
g.drawString(s,x-1,y+1);
g.drawString(s,x+1,y+1);
g.setColor(Color.yellow);
g.drawString(s,x,y);
return;
}
public boolean mouseMove(Event e, int x, int y) {
if (x > width-1 || y > height-1) return true;
int value = pixels[x + y*width];
value = value & 0xff;
if (value < 4 ) return true;
double temp;
// temp = ( -0.5 * value) + 300. ;
temp = ( -0.5 * value) + 355.65;
// double tempC = temp - 273;
double tempC = temp - 273;
stemp = tempC+"\u00b0"+"C";
double DEGPERboy = .03324062;
double DEGPERenl = .02531214;
double lat = 40.027243 + (576/2 - y) * DEGPERenl;
double lon = 34.770970 - (768/2 - x) * DEGPERboy;
slat = c2s(lat)+"Kuzey";
slong = c2s(lon)+"Dogu";
curX = x;
curY = y;
repaint();
return true;
}
String c2s(double v) {
String s = v+".000";
int i = s.indexOf(".");
return (s.substring(0,i+3));
}
}
Serkan EMÄ°NOÄžLU
*********************************************************************
Department of Weather Forecasting Hava Tahminleri Da. Bşk.lığı
Remote Sensing Division Uzaktan Algılama Şube Müd.lüğü
Turkish State Meteorological Service Devlet Met. İşleri Genel Müd.lüğü
*********************************************************************
CC 401 06120 Ankara / TURKEY
Phone : + 90 312 302 26 20
Fax : + 90 312 359 34 30
web : www.uzaktanalgilama.sayfasi.com
e-mail : seminoglu@meteor.gov.tr
-----Original Message-----
From: Özgür Gürsoy [mailto:ozgurgursoy@netasistem.net]
Sent: 17 Kasım 2004 Çarşamba 15:48
To: linux@liste.linux.org.tr
Subject: RE: [Linux] imaj koordinatlari
En kucuge getirdigindeki deger (ornegin en sol yatay x) atiyorum 45 ise,
imaj uzerindeki imajin kendisine gore koordinati senin gordugun deger - 45'
tir ? yanlis anlamadiysam tabi :)
-----Original Message-----
From: linux-bounces@liste.linux.org.tr
[mailto:linux-bounces@liste.linux.org.tr] On Behalf Of temiz
Sent: Wednesday, November 17, 2004 2:27 PM
To: linux@liste.linux.org.tr
Subject: [Linux] imaj koordinatlari
merhaba
(umarim dogru yere dogru soro soruyorumdur)
javascript ile bir imajin, uzerindeki mousla koordinatlarini almak
istiyorum. Ancak
en kucuk degerin 0 (en sol-yatay-x) ve (en ust-dusey-y) olmadigini
goruyorum.
En kucuk imaj koordinat degerleri neden sifir degildir ? ve nasil
sifira tasiyabilirim ?
saygilar
Ahmet Temiz
______________________________________
Inflex - installed on mailserver for domain @deprem.gov.tr
Queries to: postmaster@deprem.gov.tr
______________________________________
The views and opinions expressed in this e-mail message are the sender's own
and do not necessarily represent the views and the opinions of Earthquake
Research Dept.
of General Directorate of Disaster Affairs.
Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olarak
T.C.
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikte
degildir.
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15.11.2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15.11.2004
_______________________________________________
Linux mailing list
Linux@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux
_______________________________________________
Linux mailing list
Linux@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux