国学参考      
首页 | 地理资讯 | 地理文摘 | 环境气象 | 学习园地 | 地理百科 | 地域行政 | 地理资源 | geography | 专题 | 参考文库 | 参考论坛
  当前位置:首页>地理文摘>技术应用>文章内容
用java读DXF文件(ReadWorldmap.java)源码
来源: 作者:国学 发布时间:1969-12-31  






//ReadWorldmap.java
//读取世界图对象
import java.io.*;
import java.util.*;
import java.net.*;

public class ReadWorldmap
{
private URL url;
private String FileName;
private InputStream inStream;
private InputStreamReader inStreamReader;
private BufferedReader bReader;

private String temp,temp1,temp2,temp3;
private int line;

public Worldmap worldmap=new Worldmap();

//构造函数,context是索引文件所在的URL,spec是世界图名
public ReadWorldmap(URL context,String SetName,String spec)
{
line=0;
this.url=context;
FileName=spec .NDX;
try
{
//inStream=(new URL(url,\\ SetName \\ spec \\ FileName)).openStream();
inStream=(new URL(url,SetName / spec / FileName)).openStream();
inStreamReader=new InputStreamReader(inStream);
bReader=new BufferedReader(inStreamReader);
// System.out.println( :) Begin read file FileName);
}
catch(IOException e)
{ 國學參考
// System.out.println(Connection was not found. Can not read file FileName);
}
}
//****************************************************************************
private void error_report()
{
//System.out.println( :< error appear at line line in file FileName);
}

//世界图初始化函数,返回一个世界图对象,在这个世界图对象中,仅包含世界图的基本属性,
//如坐标、放大倍数、层的信息等,而不包含具体的实体信息。
public Worldmap initialise()
{
boolean mainFlag=true;
double wmy1=0,wmy2=100; //临时变量

while(mainFlag)
{
try
{
line ;
temp=new String(bReader.readLine());
}
catch(IOException e) { error_report();}
temp=temp.trim();
StringTokenizer st=new StringTokenizer(temp,<>,);
temp1=st.nextToken();

if(temp1.equals(NAME))
{
temp2=st.nextToken();
temp2=temp2.trim();
worldmap._worldmap_name =temp2;

continue;
}

if(temp1.equals(DEC_COUNT))
{

temp2=st.nextToken();
temp2=temp2.trim();
//worldmap.dec_count=Integer.valueOf(temp2).intValue(); 國學參考

continue;
}

if(temp1.equals(BEGIN_WC))
{
temp2=st.nextToken();
temp2=temp2.trim();
temp3=st.nextToken();
temp3=temp3.trim();

worldmap._begin_world_coordinate_x=Double.valueOf(temp2).doubleValue();
// worldmap._begin_world_coordinate_y=Double.valueOf(temp3).doubleValue();
wmy2=Double.valueOf(temp3).doubleValue();

continue;
}

if(temp1.equals(END_WC))
{

temp2=st.nextToken();
temp2=temp2.trim();
temp3=st.nextToken();
temp3=temp3.trim();

worldmap._end_world_coordinate_x=Double.valueOf(temp2).doubleValue();
// worldmap._end_world_coordinate_y=Double.valueOf(temp3).doubleValue();
wmy1=Double.valueOf(temp3).doubleValue();

continue;
}

if(temp1.equals(DECLUTTER))
{
boolean dec_Flag=true; //标志变量
Declutter tempDeclutter=new Declutter();
double decy1=0,decy2=100; //临时变量

while(dec_Flag)
{
try
{
temp=new String(bReader.readLine());
}
catch(IOException e) { error_report(); } zgwwW
temp=temp.trim();
StringTokenizer st1=new StringTokenizer(temp,<>,);
temp1=st1.nextToken();
temp1=temp1.trim();

if(temp1.equals(NO))
{
temp2=st1.nextToken();
temp2=temp2.trim();

// tempDeclutter.index=temp2;

continue;
}

if( temp1.equals(NAME))
{
temp2=st1.nextToken();
temp2=temp2.trim();

tempDeclutter._declutter_name=temp2;
continue;
}

if(temp1.equals(SEG_COUNT))
{
temp2=st1.nextToken();
temp2=temp2.trim();

// tempDeclutter.segment_number=Integer.valueOf(temp2).intValue();
continue;
}

if(temp1.equals(BEGIN_WC))
{
temp2=st1.nextToken();
temp2=temp2.trim();
temp3=st1.nextToken();
temp3=temp3.trim();

tempDeclutter._begin_world_coordinate_x=Double.valueOf(temp2).doubleValue();
// tempDeclutter._begin_world_coordinate_y=Double.valueOf(temp3).doubleValue();
decy2=Double.valueOf(temp3).doubleValue();

continue;
}

if(temp1.equals(END_WC))
{
temp2=st1.nextToken();
CHINAGEOG.COM

temp2=temp2.trim();
temp3=st1.nextToken();
temp3=temp3.trim();

tempDeclutter._end_world_coordinate_x=Double.valueOf(temp2).doubleValue();
// tempDeclutter._end_world_coordinate_y=Double.valueOf(temp3).doubleValue();
decy1=Double.valueOf(temp3).doubleValue();

continue;
}

if(temp1.equals(MAX_ZOOM))
{
temp2=st1.nextToken();
temp2=temp2.trim();

tempDeclutter._display_zoomfactor_max=Double.valueOf(temp2).doubleValue();
continue;
}

if(temp1.equals(MIN_ZOOM))
{
temp2=st1.nextToken();
temp2=temp2.trim();

tempDeclutter._display_zoomfactor_min=Double.valueOf(temp2).doubleValue()*1.1;
continue;
}

if(temp1.equals(SEGMENT))
{
boolean seg_Flag=true;
Segment tempSegment=new Segment();
double segy1=0,segy2=100; //临时变量

while(seg_Flag)
{
try
{
temp=new String(bReader.readLine());
}
catch(IOException e) { error_report();}
共2页: 上一页 1 [2] 下一页
 
[收藏] [推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·激光雷达技术
·3DGIS在城市规划中的应用
·机载激光雷达LiDAR技术介绍
·Mapbasic(中文)参考手册
·扬州市数字化城市管理系统
·令人震撼!!摄影师眼中的镜头[1
·激光雷达特点、分类及其发展
·国家坐标系
·常见遥感卫星基本参数大全
·ArcGIS
·GIS在交通行业的应用
·VirtuoZo全数字摄影测量系统数字
  相关文章
·海量影像数据库管理系统解决方案
·网民必备之七种武器
·一名Delphi程序员的开发习惯
·GIS的发展动态
·1997年世界编程大赛时的参赛作品
·数字地球
·俺们这里需要购置GPS接收机(大
·可视化税务综合管理系统
·报业管理系统中的GIS应用
·“冲击波”、“冲击波克星”病毒
·GIS空间概念模型的研究
·WebGIS概述
Copyright © 2006 国学参考  All Rights Reserved Power by:HeadWind