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


Java OMLine类代码示例

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


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

示例1: paintLine

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Draw a rubberband line between two points into the Graphics object.
 * 
 * @param pt1 the anchor point.
 * @param pt2 the current (mouse) position.
 * @param graphics a java.awt.Graphics object to render into.
 */
public void paintLine(Point2D pt1, Point2D pt2, Graphics graphics) {
    Graphics2D g = (Graphics2D) graphics;
    g.setXORMode(java.awt.Color.lightGray);
    g.setColor(java.awt.Color.darkGray);
    if (pt1 != null && pt2 != null) {
        // the line connecting the segments
        OMLine cLine = new OMLine(pt1.getY(), pt1.getX(), pt2.getY(), pt2.getX(), lineType);
        // get the map projection
        Projection proj = theMap.getProjection();
        // prepare the line for rendering
        cLine.generate(proj);
        // render the line graphic
        cLine.render(g);
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:23,代码来源:DistanceMouseMode.java

示例2: Graphic

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
Graphic(LatLonPoint p1, LatLonPoint p2) {
    super(p1.getLatitude(),
          p1.getLongitude(),
          p2.getLatitude(),
          p2.getLongitude(),
          OMLine.LINETYPE_STRAIGHT);
    if (road.isBlocked()) {
        setLinePaint(Color.white);
        //setLineWidth(road.getRoadClass().getWidth() * 2 +
        // 2);
    } else {
        setLinePaint(road.getRoadClass().getColor());
        /*
         * if (road.isRoute()) {
         * setLineWidth(road.getRoadClass().getWidth() * 2 +
         * 2); } else {
         * setLineWidth(road.getRoadClass().getWidth()); }
         */
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:21,代码来源:RoadLine.java

示例3: Link

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Construct a Link with the given attributes
 * 
 * @param lat1 latitude of start-point
 * @param lon1 longitude of start-point
 * @param lat2 latitude of end-point
 * @param lon2 longitude of endpoint
 * @param details A string that gives information about this link
 * @param paint the link's displayed edge java.awt.Paint (Color).
 * @param dashed Is it a dashed line?
 * @param thickness The line thickness.
 * @param linetype LINETYPE_STRAIGHT, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB
 */
public Link(double lat1, double lon1, double lat2, double lon2, String details, Paint paint, boolean dashed, float thickness,
            int linetype) {

    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Link(" + lat1 + ", " + lon1 + ", " + lat2 + ", " + lon2 + ", " + details + ", " + paint + ", " + dashed
                + ", " + thickness + ", " + linetype + ")");
    }

    this.lat = lat1;
    this.lon = lon1;
    this.lat2 = lat2;
    this.lon2 = lon2;

    if (details != null) {
        this.details = details;
    } else {
        this.details = "";
    }

    OMLine link = new OMLine(lat1, lon1, lat2, lon2, linetype);
    setLinkDrawingParameters(link, paint, thickness, dashed);
    setLocationMarker(link);
}
 
开发者ID:d2fn,项目名称:passage,代码行数:37,代码来源:Link.java

示例4: setLinkDrawingParameters

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Set the drawing attributes of the link
 * 
 * @param link the line used for the link
 * @param paint the line color
 * @param thickness the thickness of the line
 * @param dashed true if the line should be dashed
 */
public void setLinkDrawingParameters(OMLine link, Paint paint, float thickness, boolean dashed) {
    Stroke stroke;
    if (dashed) {
        // create a basic default dash
        float[] dash = {
            8.0f,
            8.0f
        };
        stroke = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
    } else {
        stroke = new BasicStroke(thickness);
    }

    link.setStroke(stroke);
    link.setLinePaint(paint);
}
 
开发者ID:d2fn,项目名称:passage,代码行数:25,代码来源:Link.java

示例5: setLocation

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Set the location for the link
 * 
 * @param lat1 the latitude of the first location
 * @param lon1 the longitude of the first location
 * @param lat2 the latitude of the second location
 * @param lon2 the longitude of the second location
 */
public void setLocation(double lat1, double lon1, double lat2, double lon2) {

    this.lat = lat1;
    this.lon = lon1;
    this.lat2 = lat2;
    this.lon2 = lon2;

    OMLine line = (OMLine) getLocationMarker();
    double[] locs = {
        lat1,
        lon1,
        lat2,
        lon2
    };
    line.setLL(locs);
}
 
开发者ID:d2fn,项目名称:passage,代码行数:25,代码来源:Link.java

示例6: drawingComplete

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
public void drawingComplete(OMGraphic omg, OMAction action) {

        releaseProxyMouseMode();

        if (omg instanceof OMLine && lines != null) {
            lines.doAction(omg, action);
            deselect(lines);
            doPrepare();
        } else {
            Debug.error("Layer " + getName() + " received " + omg + " and "
                    + action + " with no list ready");
        }

        // This is important!!
        if (editorTool != null) {
            editorTool.drawingComplete(omg, action);
        }
    }
 
开发者ID:d2fn,项目名称:passage,代码行数:19,代码来源:GeoCrossDemoLayer.java

示例7: drawingComplete

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
public void drawingComplete(OMGraphic omg, OMAction action) {

        releaseProxyMouseMode();

        if ((omg instanceof OMLine || omg instanceof OMPoly || omg instanceof OMPoint)
                && drawnList != null) {
            drawnList.doAction(omg, action);
            deselect(drawnList);
            doPrepare();
        } else {
            Debug.error("GeoIntersectLayer(" + getName() + "):  received " + omg + " and " + action
                    + " with no list ready");
        }

        // This is important!!
        if (editorTool != null) {
            editorTool.drawingComplete(omg, action);
        }
    }
 
开发者ID:d2fn,项目名称:passage,代码行数:20,代码来源:GeoIntersectionLayer.java

示例8: changeLineThickness

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * @see org.leo.traceroute.ui.geo.AbstractGeoPanel#changeLineThickness(int)
 */
@Override
protected void changeLineThickness(final int thickness) {
	final OMGraphicList list = _layer.getList();
	for (final OMGraphic g : list) {
		if (g instanceof OMLine) {
			final OMLine line = (OMLine) g;
			line.setStroke(new BasicStroke(thickness));
		}
	}
	SwingUtilities4.invokeInEDT(() -> _layer.doPrepare());
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:15,代码来源:OpenMapPanel.java

示例9: getEditableGraphic

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Give an OMGraphic to the EditToolLoader, which will create an
 * EditableOMGraphic for it.
 */
public EditableOMGraphic getEditableGraphic(OMGraphic graphic) {
    if (graphic instanceof OMLine) {
        return new EditableOMLine((OMLine) graphic);
    }
    return null;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:11,代码来源:OMLineLoader.java

示例10: CurrentTimeMarker

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
public CurrentTimeMarker() {

            DrawingAttributes da = new DrawingAttributes();

            da.setFillPaint(tint);
            da.setLinePaint(tint);
            IconPart ip = new BasicIconPart(new Polygon(new int[] { 50, 90, 10,
                    50 }, new int[] { 10, 90, 90, 10 }, 4), da);
            ImageIcon thumbsUpImage = OMIconFactory.getIcon(iconSize,
                    iconSize,
                    ip);

            lowerMark = new OMRaster(0, 0, thumbsUpImage);

            ip = new BasicIconPart(new Polygon(new int[] { 10, 90, 50, 10 }, new int[] {
                    10, 10, 90, 10 }, 4), da);
            ImageIcon thumbsDownImage = OMIconFactory.getIcon(iconSize,
                    iconSize,
                    ip);

            upperMark = new OMRaster(0, 0, thumbsDownImage);

            startingLine = new OMLine(0, 0, 0, 0);
            da.setTo(startingLine);
            add(startingLine);
            add(lowerMark);
            add(upperMark);
        }
 
开发者ID:d2fn,项目名称:passage,代码行数:29,代码来源:TimelineLayer.java

示例11: paintLine

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Draw a rubberband line between two points
 * 
 * @param pt1 the anchor point.
 * @param pt2 the current (mouse) position.
 */
public void paintLine(Point2D pt1, Point2D pt2) {
   if (pt1 != null && pt2 != null) {
      // the line connecting the segments
      OMLine cLine = new OMLine(pt1.getY(), pt1.getX(), pt2.getY(), pt2.getX(), OMGraphic.LINETYPE_GREATCIRCLE);
      // get the map projection
      Projection proj = theMap.getProjection();
      // prepare the line for rendering
      cLine.generate(proj);

      distanceList.add(cLine);
   }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:19,代码来源:DistQuickTool.java

示例12: convert

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
public static OMPoly convert(OMLine omLine) {
    if (omLine.getRenderType() == OMGraphic.RENDERTYPE_LATLON) {
        OMPoly poly = new OMPoly(omLine.getLL(), OMGraphic.DECIMAL_DEGREES, omLine.getLineType());
        poly.setAttributes(omLine.getAttributes());
        DrawingAttributes da = new DrawingAttributes();
        da.setFrom(omLine);
        da.setTo(poly);
        return poly;
    } else
        return null;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:12,代码来源:EsriPolylineList.java

示例13: write

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
/**
 * Write an OMLine to the link.
 */
public static void write(OMLine line, Link link, LinkProperties props)
        throws IOException {

    switch (line.getRenderType()) {
    case OMLine.RENDERTYPE_LATLON:
        double[] ll = line.getLL();
        LinkLine.write((float) ll[0],
                (float) ll[1],
                (float) ll[2],
                (float) ll[3],
                line.getLineType(),
                line.getNumSegs(),
                props,
                link.dos);
        break;
    case OMLine.RENDERTYPE_XY:
        int[] pts = line.getPts();
        LinkLine.write(pts[0], pts[1], pts[2], pts[3], props, link.dos);
        break;
    case OMLine.RENDERTYPE_OFFSET:
        ll = line.getLL();
        pts = line.getPts();
        LinkLine.write((float) ll[0],
                (float) ll[1],
                pts[0],
                pts[1],
                pts[2],
                pts[3],
                props,
                link.dos);
        break;
    default:
        Debug.error("LinkLine.write: line rendertype unknown.");
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:39,代码来源:LinkLine.java

示例14: 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

示例15: createGraphLine

import com.bbn.openmap.omGraphics.OMLine; //导入依赖的package包/类
private OMLine createGraphLine(float year1, float temp1, float year2,
                               float temp2) {
    int x1 = findYearPoint(year1);
    int y1 = findTempPoint(temp1);

    int x2 = findYearPoint(year2);
    int y2 = findTempPoint(temp2);

    OMLine line = createPlotLine(x1, y1, x2, y2, plot_color_);
    line.setLinePaint(plot_color_);
    line.setSelectPaint(select_color_);
    return line;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:14,代码来源:ScatterGraph.java


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