當前位置: 首頁>>代碼示例>>Java>>正文


Java GeoText類代碼示例

本文整理匯總了Java中ika.geo.GeoText的典型用法代碼示例。如果您正苦於以下問題:Java GeoText類的具體用法?Java GeoText怎麽用?Java GeoText使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GeoText類屬於ika.geo包,在下文中一共展示了GeoText類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawMajorMeridianAndLabel

import ika.geo.GeoText; //導入依賴的package包/類
private void drawMajorMeridianAndLabel(Graphics2D g2d, double lonDeg, double yBottom, double yTop) {
    double scale = mapComponent.getScaleFactor();
    double meridianX = R * Math.toRadians(lonDeg);

    // format label
    String str = Long.toString(Math.abs(Math.round(lonDeg))) + "\u00B0";
    if (lonDeg < 0) {
        str += " W";
    } else if (lonDeg > 0) {
        str += " E";
    }

    // draw label
    GeoText geoText = new GeoText(str, meridianX, yTop);
    geoText.setCenterHor(true);
    geoText.setCenterVer(false);
    geoText.setDy(-LABEL_FONT.getSize() - LABEL_SPACING_PX);
    geoText.getFontSymbol().setColor(GRATICULE_LABEL_COLOR);
    geoText.draw(g2d, scale, false);

    // shorten major meridian on top to create space for label
    double lineEndTop = yTop - (LABEL_FONT.getSize() + 2 * LABEL_SPACING_PX) / scale;

    // draw line
    majorLineStyle(g2d);
    Line2D meridian = new Line2D.Double(meridianX, yBottom, meridianX, lineEndTop);
    g2d.draw(meridian);
}
 
開發者ID:berniejenny,項目名稱:MapAnalyst,代碼行數:29,代碼來源:OpenStreetMap.java

示例2: drawMajorParallelAndLabel

import ika.geo.GeoText; //導入依賴的package包/類
private void drawMajorParallelAndLabel(Graphics2D g2d, double latDeg, double xLeft, double xRight) {
    double scale = mapComponent.getScaleFactor();
    double parallelY = yMercator(latDeg);

    // format label
    String str = Long.toString(Math.abs(Math.round(latDeg))) + "\u00B0";
    if (latDeg < 0) {
        str += " S";
    } else if (latDeg > 0) {
        str += " N";
    }

    // draw label
    GeoText geoText = new GeoText(str, xLeft, parallelY);
    geoText.setCenterHor(false);
    geoText.setCenterVer(true);
    geoText.setDx(LABEL_SPACING_PX);
    geoText.getFontSymbol().setColor(GRATICULE_LABEL_COLOR);
    geoText.draw(g2d, scale, false);

    // shorten major parallel line on left side to create space for label
    double stringWidth = geoText.getBounds2D(scale).getWidth();
    double lineStartLeft = xLeft + stringWidth + (2 * LABEL_SPACING_PX) / scale;

    // draw line
    majorLineStyle(g2d);
    Line2D parallel = new Line2D.Double(lineStartLeft, parallelY, xRight, parallelY);
    g2d.draw(parallel);
}
 
開發者ID:berniejenny,項目名稱:MapAnalyst,代碼行數:30,代碼來源:OpenStreetMap.java

示例3: mapEvent

import ika.geo.GeoText; //導入依賴的package包/類
public void mapEvent(MapEvent evt) {
    
    GeoSet rootGeoSet = evt.getRootGeoSet();
    if (rootGeoSet == null)
        return;
    
    GeoObject singleSelectedGeoObj = rootGeoSet.getSingleSelectedGeoObject();
    CardLayout cl = (CardLayout)(this.getLayout());
    if (singleSelectedGeoObj instanceof GeoPath) {
        GeoPath geoPath = (GeoPath)singleSelectedGeoObj;
        VectorSymbol vs = geoPath.getVectorSymbol();
        this.vectorSymbolPanel.setVectorSymbol(vs);
        cl.show(this, VECTOR);
    } else if (singleSelectedGeoObj  instanceof GeoText) {
        this.singleSelectedGeoText = (GeoText)singleSelectedGeoObj;
        Font font = this.singleSelectedGeoText.getFontSymbol().getFont();
        this.fontChooser.setSelectedFont(font);
        cl.show(this, FONT);
    } else {
        // if multiple objects are selected or if no object is selected,
        // display an empty panel.
        this.vectorSymbolPanel.setVectorSymbol(null);
        this.fontChooser.setFont(null);
        cl.show(this, NONE);
    }
    
}
 
開發者ID:OSUCartography,項目名稱:TerrainViewer,代碼行數:28,代碼來源:GeoInspectorPanel.java


注:本文中的ika.geo.GeoText類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。