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


Java Segment类代码示例

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


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

示例1: fillMultiPath

import com.esri.core.geometry.Segment; //导入依赖的package包/类
void fillMultiPath(SimpleRasterizer rasterizer, Transformation2D trans, MultiPathImpl polygon, boolean isWinding) {
	SegmentIteratorImpl segIter = polygon.querySegmentIterator();
	Point2D p1 = new Point2D();
	Point2D p2 = new Point2D();
	while (segIter.nextPath()) {
		while (segIter.hasNextSegment()) {
			Segment seg = segIter.nextSegment();
			if (seg.getType() != Geometry.Type.Line)
				throw GeometryException.GeometryInternalError(); // TODO:
			// densify
			// the
			// segment
			// here
			trans.transform(seg.getStartXY(), p1);
			trans.transform(seg.getEndXY(), p2);
			m_rasterizer.addEdge(p1.x, p1.y, p2.x, p2.y);
		}
	}
	
	m_rasterizer.renderEdges(isWinding ? SimpleRasterizer.WINDING : SimpleRasterizer.EVEN_ODD);
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:22,代码来源:RasterizedGeometry2DImpl.java

示例2: strokeDrawPolyPath

import com.esri.core.geometry.Segment; //导入依赖的package包/类
void strokeDrawPolyPath(SimpleRasterizer rasterizer,
		MultiPathImpl polyPath, double tol) {

	Point2D[] fan = new Point2D[4];
	for (int i = 0; i < fan.length; i++)
		fan[i] = new Point2D();

	SegmentIteratorImpl segIter = polyPath.querySegmentIterator();
	double strokeHalfWidth = m_transform.transform(tol) + 1.5;
	double shortSegment = 0.25;
	Point2D vec = new Point2D();
	Point2D vecA = new Point2D();
	Point2D vecB = new Point2D();

	Point2D ptStart = new Point2D();
	Point2D ptEnd = new Point2D();
	Point2D prev_start = new Point2D();
	Point2D prev_end = new Point2D();
	double[] helper_xy_10_elm = new double[10];
	Envelope2D segEnv = new Envelope2D();
	Point2D ptOld = new Point2D();
	while (segIter.nextPath()) {
		boolean hasFan = false;
		boolean first = true;
		ptOld.setCoords(0, 0);
		while (segIter.hasNextSegment()) {
			Segment seg = segIter.nextSegment();
			ptStart.x = seg.getStartX();
			ptStart.y = seg.getStartY();
			ptEnd.x = seg.getEndX();
			ptEnd.y = seg.getEndY();
			segEnv.setEmpty();
			segEnv.merge(ptStart.x, ptStart.y);
			segEnv.mergeNE(ptEnd.x, ptEnd.y);
			if (!m_geomEnv.isIntersectingNE(segEnv)) {
				if (hasFan) {
					rasterizer.startAddingEdges();
					rasterizer.addSegmentStroke(prev_start.x, prev_start.y,
							prev_end.x, prev_end.y, strokeHalfWidth, false,
							helper_xy_10_elm);
					rasterizer.renderEdges(SimpleRasterizer.EVEN_ODD);
					hasFan = false;
				}

				first = true;
				continue;
			}

			m_transform.transform(ptEnd, ptEnd);

			if (first) {
				m_transform.transform(ptStart, ptStart);
				ptOld.setCoords(ptStart);
				first = false;
			} else {
				ptStart.setCoords(ptOld);
			}

			prev_start.setCoords(ptStart);
			prev_end.setCoords(ptEnd);

			rasterizer.startAddingEdges();
			hasFan = !rasterizer.addSegmentStroke(prev_start.x,
					prev_start.y, prev_end.x, prev_end.y, strokeHalfWidth,
					true, helper_xy_10_elm);
			rasterizer.renderEdges(SimpleRasterizer.EVEN_ODD);
			if (!hasFan)
				ptOld.setCoords(prev_end);
		}

		if (hasFan) {
			rasterizer.startAddingEdges();
			hasFan = !rasterizer.addSegmentStroke(prev_start.x,
					prev_start.y, prev_end.x, prev_end.y, strokeHalfWidth,
					false, helper_xy_10_elm);
			rasterizer.renderEdges(SimpleRasterizer.EVEN_ODD);
		}
	}
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:80,代码来源:RasterizedGeometry2DImpl.java


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