本文整理汇总了Java中org.meteoinfo.layer.LayerDrawType类的典型用法代码示例。如果您正苦于以下问题:Java LayerDrawType类的具体用法?Java LayerDrawType怎么用?Java LayerDrawType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayerDrawType类属于org.meteoinfo.layer包,在下文中一共展示了LayerDrawType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadWebMapLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Load web map layer
*
* @param wmLayer Web map layer XML node
* @return Web map layer
* @throws java.lang.Exception
*/
public WebMapLayer loadWebMapLayer(Node wmLayer) throws Exception {
WebMapLayer aLayer = new WebMapLayer();
try {
aLayer.setHandle(Integer.parseInt(wmLayer.getAttributes().getNamedItem("Handle").getNodeValue()));
aLayer.setLayerName(wmLayer.getAttributes().getNamedItem("LayerName").getNodeValue());
aLayer.setVisible(Boolean.parseBoolean(wmLayer.getAttributes().getNamedItem("Visible").getNodeValue()));
aLayer.setWebMapProvider(WebMapProvider.valueOf(wmLayer.getAttributes().getNamedItem("WebMapProvider").getNodeValue()));
aLayer.setMaskout(Boolean.parseBoolean(wmLayer.getAttributes().getNamedItem("IsMaskout").getNodeValue()));
aLayer.setLayerType(LayerTypes.valueOf(wmLayer.getAttributes().getNamedItem("LayerType").getNodeValue()));
aLayer.setLayerDrawType(LayerDrawType.valueOf(wmLayer.getAttributes().getNamedItem("LayerDrawType").getNodeValue()));
aLayer.setTransparency(Integer.parseInt(wmLayer.getAttributes().getNamedItem("TransparencyPerc").getNodeValue()));
} catch (DOMException | NumberFormatException e) {
}
return aLayer;
}
示例2: exportWebMapLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Export web map layer element
*
* @param m_Doc XML document
* @param parent Parent element
* @param wmLayer The web map layer
* @param projectFilePath Project file path
*/
public void exportWebMapLayer(Document m_Doc, Element parent, WebMapLayer wmLayer, String projectFilePath) {
Element Layer = m_Doc.createElement("Layer");
Attr Handle = m_Doc.createAttribute("Handle");
Attr LayerName = m_Doc.createAttribute("LayerName");
Attr webProvider = m_Doc.createAttribute("WebMapProvider");
Attr Visible = m_Doc.createAttribute("Visible");
Attr IsMaskout = m_Doc.createAttribute("IsMaskout");
Attr LayerType = m_Doc.createAttribute("LayerType");
Attr LayerDrawType = m_Doc.createAttribute("LayerDrawType");
Attr transparencyPerc = m_Doc.createAttribute("TransparencyPerc");
Handle.setValue(String.valueOf(wmLayer.getHandle()));
LayerName.setValue(wmLayer.getLayerName());
Visible.setValue(String.valueOf(wmLayer.isVisible()));
webProvider.setValue(wmLayer.getWebMapProvider().toString());
IsMaskout.setValue(String.valueOf(wmLayer.isMaskout()));
LayerType.setValue(wmLayer.getLayerType().toString());
LayerDrawType.setValue(wmLayer.getLayerDrawType().toString());
transparencyPerc.setValue(String.valueOf(wmLayer.getTransparency()));
Layer.setAttributeNode(Handle);
Layer.setAttributeNode(LayerName);
Layer.setAttributeNode(Visible);
Layer.setAttributeNode(webProvider);
Layer.setAttributeNode(IsMaskout);
Layer.setAttributeNode(LayerType);
Layer.setAttributeNode(LayerDrawType);
Layer.setAttributeNode(transparencyPerc);
parent.appendChild(Layer);
}
示例3: createImageLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Create image layer
* @param x X array
* @param y Y array
* @param image Image
* @param layerName Layer name
* @return Image layer
*/
public static ImageLayer createImageLayer(Array x, Array y, BufferedImage image, String layerName){
ImageLayer aImageLayer = new ImageLayer();
aImageLayer.setImage(image);
aImageLayer.setLayerName(layerName);
aImageLayer.setVisible(true);
WorldFilePara aWFP = new WorldFilePara();
double xdelta = x.getDouble(1) - x.getDouble(0);
double ydelta = y.getDouble(1) - y.getDouble(0);
aWFP.xUL = x.getDouble(0) - xdelta / 2;
aWFP.yUL = y.getDouble(y.getShape()[0] - 1) + ydelta / 2;
aWFP.xScale = xdelta;
aWFP.yScale = -ydelta;
aWFP.xRotate = 0;
aWFP.yRotate = 0;
aImageLayer.setWorldFilePara(aWFP);
double XBR, YBR;
XBR = aImageLayer.getImage().getWidth() * aImageLayer.getWorldFilePara().xScale + aImageLayer.getWorldFilePara().xUL;
YBR = aImageLayer.getImage().getHeight() * aImageLayer.getWorldFilePara().yScale + aImageLayer.getWorldFilePara().yUL;
Extent aExtent = new Extent();
aExtent.minX = aImageLayer.getWorldFilePara().xUL;
aExtent.minY = YBR;
aExtent.maxX = XBR;
aExtent.maxY = aImageLayer.getWorldFilePara().yUL;
aImageLayer.setExtent(aExtent);
aImageLayer.setLayerDrawType(LayerDrawType.Image);
aImageLayer.setMaskout(true);
return aImageLayer;
}
示例4: createRasterLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Create reaster layer
*
* @param gridData Grid data
* @param LName Layer name
* @param aLS Legend scheme
* @return Raster layer
*/
public static RasterLayer createRasterLayer(GridArray gridData, String LName, LegendScheme aLS) {
RasterLayer aRLayer = new RasterLayer();
aRLayer.setGridData(gridData);
aRLayer.setShapeType(ShapeTypes.Image);
aRLayer.setLegendScheme(aLS.convertTo(ShapeTypes.Image));
aRLayer.setLayerName(LName);
aRLayer.setVisible(true);
aRLayer.setLayerDrawType(LayerDrawType.Raster);
aRLayer.setMaskout(true);
return aRLayer;
}
示例5: exportVectorLayerElement
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Export vector layer element
*
* @param m_Doc XML document
* @param parent Parent XML element
* @param aVLayer The vector layer
* @param projectFilePath Project file path
*/
public void exportVectorLayerElement(Document m_Doc, Element parent, VectorLayer aVLayer,
String projectFilePath) {
Element Layer = m_Doc.createElement("Layer");
Attr Handle = m_Doc.createAttribute("Handle");
Attr LayerName = m_Doc.createAttribute("LayerName");
Attr FileName = m_Doc.createAttribute("FileName");
Attr Visible = m_Doc.createAttribute("Visible");
Attr IsMaskout = m_Doc.createAttribute("IsMaskout");
Attr LayerType = m_Doc.createAttribute("LayerType");
Attr LayerDrawType = m_Doc.createAttribute("LayerDrawType");
Attr ShapeType = m_Doc.createAttribute("ShapeType");
Attr AvoidCollision = m_Doc.createAttribute("AvoidCollision");
Attr TransparencyPerc = m_Doc.createAttribute("TransparencyPerc");
Attr Expanded = m_Doc.createAttribute("Expanded");
Handle.setValue(String.valueOf(aVLayer.getHandle()));
LayerName.setValue(aVLayer.getLayerName());
try {
FileName.setValue(GlobalUtil.getRelativePath(aVLayer.getFileName(), projectFilePath));
} catch (IOException ex) {
Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
}
Visible.setValue(String.valueOf(aVLayer.isVisible()));
IsMaskout.setValue(String.valueOf(aVLayer.isMaskout()));
LayerType.setValue(aVLayer.getLayerType().toString());
LayerDrawType.setValue(aVLayer.getLayerDrawType().toString());
ShapeType.setValue(aVLayer.getShapeType().toString());
AvoidCollision.setValue(String.valueOf(aVLayer.getAvoidCollision()));
TransparencyPerc.setValue(String.valueOf(aVLayer.getTransparency()));
Expanded.setValue(String.valueOf(aVLayer.isExpanded()));
Layer.setAttributeNode(Handle);
Layer.setAttributeNode(LayerName);
Layer.setAttributeNode(FileName);
Layer.setAttributeNode(Visible);
Layer.setAttributeNode(IsMaskout);
Layer.setAttributeNode(LayerType);
Layer.setAttributeNode(LayerDrawType);
Layer.setAttributeNode(ShapeType);
Layer.setAttributeNode(AvoidCollision);
Layer.setAttributeNode(TransparencyPerc);
Layer.setAttributeNode(Expanded);
//Add legend scheme
aVLayer.getLegendScheme().exportToXML(m_Doc, Layer);
//Add label set
exportLabelSet(m_Doc, Layer, aVLayer.getLabelSet());
//Add graphics
exportGraphics(m_Doc, Layer, aVLayer.getLabelPoints());
//Add chart set
exportChartSet(m_Doc, Layer, aVLayer.getChartSet());
//Add charts
exportChartGraphics(m_Doc, Layer, aVLayer.getChartPoints());
//Add visible scale
exportVisibleScale(m_Doc, Layer, aVLayer.getVisibleScale());
parent.appendChild(Layer);
}
示例6: exportImageLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Export image layer element
*
* @param m_Doc XML document
* @param parent Parent element
* @param aILayer The image layer
* @param projectFilePath Project file path
*/
public void exportImageLayer(Document m_Doc, Element parent, ImageLayer aILayer, String projectFilePath) {
Element Layer = m_Doc.createElement("Layer");
Attr Handle = m_Doc.createAttribute("Handle");
Attr LayerName = m_Doc.createAttribute("LayerName");
Attr FileName = m_Doc.createAttribute("FileName");
Attr Visible = m_Doc.createAttribute("Visible");
Attr IsMaskout = m_Doc.createAttribute("IsMaskout");
Attr LayerType = m_Doc.createAttribute("LayerType");
Attr LayerDrawType = m_Doc.createAttribute("LayerDrawType");
Attr transparencyPerc = m_Doc.createAttribute("TransparencyPerc");
Attr transparencyColor = m_Doc.createAttribute("TransparencyColor");
Attr setTransColor = m_Doc.createAttribute("SetTransColor");
Handle.setValue(String.valueOf(aILayer.getHandle()));
LayerName.setValue(aILayer.getLayerName());
try {
FileName.setValue(GlobalUtil.getRelativePath(aILayer.getFileName(), projectFilePath));
} catch (IOException ex) {
Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
}
Visible.setValue(String.valueOf(aILayer.isVisible()));
IsMaskout.setValue(String.valueOf(aILayer.isMaskout()));
LayerType.setValue(aILayer.getLayerType().toString());
LayerDrawType.setValue(aILayer.getLayerDrawType().toString());
transparencyPerc.setValue(String.valueOf(aILayer.getTransparency()));
transparencyColor.setValue(ColorUtil.toHexEncoding(aILayer.getTransparencyColor()));
setTransColor.setValue(String.valueOf(aILayer.isUseTransColor()));
Layer.setAttributeNode(Handle);
Layer.setAttributeNode(LayerName);
Layer.setAttributeNode(FileName);
Layer.setAttributeNode(Visible);
Layer.setAttributeNode(IsMaskout);
Layer.setAttributeNode(LayerType);
Layer.setAttributeNode(LayerDrawType);
Layer.setAttributeNode(transparencyPerc);
Layer.setAttributeNode(transparencyColor);
Layer.setAttributeNode(setTransColor);
//Add visible scale
exportVisibleScale(m_Doc, Layer, aILayer.getVisibleScale());
parent.appendChild(Layer);
}
示例7: exportRasterLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Export raster layer element
*
* @param m_Doc XML document
* @param parent Parent element
* @param aILayer The raster layer
* @param projectFilePath Project file path
*/
public void exportRasterLayer(Document m_Doc, Element parent, RasterLayer aILayer, String projectFilePath) {
Element Layer = m_Doc.createElement("Layer");
Attr Handle = m_Doc.createAttribute("Handle");
Attr LayerName = m_Doc.createAttribute("LayerName");
Attr FileName = m_Doc.createAttribute("FileName");
Attr Visible = m_Doc.createAttribute("Visible");
Attr IsMaskout = m_Doc.createAttribute("IsMaskout");
Attr LayerType = m_Doc.createAttribute("LayerType");
Attr LayerDrawType = m_Doc.createAttribute("LayerDrawType");
Attr transparencyPerc = m_Doc.createAttribute("TransparencyPerc");
Attr transparencyColor = m_Doc.createAttribute("TransparencyColor");
Attr setTransColor = m_Doc.createAttribute("SetTransColor");
Handle.setValue(String.valueOf(aILayer.getHandle()));
LayerName.setValue(aILayer.getLayerName());
try {
FileName.setValue(GlobalUtil.getRelativePath(aILayer.getFileName(), projectFilePath));
} catch (IOException ex) {
Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
}
Visible.setValue(String.valueOf(aILayer.isVisible()));
IsMaskout.setValue(String.valueOf(aILayer.isMaskout()));
LayerType.setValue(aILayer.getLayerType().toString());
LayerDrawType.setValue(aILayer.getLayerDrawType().toString());
transparencyPerc.setValue(String.valueOf(aILayer.getTransparency()));
transparencyColor.setValue(ColorUtil.toHexEncoding(aILayer.getTransparencyColor()));
setTransColor.setValue(String.valueOf(aILayer.isUseTransColor()));
Layer.setAttributeNode(Handle);
Layer.setAttributeNode(LayerName);
Layer.setAttributeNode(FileName);
Layer.setAttributeNode(Visible);
Layer.setAttributeNode(IsMaskout);
Layer.setAttributeNode(LayerType);
Layer.setAttributeNode(LayerDrawType);
Layer.setAttributeNode(transparencyPerc);
Layer.setAttributeNode(transparencyColor);
Layer.setAttributeNode(setTransColor);
//Add legend scheme
aILayer.getLegendScheme().exportToXML(m_Doc, Layer);
//Add visible scale
exportVisibleScale(m_Doc, Layer, aILayer.getVisibleScale());
parent.appendChild(Layer);
}
示例8: loadImageLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Load image layer
*
* @param aILayer Image layer XML node
* @return Image layer
*/
public ImageLayer loadImageLayer(Node aILayer) {
String aFile = aILayer.getAttributes().getNamedItem("FileName").getNodeValue();
File lFile = new File(aFile);
String curDir = System.getProperty("user.dir");
if (new File(curDir).isFile()) {
System.setProperty("user.dir", new File(curDir).getParent());
}
aFile = lFile.getAbsolutePath();
ImageLayer aLayer = null;
if (new File(aFile).exists()) {
try {
aLayer = MapDataManage.readImageFile(aFile);
} catch (IOException ex) {
Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
}
try {
aLayer.setHandle(Integer.parseInt(aILayer.getAttributes().getNamedItem("Handle").getNodeValue()));
aLayer.setLayerName(aILayer.getAttributes().getNamedItem("LayerName").getNodeValue());
aLayer.setVisible(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("Visible").getNodeValue()));
aLayer.setMaskout(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("IsMaskout").getNodeValue()));
aLayer.setLayerType(LayerTypes.valueOf(aILayer.getAttributes().getNamedItem("LayerType").getNodeValue()));
aLayer.setLayerDrawType(LayerDrawType.valueOf(aILayer.getAttributes().getNamedItem("LayerDrawType").getNodeValue()));
aLayer.setTransparency(Integer.parseInt(aILayer.getAttributes().getNamedItem("TransparencyPerc").getNodeValue()));
aLayer.setTransparencyColor(ColorUtil.parseToColor(aILayer.getAttributes().getNamedItem("TransparencyColor").getNodeValue()));
aLayer.setUseTransColor(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("SetTransColor").getNodeValue()));
//Load visible scale
NodeList visScaleNodes = ((Element) aILayer).getElementsByTagName("VisibleScale");
if (visScaleNodes.getLength() > 0) {
Node visScaleNode = visScaleNodes.item(0);
VisibleScale visScale = aLayer.getVisibleScale();
loadVisibleScale(visScaleNode, visScale);
}
} catch (Exception e) {
}
}
return aLayer;
}
示例9: loadRasterLayer
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Load raster layer
*
* @param aILayer Raster layer XML node
* @return Raster layer
* @throws java.lang.Exception
*/
public RasterLayer loadRasterLayer(Node aILayer) throws Exception {
String aFile = aILayer.getAttributes().getNamedItem("FileName").getNodeValue();
File lFile = new File(aFile);
String curDir = System.getProperty("user.dir");
if (new File(curDir).isFile()) {
System.setProperty("user.dir", new File(curDir).getParent());
}
aFile = lFile.getAbsolutePath();
RasterLayer aLayer = null;
if (new File(aFile).exists()) {
try {
aLayer = (RasterLayer) MapDataManage.loadLayer(aFile);
} catch (IOException ex) {
Logger.getLogger(MapView.class.getName()).log(Level.SEVERE, null, ex);
}
try {
aLayer.setHandle(Integer.parseInt(aILayer.getAttributes().getNamedItem("Handle").getNodeValue()));
aLayer.setLayerName(aILayer.getAttributes().getNamedItem("LayerName").getNodeValue());
aLayer.setVisible(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("Visible").getNodeValue()));
aLayer.setMaskout(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("IsMaskout").getNodeValue()));
aLayer.setLayerType(LayerTypes.valueOf(aILayer.getAttributes().getNamedItem("LayerType").getNodeValue()));
aLayer.setLayerDrawType(LayerDrawType.valueOf(aILayer.getAttributes().getNamedItem("LayerDrawType").getNodeValue()));
aLayer.setTransparency(Integer.parseInt(aILayer.getAttributes().getNamedItem("TransparencyPerc").getNodeValue()));
aLayer.setTransparencyColor(ColorUtil.parseToColor(aILayer.getAttributes().getNamedItem("TransparencyColor").getNodeValue()));
aLayer.setUseTransColor(Boolean.parseBoolean(aILayer.getAttributes().getNamedItem("SetTransColor").getNodeValue()));
//Load legend scheme
Node LS = (Node) ((Element) aILayer).getElementsByTagName("LegendScheme").item(0);
LegendScheme ls = new LegendScheme(aLayer.getShapeType());
ls.importFromXML(LS);
aLayer.setLegendScheme(ls);
//Load visible scale
NodeList visScaleNodes = ((Element) aILayer).getElementsByTagName("VisibleScale");
if (visScaleNodes.getLength() > 0) {
Node visScaleNode = visScaleNodes.item(0);
VisibleScale visScale = aLayer.getVisibleScale();
loadVisibleScale(visScaleNode, visScale);
}
} catch (DOMException | NumberFormatException e) {
}
}
return aLayer;
}
示例10: readImageFile
import org.meteoinfo.layer.LayerDrawType; //导入依赖的package包/类
/**
* Read image file
*
* @param aFile File path
* @return Image layer
* @throws java.io.IOException
*/
public static ImageLayer readImageFile(String aFile) throws IOException {
String oEx = aFile.substring(aFile.lastIndexOf("."));
String last = oEx.substring(oEx.length() - 1);
String sEx = oEx.substring(0, oEx.length() - 2) + last;
sEx = sEx + "w";
String wFile = aFile.replace(oEx, sEx);
BufferedImage aImage = ImageIO.read(new File(aFile));
ImageLayer aImageLayer = new ImageLayer();
aImageLayer.setFileName(aFile);
aImageLayer.setWorldFileName(wFile);
aImageLayer.setImage(aImage);
aImageLayer.setLayerName(new File(aFile).getName());
aImageLayer.setVisible(true);
if (new File(wFile).exists()) {
aImageLayer.readImageWorldFile(wFile);
} else {
WorldFilePara aWFP = new WorldFilePara();
aWFP.xUL = 0;
aWFP.yUL = 90;
aWFP.xScale = 0.05;
aWFP.yScale = -0.05;
aWFP.xRotate = 0;
aWFP.yRotate = 0;
aImageLayer.setWorldFilePara(aWFP);
aImageLayer.writeImageWorldFile(wFile, aImageLayer.getWorldFilePara());
}
double XBR, YBR;
XBR = aImageLayer.getImage().getWidth() * aImageLayer.getWorldFilePara().xScale + aImageLayer.getWorldFilePara().xUL;
YBR = aImageLayer.getImage().getHeight() * aImageLayer.getWorldFilePara().yScale + aImageLayer.getWorldFilePara().yUL;
Extent aExtent = new Extent();
aExtent.minX = aImageLayer.getWorldFilePara().xUL;
aExtent.minY = YBR;
aExtent.maxX = XBR;
aExtent.maxY = aImageLayer.getWorldFilePara().yUL;
aImageLayer.setExtent(aExtent);
aImageLayer.setLayerDrawType(LayerDrawType.Image);
aImageLayer.setMaskout(true);
return aImageLayer;
}