当前位置: 首页>>代码示例>>Java>>正文


Java GlobalUtil类代码示例

本文整理汇总了Java中org.meteoinfo.global.util.GlobalUtil的典型用法代码示例。如果您正苦于以下问题:Java GlobalUtil类的具体用法?Java GlobalUtil怎么用?Java GlobalUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GlobalUtil类属于org.meteoinfo.global.util包,在下文中一共展示了GlobalUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getColorMap

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Get color map
 * @param ctName Color map name
 * @return Color table
 * @throws java.io.IOException
 */
public static ColorMap getColorMap(String ctName) throws IOException{
    String fn = GlobalUtil.getAppPath(ColorUtil.class);
    boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
            getInputArguments().toString().contains("jdwp");
    if (isDebug) {
        fn = "D:/MyProgram/java/MeteoInfoDev/MeteoInfoMap/";
    }     
    fn = fn.substring(0, fn.lastIndexOf("/"));
    String path = fn + File.separator + "colormaps";
    File pathDir = new File(path);
    if (!pathDir.isDirectory()) {
        return null;
    }
    
    fn = path + File.separator + ctName + ".rgb";
    File ctFile = new File(fn);
    if (!ctFile.isFile())
        return null;                
    
    ColorMap ct = new ColorMap();
    ct.readFromFile(fn);
    
    return ct;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:31,代码来源:ColorUtil.java

示例2: LabelSet

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
public LabelSet() {
    _drawLabels = false;
    _fieldName = null;
    _labelFont = new Font(GlobalUtil.getDefaultFontName(), Font.PLAIN, 12);
    _labelColor = Color.black;
    _drawShadow = false;
    _shadowColor = Color.white;
    _labelAlignType = AlignType.Center;
    _xOffset = 0;
    _yOffset = 0;
    _avoidCollision = true;
    _colorByLegend = false;
    _dynamicContourLabel = false;
    _autoDecimal = true;
    _decimalDigits = 2;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:17,代码来源:LabelSet.java

示例3: LabelBreak

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
public LabelBreak() {
    super();
    this.setBreakType(BreakTypes.LabelBreak);
    _text = "";
    _angle = 0;
    this.setColor(Color.black);        
    _font = new Font(GlobalUtil.getDefaultFontName(), Font.PLAIN, 7);
    _alignType = AlignType.Center;
    _yShift = 0;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:11,代码来源:LabelBreak.java

示例4: updateImageTab

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
private void updateImageTab() {
    this.symbolControl1.setMarkerType(MarkerType.Image);
    this.jLabel_FontFamily.setEnabled(false);
    this.jComboBox_FontFamily.removeAllItems();
    this.jComboBox_FontFamily.setEditable(false);
    this.jPanel_Outline.setEnabled(false);
    this.jSpinner_OutlineSize.setEnabled(false);
    this.jLabel_FillColor.setEnabled(false);
    this.jLabel_Color.setEnabled(false);
    this.jCheckBox_DrawFill.setEnabled(false);

    if (_imagePaths == null) {
        String fn = GlobalUtil.getAppPath(MapFrame.class);
        fn = fn.substring(0, fn.lastIndexOf("/"));
        String path = fn + File.separator + "image";            
        File pathDir = new File(path);
        if (!pathDir.isDirectory()){
            return;
        }

        File[] files = pathDir.listFiles();
        _imagePaths = new String[files.length];
        List<Image> imageList = new ArrayList<>();
        int i = 0;
        for (File aFile : files) {
            _imagePaths[i] = aFile.getAbsolutePath();
            try {
                imageList.add(ImageIO.read(aFile));
            } catch (IOException ex) {
                Logger.getLogger(FrmPointSymbolSet.class.getName()).log(Level.SEVERE, null, ex);
            }
            i += 1;
        }

        this.symbolControl1.setIamgeList(imageList);
    } else {
        this.symbolControl1.setSymbolNumber(_imagePaths.length);
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:40,代码来源:FrmPointSymbolSet.java

示例5: writeDataHead

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Write data head
 *
 * @param dh The data head
 * @throws IOException
 */
public void writeDataHead(DataHead dh) throws IOException {
    int skip = 4;
    //Record 1:
    _bw.writeInt(skip);
    _bw.writeInt(dh.iversion);
    _bw.writeInt(skip);

    //Record 2:
    skip = 124;
    _bw.writeInt(skip);
    _bw.writeBytes(GlobalUtil.padRight(dh.hdate, 24, ' '));
    _bw.writeFloat(dh.xfcst);
    _bw.writeBytes(GlobalUtil.padRight(dh.field, 9, ' '));
    _bw.writeBytes(GlobalUtil.padRight(dh.units, 25, ' '));
    _bw.writeBytes(GlobalUtil.padRight(dh.desc, 46, ' '));
    _bw.writeFloat(dh.level);
    _bw.writeInt(dh.idim);
    _bw.writeInt(dh.jdim);
    _bw.writeInt(dh.llflag);
    _bw.writeInt(skip);

    //Record 3:
    skip = 16;
    _bw.writeInt(skip);
    _bw.writeFloat(dh.startlat);
    _bw.writeFloat(dh.startlon);
    _bw.writeFloat(dh.deltalat);
    _bw.writeFloat(dh.deltalon);
    _bw.writeInt(skip);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:37,代码来源:MM5IMDataInfo.java

示例6: padNumStr

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
private String padNumStr(String str, int n) {
    String nstr = str;
    if (nstr.indexOf('.') < 0) {
        nstr = nstr + ".";
    }
    if (nstr.length() > n) {
        nstr = nstr.substring(0, n);
    }
    return GlobalUtil.padRight(nstr, n, '0');
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:11,代码来源:ARLDataInfo.java

示例7: writeGridData

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Write grid data
 *
 * @param aDL The data label
 * @param gridData The grid data
 * @throws java.io.IOException
 */
public void writeGridData(DataLabel aDL, GridData gridData) throws IOException {
    byte[] dataBytes = packARLGridData(gridData, aDL);

    //write data label
    SimpleDateFormat format = new SimpleDateFormat("yyMMddHH");
    String dateStr = format.format(aDL.getTime());
    _bw.writeBytes(dateStr);
    _bw.writeBytes(GlobalUtil.padLeft(String.valueOf(aDL.getForecast()), 2, ' '));
    _bw.writeBytes(GlobalUtil.padLeft(String.valueOf(aDL.getLevel()), 2, ' '));
    if (aDL.XGPT){
        _bw.writeBytes(aDL.IGC);
    } else
        _bw.writeBytes(GlobalUtil.padLeft(String.valueOf(aDL.getGrid()), 2, ' '));
    _bw.writeBytes(GlobalUtil.padRight(aDL.getVarName(), 4, '1'));
    _bw.writeBytes(GlobalUtil.padLeft(String.valueOf(aDL.getExponent()), 4, ' '));
    DecimalFormat dformat = new DecimalFormat("0.0000000E00");
    String preStr = dformat.format(aDL.getPrecision());
    if (!preStr.contains("E-")) {
        preStr = preStr.replace("E", "E+");
    }
    _bw.writeBytes(GlobalUtil.padLeft(preStr, 14, ' '));
    preStr = dformat.format(aDL.getValue());
    if (!preStr.contains("E-")) {
        preStr = preStr.replace("E", "E+");
    }
    _bw.writeBytes(GlobalUtil.padLeft(preStr, 14, ' '));

    //Write data
    _bw.write(dataBytes);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:38,代码来源:ARLDataInfo.java

示例8: readASCIIFile

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Read data table from ASCII file
 *
 * @param fileName File name
 * @param formatSpec Format specifiers string
 * @throws java.io.FileNotFoundException
 */
public void readASCIIFile(String fileName, String formatSpec) throws FileNotFoundException, IOException, Exception {
    BufferedReader sr = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF8"));
    String title = sr.readLine().trim();
    //Determine separator
    String delimiter = GlobalUtil.getDelimiter(title);
    sr.close();
    this.readASCIIFile(fileName, delimiter, 0, formatSpec, "UTF8");
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:16,代码来源:TableData.java

示例9: numASCIICol

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Get row number of a ASCII file
 *
 * @param fileName File name
 * @param delimiter
 * @param headerLines
 * @return Row number
 * @throws FileNotFoundException
 */
public static int numASCIICol(String fileName, String delimiter, int headerLines) throws FileNotFoundException, IOException {
    String[] dataArray;
    try (BufferedReader sr = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)))) {
        if (headerLines > 0) {
            for (int i = 0; i < headerLines; i++) {
                sr.readLine();
            }
        }
        String line = sr.readLine().trim();
        dataArray = GlobalUtil.split(line, delimiter);
    }

    return dataArray.length;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:24,代码来源:ArrayUtil.java

示例10: getColorTables

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Get color tables
 *
 * @return Color tables
 * @throws IOException
 */
public static ColorMap[] getColorTables() throws IOException {
    String fn = GlobalUtil.getAppPath(ColorUtil.class);
    boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
            getInputArguments().toString().contains("jdwp");
    if (isDebug) {
        fn = "D:/MyProgram/java/MeteoInfoDev/MeteoInfoMap/";
    }     
    fn = fn.substring(0, fn.lastIndexOf("/"));
    String path = fn + File.separator + "colormaps";
    File pathDir = new File(path);
    if (!pathDir.isDirectory()) {
        return null;
    }

    File[] files = pathDir.listFiles();
    List<ColorMap> cts = new ArrayList<>();
    for (File file : files) {
        //InputStream is = ColorUtil.class.getResourceAsStream(pdir + "/" + fileName);
        //System.out.println(file.getAbsolutePath());
        ColorMap ct = new ColorMap();
        ct.readFromFile(file);            
        if (ct.getColorCount() > 0) {
            String name = file.getName();
            name = name.substring(0, name.lastIndexOf("."));
            ct.setName(name);
            cts.add(ct);
        }
    }

    ColorMap[] ncts = new ColorMap[cts.size()];
    for (int i = 0; i < cts.size(); i++) {
        ncts[i] = cts.get(i);
    }

    return ncts;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:43,代码来源:ColorUtil.java

示例11: setMouseMode

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Set mouse mode
 *
 * @param mm The mouse mode
 */
public void setMouseMode(MouseMode mm) {
    _mouseMode = mm;
    switch (_mouseMode) {
        case New_Label:
        case New_Point:
        case New_Polyline:
        case New_Polygon:
        case New_Rectangle:
        case New_Circle:
        case New_Curve:
        case New_CurvePolygon:
        case New_Ellipse:
        case New_Freehand:
            this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
            break;
        case Map_Measurement:
            this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
            break;
        case Map_SelectFeatures_Rectangle:
        case Map_SelectFeatures_Polygon:
        case Map_SelectFeatures_Lasso:
        case Map_SelectFeatures_Circle:
            this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
            this._tempImage = GlobalUtil.deepCopy(this._layoutBitmap);
            break;
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:33,代码来源:MapLayout.java

示例12: saveFile

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Save layer as a file
 *
 * @param fileName File name
 * @param projInfo Projection information
 */
public void saveFile(String fileName, ProjectionInfo projInfo) {        
    File aFile = new File(fileName);
    if (aFile.exists()) {
        int n = JOptionPane.showConfirmDialog(null, "Overwirte the existing file?", "Overwrite confirm", JOptionPane.YES_NO_OPTION);
        if (n == JOptionPane.NO_OPTION) {
            return;
        }
    }
    try {
        this.setFileName(fileName);
        String ext = GlobalUtil.getFileExtension(fileName);
        switch (ext) {
            case "bil":
                this._gridData.saveAsBILFile(fileName);
                break;
            case "grd":
                this._gridData.saveAsSurferASCIIFile(fileName);
                break;
            case "asc":
                this._gridData.saveAsESRIASCIIFile(fileName);
                break;
            default:
                return;
        }
        if (!this.getProjInfo().isLonLat()) {
            String projFn = fileName.substring(0, fileName.length() - 3) + "prj";
            MapDataManage.writeProjFile(projFn, projInfo);
        }
    } catch (IOException ex) {
        Logger.getLogger(RasterLayer.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:39,代码来源:RasterLayer.java

示例13: setUseTransColor

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Set if using transparency color
 *
 * @param istrue Boolean
 */
public void setUseTransColor(boolean istrue) {
    _isSetTransColor = istrue;
    if (istrue) {
        Image image = GlobalUtil.makeColorTransparent(_image, _transparencyColor);
        _image = GlobalUtil.imageToBufferedImage(image);
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:13,代码来源:ImageLayer.java

示例14: setTransparencyColor

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Set transparency color
 *
 * @param color The color
 */
public void setTransparencyColor(Color color) {
    _transparencyColor = color;
    if (_isSetTransColor) {
        Image image = GlobalUtil.makeColorTransparent(_image, _transparencyColor);
        _image = GlobalUtil.imageToBufferedImage(image);
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:13,代码来源:ImageLayer.java

示例15: FrmAbout

import org.meteoinfo.global.util.GlobalUtil; //导入依赖的package包/类
/**
 * Creates new form frmAbout
 * @param parent
 * @param modal
 */
public FrmAbout(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    this.setTitle("About");
    this.jLabel_version.setText(GlobalUtil.getVersion());
    this.jLabel_web.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));        
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoMap,代码行数:13,代码来源:FrmAbout.java


注:本文中的org.meteoinfo.global.util.GlobalUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。