本文整理汇总了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);
}
}
示例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()); }
*/
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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;
}