当前位置: 首页>>代码示例>>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;未经允许,请勿转载。