老师给了我一个任务,就是根据经纬度画出公交的路线,各个点的经纬度已经知道了,比如:
点1,经度11620432, 纬度3998826,
点2:经度11620432 纬度3998826
点3:经度11620648 纬度3998836
点4:经度11620660 纬度3998849
点5:经度11620667 纬度3998995
经度11620667其实就是116度20分66.7秒,纬度3998995就是39度98分99.5秒
请问,如何把相邻的点连接起来形成线段?
请路过的朋友都来帮帮我,不甚感激啊
我主要是那些点,数字太大了,所以我就不会了,如果哪位高手能在帮我写出图形放大缩小的代码,那小弟会感动的失声痛哭~~~~~
点1,经度11620432, 纬度3998826,
点2:经度11620432 纬度3998826
点3:经度11620648 纬度3998836
点4:经度11620660 纬度3998849
点5:经度11620667 纬度3998995
经度11620667其实就是116度20分66.7秒,纬度3998995就是39度98分99.5秒
请问,如何把相邻的点连接起来形成线段?
请路过的朋友都来帮帮我,不甚感激啊
我主要是那些点,数字太大了,所以我就不会了,如果哪位高手能在帮我写出图形放大缩小的代码,那小弟会感动的失声痛哭~~~~~
public class TJableTest extends JPanel implements MouseWheelListener{
byte[] imageData = {
71,73,70,56,57,
97,15,0,15,0,
(byte)128,0,0,(byte)255,(byte)255,
(byte)255,0,0,0,44,
0,0,0,0,15,
0,15,0,0,2,
33,(byte)132,127,(byte)161,(byte)200,
(byte)185,(byte)205,84,(byte)128,(byte)241,
81,35,(byte)175,(byte)155,26,
(byte)228,(byte)254,105,33,102,
121,(byte)165,(byte)201,(byte)145,(byte)169,
(byte)154,(byte)142,(byte)172,116,(byte)162,
(byte)240,90,(byte)197,5,0,59
,0,0,0,0,0,0,0,0,0,0,0,0,0,0
}; public TJableTest(){
this.addMouseWheelListener(this);
}
double scale = 1;
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
super.paintComponent(g);
g2d.drawImage(new ImageIcon(imageData).getImage(), AffineTransform.getScaleInstance(scale, scale), null);
}
public void mouseWheelMoved(MouseWheelEvent e) {
if(e.getWheelRotation() == 1){
scale += scale * 0.1;
}else{
scale -= scale * 0.1;
if(scale<=1){
scale = 1;
}
}
super.updateUI();
}
public static void main(String[] args) {
JFrame jframe = new JFrame(); jframe.setSize(400,400);
jframe.add(new TJableTest());
jframe.setLocationRelativeTo(null);
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setVisible(true);
}
}