📄 mapservice.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Mapservice.java
import com.mapinfo.dp.*;
import com.mapinfo.dp.annotation.AnnotationDataProviderHelper;
import com.mapinfo.dp.annotation.AnnotationTableDescHelper;
import com.mapinfo.dp.util.LocalDataProviderRef;
import com.mapinfo.graphics.Rendition;
import com.mapinfo.graphics.RenditionImpl;
import com.mapinfo.mapdefcontainer.FileMapDefContainer;
import com.mapinfo.mapdefcontainer.OraSoMapDefContainer;
import com.mapinfo.mapj.*;
import com.mapinfo.mapxtreme.client.MapXtremeImageRenderer;
import com.mapinfo.util.DoublePoint;
import com.mapinfo.util.DoubleRect;
import com.mapinfo.xmlprot.mxtj.ImageRequestComposer;
import java.awt.Color;
import java.io.*;
import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;
public class Mapservice extends HttpServlet
{
private boolean errflag;
private String errmessage;
private String mapxtremeurl;
private String imgtype;
private int imgsizex;
private int imgsizey;
private int smallimgsizex;
private int smallimgsizey;
private Color imgbgcolor;
private String datasource;
private String database;
private String dbusername;
private String dbpassword;
private String dbtable;
private String dbnamecol;
private String dbmapdefcol;
private String filetype;
private String mdfpath;
private String gstpath;
private String mapdef;
static DoublePoint resetpoint = null;
static double resetzoom = 0.0D;
public Mapservice()
{
errflag = false;
errmessage = null;
mapxtremeurl = "http://localhost:8080/mapxtreme47/servlet/mapxtreme";
imgtype = "jpeg";
imgsizex = 480;
imgsizey = 360;
smallimgsizex = 240;
smallimgsizey = 180;
imgbgcolor = Color.white;
dbusername = "mapinfo";
dbpassword = "mapinfo";
dbtable = "mapinfo.mapdefinitions";
dbnamecol = "name";
dbmapdefcol = "mapdef";
filetype = "mdf";
mdfpath = null;
gstpath = null;
mapdef = null;
}
public void init()
throws ServletException
{
String strParam = getInitParameter("mapxtremeurl");
if(strParam != null && strParam.length() > 0)
mapxtremeurl = strParam;
strParam = getInitParameter("imgtype");
if(strParam != null && strParam.length() > 0)
imgtype = strParam;
strParam = getInitParameter("imgsizex");
if(strParam != null && strParam.length() > 0)
imgsizex = (new Integer(strParam)).intValue();
strParam = getInitParameter("imgsizey");
if(strParam != null && strParam.length() > 0)
imgsizey = (new Integer(strParam)).intValue();
strParam = getInitParameter("smallimgsizex");
if(strParam != null && strParam.length() > 0)
smallimgsizex = (new Integer(strParam)).intValue();
strParam = getInitParameter("smallimgsizey");
if(strParam != null && strParam.length() > 0)
smallimgsizey = (new Integer(strParam)).intValue();
strParam = getInitParameter("imgbgcolor");
if(strParam != null && strParam.length() > 0)
imgbgcolor = new Color((new Integer(strParam)).intValue());
strParam = getInitParameter("datasource");
if(strParam != null && strParam.length() > 0)
datasource = strParam;
if(datasource == null)
errset("请指定数据源类型");
else
if(datasource.equals("oracle"))
{
strParam = getInitParameter("database");
if(strParam != null && strParam.length() > 0)
database = strParam;
if(database == null)
errset("请指定数据库url");
strParam = getInitParameter("dbusername");
if(strParam != null && strParam.length() > 0)
dbusername = strParam;
strParam = getInitParameter("dbpassword");
if(strParam != null && strParam.length() > 0)
dbpassword = strParam;
strParam = getInitParameter("dbtable");
if(strParam != null && strParam.length() > 0)
dbtable = strParam;
strParam = getInitParameter("dbnamecol");
if(strParam != null && strParam.length() > 0)
dbnamecol = strParam;
strParam = getInitParameter("dbmapdefcol");
if(strParam != null && strParam.length() > 0)
dbmapdefcol = strParam;
} else
if(datasource.equals("file"))
{
strParam = getInitParameter("filetype");
if(strParam != null && strParam.length() > 0)
filetype = strParam;
if(filetype.equals("mdf"))
{
strParam = getInitParameter("mdfpath");
if(strParam != null && strParam.length() > 0)
mdfpath = strParam;
if(mdfpath == null)
errset("请指定mdf地图定义文件路径");
} else
{
strParam = getInitParameter("gstpath");
if(strParam != null && strParam.length() > 0)
gstpath = strParam;
if(gstpath == null)
errset("请指定gst地图定义文件路径");
}
}
strParam = getInitParameter("mapdef");
if(strParam != null && strParam.length() > 0)
mapdef = strParam;
if(mapdef == null)
errset("请指定地图定义名称");
try
{
MapJ tempmap = initMapJ();
resetpoint = tempmap.getCenter();
resetzoom = tempmap.getZoom();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
if(errflag)
{
PrintWriter out = response.getWriter();
response.setContentType("text/html; charset=GBK");
out.print(errmessage);
out.close();
}
MapJ mymap = null;
MapJ boundmap = null;
String rqutype = request.getParameter("rqutype");
if(rqutype != null && rqutype.equals("initmap"))
{
mymap = initmap(request);
responseimg(mymap, response);
} else
if(rqutype != null && rqutype.equals("chgmapview"))
{
mymap = initmap(request);
chgmapview(mymap, request);
responseimg(mymap, response);
} else
if(rqutype != null && rqutype.equals("panmap"))
{
mymap = initmap(request);
panmap(mymap, request);
responseimg(mymap, response);
} else
if(rqutype != null && rqutype.equals("resetmap"))
{
mymap = initmap(request);
resetmap(mymap, request);
responseimg(mymap, response);
} else
if(rqutype != null && rqutype.equals("centerpoint"))
{
mymap = initmap(request);
responsetext(mymap, response, "centerpoint");
} else
if(rqutype != null && rqutype.equals("zoom"))
{
mymap = initmap(request);
responsetext(mymap, response, "zoom");
} else
if(rqutype != null && rqutype.equals("boundmap"))
{
mymap = initmap(request);
boundmap = initboundmap(request);
responsebound(mymap, boundmap, response);
} else
if(rqutype != null && rqutype.equals("smallpanmap"))
{
mymap = initmap(request);
boundmap = initboundmap(request);
resetbybound(mymap, boundmap, request);
responseimg(mymap, response);
}
}
private MapJ initmap(HttpServletRequest request)
{
MapJ mymap = null;
mymap = (MapJ)request.getSession().getAttribute("mapj");
if(mymap == null)
try
{
mymap = initMapJ();
if(request.getParameter("oldx") != null && request.getParameter("oldy") != null)
{
Double oldx = new Double(request.getParameter("oldx"));
Double oldy = new Double(request.getParameter("oldy"));
DoublePoint mappoint = new DoublePoint(oldx.doubleValue(), oldy.doubleValue());
Double oldzoom = new Double(request.getParameter("oldzoom"));
mymap.setCenter(mappoint);
mymap.setZoom(oldzoom.doubleValue());
}
request.getSession().setAttribute("mapj", mymap);
}
catch(Exception e)
{
e.printStackTrace();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -