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


Java OMLine.putAttribute方法代码示例

本文整理汇总了Java中com.bbn.openmap.omGraphics.OMLine.putAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java OMLine.putAttribute方法的具体用法?Java OMLine.putAttribute怎么用?Java OMLine.putAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.bbn.openmap.omGraphics.OMLine的用法示例。


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

示例1: init

import com.bbn.openmap.omGraphics.OMLine; //导入方法依赖的package包/类
/**
 * Called from the prepare() method if the layer discovers that its
 * OMGraphicList is null.
 * 
 * @return new OMGraphicList with OMGraphics that you always want to display
 *         and reproject as necessary.
 */
public OMGraphicList init() {

   // This layer keeps a pointer to an OMGraphicList that it uses
   // for painting. It's initially set to null, which is used as
   // a flag in prepare() to signal that the OMGraphcs need to be
   // created. The list returned from prepare() gets set in the
   // layer.
   // This layer uses the StandardPCPolicy for new
   // projections, which keeps the list intact and simply calls
   // generate() on it with the new projection, and repaint()
   // which calls paint().

   OMGraphicList omList = new OMGraphicList();

   // Add an OMLine
   OMLine line = new OMLine(40f, -145f, 42f, -70f, OMGraphic.LINETYPE_GREATCIRCLE);
   // line.addArrowHead(true);
   line.setStroke(new BasicStroke(2));
   line.setLinePaint(Color.red);
   line.putAttribute(OMGraphicConstants.LABEL, new OMTextLabeler("Line Label"));

   omList.add(line);

   // Add a list of OMPoints.
   OMGraphicList pointList = new OMGraphicList();
   for (int i = 0; i < 100; i++) {
      OMPoint point = new OMPoint((float) (Math.random() * 89f), (float) (Math.random() * -179f), 3);
      point.setFillPaint(Color.yellow);
      point.setOval(true);
      pointList.add(point);
   }
   omList.add(pointList);

   return omList;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:43,代码来源:BasicLayer.java

示例2: init

import com.bbn.openmap.omGraphics.OMLine; //导入方法依赖的package包/类
/**
 * Called from the prepare() method if the layer discovers that its
 * OMGraphicList is null. This method is being overridden so that TOOLTIPS
 * can be set as attributes on the OMGraphics, and retrieved later in the
 * gesturing queries.
 * 
 * @return new OMGraphicList with OMGraphics that you always want to display
 *         and reproject as necessary.
 * 
 * @see BasicLayer#prepare
 */
public OMGraphicList init() {

    // This layer keeps a pointer to an OMGraphicList that it uses
    // for painting. It's initially set to null, which is used as
    // a flag in prepare() to signal that the OMGraphcs need to be
    // created. The list returned from prepare() gets set in the
    // layer.
    // This layer uses the StandardPCPolicy for new
    // projections, which keeps the list intact and simply calls
    // generate() on it with the new projection, and repaint()
    // which calls paint().

    /*
     * Note that the OMGraphics have their select paint set in order to
     * react to highlight calls, and an OMGraphicConstants.TOOLTIP
     * attribute set to provide tooltip text when needed.
     */

    OMGraphicList omList = new OMGraphicList();

    // Add an OMLine
    OMLine line = new OMLine(40f, -75f, 42f, -70f, OMGraphic.LINETYPE_GREATCIRCLE);
    line.setStroke(new BasicStroke(2));
    line.putAttribute(OMGraphicConstants.LABEL,
            new OMTextLabeler("Line Label"));
    line.setLinePaint(Color.red);
    line.setSelectPaint(Color.blue);
    line.putAttribute(OMGraphicConstants.TOOLTIP, "This is an OMLine.");

    omList.add(line);

    // Add a list of OMPoints.
    OMGraphicList pointList = new OMGraphicList();
    for (int i = 0; i < 100; i++) {
        OMPoint point = new OMPoint((float) (Math.random() * 89f), (float) (Math.random() * -179f), 3);
        point.putAttribute(OMGraphicConstants.TOOLTIP, "This is OMPoint #"
                + i);
        point.setLinePaint(Color.green);
        point.setSelectPaint(Color.yellow);
        pointList.add(point);
    }
    omList.add(pointList);

    return omList;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:57,代码来源:InteractionLayer.java


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